Note: This article discusses the process of upgrading, which involves modifying the image of one or more components. In practical terms, you can perform actions like upgrading, adjusting capacity, and scaling simultaneously.
Using the YAML from the previous article 《1. Create》 as a reference, let's say we want to update the image for CN to polardbx/polardbx-sql:v2.0
. To achieve this, you can use either kubectl edit
or kubectl patch
to modify the image field under .spec
. Here, we illustrate the process using kubectl patch
:
kubectl patch --type='merge' pxc polardbx-test -p '{"spec": {"topology": {"nodes": {"cn": {"template": {"image": "polardbx/polardbx-sql:v2.0"}}}}}}'
Afterwards, monitor the cluster status. The PHASE
will transition to the Upgrading
state, indicating that the upgrade is in progress:
kubectl get pxc polardbx-test
NAME GMS CN DN CDC PHASE DISK AGE
polardbx-test 1/1 1/2 2/2 2/2 Upgrading 6.2Gi 93s
When the PHASE
reverts to Running
, the upgrade is successfully completed.