Skip to content

Install Percona Server for MySQL cluster using kubectl

A Kubernetes Operator is a special type of controller introduced to simplify complex deployments. The Operator extends the Kubernetes API with custom resources.

The Percona Operator for MySQL is based on best practices for configuration and setup of a Percona Server for MySQL in a Kubernetes-based environment on-premises or in the cloud.

We recommend installing the Operator with the kubectl command line utility. It is the universal way to interact with Kubernetes. Alternatively, you can install it using the Helm package manager.

Install with kubectl Install with Helm


To install Percona Server for MySQL cluster, you need the following:

  1. The kubectl tool to manage and deploy applications on Kubernetes, included in most Kubernetes distributions. Install not already installed, follow its official installation instructions .

  2. A Kubernetes environment. You can deploy it on Minikube for testing purposes or using any cloud provider of your choice. Check the list of our officially supported platforms.


Here’s a sequence of steps to follow:

  1. Create the Kubernetes namespace for your cluster. It is a good practice to isolate workloads in Kubernetes by installing the Operator in a custom namespace. Replace the <namespace> placeholder with your value.

    $ kubectl create namespace <namespace>
    Expected output
    namespace/<namespace> was created
  2. Deploy the Operator with the following command:

    $ kubectl apply -f  -n <namespace>
    Expected output created created created
    serviceaccount/percona-server-mysql-operator created created created created created
    configmap/percona-server-mysql-operator-config created
    deployment.apps/percona-server-mysql-operator created

    As the result you will have the Operator Pod up and running.

  3. Deploy Percona Server for MySQL cluster:

    $ kubectl apply -f -n <namespace>
    Expected output created
  4. Check the Operator and the database Pods status.

    $ kubectl get ps -n <namespace>

    The creation process may take some time. When the process is over your cluster obtains the ready status.

    Expected output
    cluster1   group-replication   cluster1-haproxy.default   ready   3                                3        20m

You have successfully installed and deployed the Operator with default parameters.

The default configuration includes three HAProxy and three Percona Server for MySQL instances.

You can check the rest of the Operator’s parameters in the Custom Resource options reference.

Next steps

Connect to Percona Server for MySQL

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.

Last update: 2024-06-24