Complex operations in this context refer to more than simple upgrades, scaling up or down; they involve a mix of these actions. Kubernetes' declarative API mandates efficient implementation of such operations, and the operator is designed to support them.
To illustrate, we can simultaneously
- Change the CN image to polardbx/polardbx-sql:v2.0
- Adjust CDC configuration to 8C32G
- Increase the number of nodes in DN to 3
Likewise, these changes can be made using kubectl edit
or kubectl patch
. In this demonstration, we showcase the use of kubectl patch
.
First, prepare a patch file,
spec:
topology:
nodes:
cn:
template:
image: polardbx/polardbx-sql:v2.0
dn:
replicas: 3
cdc:
template:
resources:
limits:
cpu: 8
memory: 32Gi
Execute the following command to apply these changes:
kubectl patch --type='merge' pxc polardbx-test --patch-file patch.yaml
Now, observe the simultaneous changes in CN, DN, CDC, and the ongoing data migration:
kubectl get pxc polardbx-test -o wide
NAME PROTOCOL GMS CN DN CDC PHASE DISK STAGE REBALANCE VERSION AGE
polardbx-test 8.0 1/1 1/2 2/3 1/2 Upgrading 22.6 GiB 8.0.3-PXC-5.4.13-20220418/8.0.18 35d
kubectl get pxc polardbx-test -o wide
NAME PROTOCOL GMS CN DN CDC PHASE DISK STAGE REBALANCE VERSION AGE
polardbx-test 8.0 1/1 2/2 3/3 2/2 Upgrading 22.6 GiB RebalanceWatch 50% 8.0.3-PXC-5.4.13-20220418/8.0.18 35d
Note: As explained in "Uninterruptible Scenarios," data migration cannot be interrupted.