Two operators, two ways to replicate. Which one do you run, and who fails over?
Percona ships two Kubernetes operators for MySQL. One runs XtraDB Cluster. The other runs Percona Server with Group Replication or, in tech preview, asynchronous replication managed by Orchestrator.
A MySQL pod that dies is easy to restart. The hard part is everything around it: which pod is the writer now, how a new pod joins the group without losing data, how the proxy finds the writer, and how you take a backup that you can restore. An operator is a controller that knows those rules for one database and keeps them true while pods and nodes come and go.
Percona ships two operators for MySQL. They are different products with different replication, so pick before you deploy.
| Percona Operator for MySQL based on Percona XtraDB Cluster (PXC) | Percona Operator for MySQL based on Percona Server (PS) | |
|---|---|---|
| Replication | Galera-based synchronous replication in Percona XtraDB Cluster. | Group Replication (GA) or asynchronous replication (tech preview in the 1.3.0 docs). |
| Who handles failover | The cluster itself: the group keeps a majority and drops the failed node. | Group Replication: the group protocol. Async: Orchestrator, which the operator deploys. |
| Proxy | HAProxy or ProxySQL. | HAProxy for both modes. MySQL Router for Group Replication only. |
| Status per Percona | Percona called it "production-ready and widely adopted" in a July 2022 post. | 1.0.0 with Group Replication went GA in November 2025. The 1.3.0 docs say async is tech preview and not recommended for production. |
| Versions used on this page | Operator 1.20.0 | Operator 1.3.0 |
Write availability and the data, on a platform that reschedules pods without asking you.
Declarative clusters, automatic recovery of failed pods, rolling updates, scheduled backups with XtraBackup, and a proxy in front.
In the PS operator's async mode, Orchestrator decides the new primary. Percona says its Operator for MySQL uses Orchestrator to manage asynchronous topologies, so the ProxySQL takeover matters to it. See Orchestrator.
Not a replacement for knowing MySQL. You still read GTIDs, lag and the error log, and you still test restores.
Running on bare servers instead? See InnoDB Cluster for Group Replication with Router, or Orchestrator for classic replicas.
The plain approach is a StatefulSet of three MySQL pods, one writer and two replicas, with a Service in front. The first pod is the writer because it is named mysql-0. Kubernetes restarts it if it dies, and that is where its help ends.
mysql-0 pending while its volume is attached to the lost node. Writes are down.mysql-1. If you promote, you check GTIDs first and then point mysql-2 at it.mysql-0 returns it believes it is the writer. If nothing stopped it, you have two writers.Every one of those is a script somebody has to write, test and keep current. The operator is those scripts, written once, with tests.
Step through it:
You want one custom resource that says "three MySQL nodes, this proxy, these backups", and a controller that creates and repairs everything underneath.
Install the operator once. Create a PerconaXtraDBCluster (PXC operator) or a PerconaServerMySQL (PS operator) resource. The PS operator deploys, in StatefulSets: Percona Server for MySQL, XtraBackup, Orchestrator (only with async replication), HAProxy (both modes) or MySQL Router (Group Replication only), and optional sidecars such as PMM Client. The PXC operator's default cr.yaml deploys three PXC pods and three HAProxy pods and schedules a daily backup to a PVC.
cluster1-haproxy or ps-cluster1-router.unsafeFlags setting.error with reason FullClusterCrashDetected and needs the operator to reboot it.Step through it:
kubectl create namespace mysql kubectl apply --server-side -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/v1.20.0/deploy/bundle.yaml -n mysql kubectl apply -f https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/v1.20.0/deploy/cr.yaml -n mysql kubectl get pxc -n mysql
The default cr.yaml deploys three PXC pods and three HAProxy pods spread across nodes, so you need at least three schedulable nodes. On one node (a lab) use deploy/cr-minimal.yaml instead. When the cluster is ready the output looks like cluster1 cluster1-haproxy.mysql ready 3 3. The default also schedules a daily backup to a PVC and keeps the last five.
Key fields to set in your own copy of cr.yaml (apiVersion: pxc.percona.com/v1, kind: PerconaXtraDBCluster): crVersion: 1.20.0, pxc.size: 3, haproxy.enabled: true and haproxy.size: 3 (or ProxySQL, one proxy at a time), and backup.storages pointing at S3-compatible storage.
git clone -b v1.3.0 https://github.com/percona/percona-server-mysql-operator cd percona-server-mysql-operator kubectl apply --server-side -f deploy/crd.yaml kubectl create namespace mysql kubectl config set-context $(kubectl config current-context) --namespace=mysql kubectl apply -f deploy/rbac.yaml kubectl apply -f deploy/operator.yaml # edit deploy/secrets.yaml with your users and passwords, then: kubectl create -f deploy/secrets.yaml kubectl apply -f deploy/cr.yaml
You should see ps-cluster1-mysql-0, -1, -2 and ps-cluster1-haproxy-0, -1, -2 plus the operator pod. The default file uses Group Replication with HAProxy, so there is no Orchestrator pod; ps-cluster1-orc-0 appears only with mysql.clusterType: async and orchestrator.enabled: true. In cr.yaml (kind: PerconaServerMySQL) set crVersion: 1.3.0 and mysql.clusterType to group-replication for production or async for the tech-preview Orchestrator mode.
Read the root credentials from the connection secret ps-cluster1-psuser-root and connect through the proxy from a client pod:
kubectl get secret ps-cluster1-psuser-root -n mysql -o jsonpath='{.data.password}' | base64 --decode && echo
kubectl run -i --rm --tty percona-client --image=percona/percona-server:8.4 --restart=Never -- bash -il
mysql -h ps-cluster1-haproxy -uroot -p # HAProxy, the default
mysql -h ps-cluster1-router -uroot -p # MySQL Router, Group Replication clusters With Group Replication the default proxy is HAProxy. To use MySQL Router instead, set proxy.router.enabled: true and turn HAProxy off. The Percona 2022 post lists its ports: 6446 read/write to the primary, 6447 read-only across replicas, and 6448 and 6449 for the same split over the X protocol. Confirm the ports on your version.
Three PXC pods and three HAProxy pods. The pod that holds the writer role dies.
Step through it:
Step through it:
Because Percona calls async mode tech preview, treat this as a lab and test setup for now. Check the current docs before you rely on it.
Group Replication elects a new primary on its own and the proxy follows it (MySQL Router reads the group metadata, HAProxy uses health checks), as on the InnoDB Cluster page. The operator reschedules the failed pod, which rejoins after a RECOVERING phase. If every member crashes, the cluster status is error with reason FullClusterCrashDetected, and the operator reboots the cluster.
NS is the namespace and NAME the cluster name (cluster1 for PXC and ps-cluster1 for PS in the default files).
kubectl get pxc -n NS # PXC operator: state, PXC and HAProxy counts
kubectl get ps -n NS # PS operator
kubectl get pxc NAME -n NS -o jsonpath='{.status.state}' # ready, initializing or error
kubectl get pxc NAME -n NS -o jsonpath='{.status.message}' # why, when state is error
kubectl get pods -n NS kubectl scale --replicas=5 pxc/NAME -n NS
kubectl patch ps NAME -n NS --type='json' -p='[{"op":"replace","path":"/spec/mysql/size","value":5}]' PXC: odd numbers, 3 to 5 recommended. PS: async accepts 2 or more, Group Replication wants an odd number from 3 to 9. Anything else needs unsafeFlags. Do not scale the StatefulSets directly, the operator will not reconcile them back. Proxies are scaled through haproxy.size or proxysql.size in the custom resource, with at least 2 pods by default.
kubectl patch pxc NAME -n NS --type=merge -p '{"spec":{"pause":true}}'
kubectl patch pxc NAME -n NS --type=merge -p '{"spec":{"pause":false}}'
kubectl patch ps NAME -n NS --type=merge -p '{"spec":{"pause":true}}'
kubectl patch ps NAME -n NS --type=merge -p '{"spec":{"pause":false}}' The docs set spec.pause by editing cr.yaml: true gracefully stops the cluster, false starts it again. The patch above makes the same change. A paused cluster has no writes, so tell your users first.
Backups use Percona XtraBackup and go to the storages you list in the custom resource. On demand, you create a backup resource (PerconaXtraDBClusterBackup for PXC). Restore with a restore resource (PerconaXtraDBClusterRestore). Test a restore into a new cluster, not over production.
| Symptom | Likely cause | First check | Fix |
|---|---|---|---|
Cluster state error right after a size change | Unsafe node count (PXC outside 3 to 5, even counts, GR outside 3 to 9, proxies under 2). | .status.message | Set an allowed size, or set the relevant unsafeFlags knowingly. |
Cluster stuck initializing | Rolling restart in progress, pod Pending, storage or quota. | kubectl get pods, describe pod, events. | Fix scheduling or storage. Do not delete pods blindly during a restart. |
| PXC: one node left of three | Two nodes lost, no majority. | Pod status, PXC logs. | Restore the other nodes. Do not force a one-node bootstrap unless you accept the data risk and know which node is newest. |
PS GR: FullClusterCrashDetected | All members down. | Cluster status reason. | Let the operator reboot the cluster. Check the newest member first. |
| PS async: no new primary | Orchestrator down, recovery blocked or disabled, replicas not in sync. | Orchestrator pod logs and API (see the Orchestrator page). | Fix Orchestrator. Async mode is tech preview, plan manual steps. |
| App errors after failover | Connections dropped, proxy not yet updated. | Proxy pod health and logs. | Retry in the app, reconnect through the Service name. |
| Backup fails | Storage credentials, bucket, or cluster not ready (backups are blocked unless unsafeFlags.backupIfUnhealthy (PXC) or unsafeFlags.backupNonReadyCluster (PS)). | Backup resource status. | Fix credentials, or the cluster first. |
| Operator upgrade surprises | CRDs, crVersion mismatch. | Release notes of the operator version. | Upgrade the operator, then the custom resource, one step at a time, in a test namespace first. |
| Signal | Where | Alert when |
|---|---|---|
Cluster .status.state | kube-state-metrics or a periodic kubectl get | Not ready for more than a few minutes. |
| Group membership | performance_schema.replication_group_members (GR), wsrep_cluster_size and wsrep_ready (PXC) | Any member not ONLINE, or a size below the expected count. |
| Replication lag and queues | MySQL status and PMM | Lag above your RPO, growing apply queue. |
| Orchestrator health (async) | Orchestrator /metrics and /health/leader | Failed recoveries, no leader. |
| Backup age and last result | Backup resources | No success within the window. |
| PVC use and pod restarts | kubelet metrics | Above 80 percent, or restart loops. |
Percona documents PMM Client as an optional sidecar, so PMM is the natural place for MySQL-level dashboards. Related pages: Orchestrator, InnoDB Cluster, running 1,000 databases.
Every change is shown to you first and runs only after you type an approval. Reads run straight away. Use --kind pxc or --kind ps.
python3 -m dbagent.ha k8s status --kind pxc --name CLUSTER -n NS python3 -m dbagent.ha k8s status --kind ps --name CLUSTER -n NS python3 -m dbagent.ha k8s pause --kind pxc --name CLUSTER -n NS python3 -m dbagent.ha k8s resume --kind pxc --name CLUSTER -n NS python3 -m dbagent.ha k8s scale --kind ps --name CLUSTER --size N -n NS
pause and resume set spec.pause. scale sets the node count and follows the size rules above. The same commands take --kind psmdb for MongoDB.
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.