$ kubectl get pg
NAME ENDPOINT STATUS POSTGRES PGBOUNCER AGE
cluster1 cluster1-pgbouncer.default.svc ready 3 3 19m
$ kubectl scale pg/cluster1 --replicas=4
Error from server (NotFound): perconapgclusters.pgv2.percona.com "cluster1" not found
$ kubectl get postgresclusters
NAME AGE
cluster1 19m
$ kubectl scale postgresclusters/cluster1 --replicas=4
Error from server (NotFound): postgresclusters.postgres-operator.crunchydata.com "cluster1" not found
That said, it can be scaled by patching the object:
It would be great to have the kubectl scale command to simplify scaling operations.
Environment
None
Activity
Andrii Dema
July 1, 2025 at 12:53 PM
We have decided not to implement kubectl scale support for this resource. The PerconaPGCluster defines postgres instances using the .spec.instances[] array. However, the kubectl scale command only supports a single --replicas flag, which maps to a single field. In order to support this functionality, a single field representing cluster size would be required, but our current design uses multiple fields
kubectl scale doesn't work in the PG operator:
$ kubectl get pg NAME ENDPOINT STATUS POSTGRES PGBOUNCER AGE cluster1 cluster1-pgbouncer.default.svc ready 3 3 19m $ kubectl scale pg/cluster1 --replicas=4 Error from server (NotFound): perconapgclusters.pgv2.percona.com "cluster1" not found $ kubectl get postgresclusters NAME AGE cluster1 19m $ kubectl scale postgresclusters/cluster1 --replicas=4 Error from server (NotFound): postgresclusters.postgres-operator.crunchydata.com "cluster1" not found
That said, it can be scaled by patching the object:
$ kubectl patch perconapgcluster cluster1 --type=merge --patch '{ "spec": { "instances": [ { "name": "instance1", "replicas": 4, "dataVolumeClaimSpec": { "accessModes": ["ReadWriteOnce"], "resources": { "requests": { "storage": "1Gi" } } } } ] } }' perconapgcluster.pgv2.percona.com/cluster1 patched
It would be great to have the kubectl scale command to simplify scaling operations.