Installing Percona XtraDB Cluster on Kubernetes for Tracardi

Installing Percona XtraDB Cluster on Kubernetes for Tracardi
Photo by Growtika / Unsplash

Percona XtraDB Cluster (PXC) is a robust, highly available, and scalable MySQL-compatible database solution. When using Tracardi, an open-source customer data platform, having a reliable and performant database is crucial. This guide will walk you through the process of installing Percona XtraDB Cluster on a Kubernetes (K8s) environment, providing a solid foundation for your Tracardi deployment.

Prerequisites

Before we begin, ensure you have the following:

  1. A functioning Kubernetes cluster
  2. kubectl command-line tool installed and configured to communicate with your cluster
  3. Helm package manager installed on your local machine

These prerequisites will ensure a smooth installation process and enable you to manage your Percona deployment effectively.

Step 1: Adding the Percona Helm Repository

We'll be using Helm, a package manager for Kubernetes, to simplify the Percona XtraDB Cluster installation process. The first step is to add the Percona repository, which contains the necessary Helm charts.

Open your terminal and run the following command:

helm repo add percona https://percona.github.io/percona-helm-charts/

This command registers the Percona repository with Helm, making the PXC charts available for installation.

Step 2: Updating the Helm Repository

To ensure you have access to the latest charts and updates, it's important to update your Helm chart repository:

helm repo update

This command synchronizes your local Helm chart repository with the remote one, ensuring you have the most up-to-date version of the Percona XtraDB Cluster chart.

Step 3: Configuring Your Percona XtraDB Cluster Deployment

Now, we need to create a configuration file that defines the structure and resources for our Percona XtraDB Cluster deployment. Create a new file named values.yaml and add the following content:

allowUnsafeConfigurations: true

sharding:
  enabled: false

backup:
  enabled: true

pxc:
  size: 1
  volumeSpec:
    pvc:
      resources:
        requests:
          storage: 2Gi

haproxy:
  enabled: true
  size: 1
  resources:
    requests:
      memory: 100Mi

proxysql:
  size: 1

This configuration sets up a Percona XtraDB Cluster deployment with the following features:

  • A single-node PXC cluster (for simplicity, but can be scaled up)
  • 2GB of persistent storage for the database
  • Enabled backups for data durability
  • HAProxy for load balancing
  • ProxySQL for query routing and caching

Feel free to adjust these values based on your specific requirements and available resources.

Step 4: Creating a Dedicated Namespace

It's a good practice to isolate different components of your application stack. Let's create a dedicated namespace for our Percona XtraDB Cluster deployment:

kubectl create namespace percona

This command creates a new namespace called "percona" where we'll deploy our Percona XtraDB Cluster.

Step 5: Installing Percona XtraDB Cluster

Now comes the exciting part – actually installing Percona XtraDB Cluster! We'll do this in two steps: first, we'll install the Percona Operator, and then we'll deploy the actual database cluster.

First, install the Percona Operator:

helm install percona-op percona/pxc-operator --namespace percona

This command installs the Percona Operator, which manages the lifecycle of your Percona XtraDB Cluster.

Next, deploy the Percona XtraDB Cluster using our custom configuration:

helm install percona-db percona/pxc-db --values values.yaml --namespace percona

This command deploys the Percona XtraDB Cluster using the configurations we specified in our values.yaml file.

Step 6: Verifying the Installation

After a few minutes, your Percona XtraDB Cluster deployment should be up and running. To verify the installation, use this command:

kubectl get pods -n percona

You should see output similar to this:

NAME                                     READY   STATUS    RESTARTS   AGE
percona-db-pxc-db-0                      1/1     Running   0          5m
percona-db-pxc-haproxy-0                 1/1     Running   0          5m
percona-db-pxc-proxysql-0                1/1     Running   0          5m

If all pods are in the "Running" state, congratulations! Your Percona XtraDB Cluster is now operational and ready for use with Tracardi.

Conclusion

You've successfully installed a Percona XtraDB Cluster on Kubernetes, tailored for use with Tracardi. This setup provides a robust, highly available MySQL-compatible database that will serve as a solid foundation for your Tracardi deployment.

Remember, you can always modify your Percona XtraDB Cluster deployment in the future by updating the values.yaml file and running the Helm upgrade command. This flexibility allows you to adapt your database setup as your needs change over time.

With your Percona XtraDB Cluster now in place, you're one step closer to leveraging the full power of Tracardi for your customer data management needs. Happy data processing!