This guide addresses common questions and issues that may arise when upgrading KubeBlocks, ensuring a smooth and efficient process.
Manually mark Addons
In earlier versions, KubeBlocks pre-installed some Addons in the Helm chart, but some of these Addons have been removed in the new version. Consequently, if you upgrade directly from an older version to the latest, Helm will remove the CRs of these removed Addons, affecting the clusters created by these Addons. To prevent this, it is recommended to add the "helm.sh/resource-policy": "keep" annotation for Addons to ensure they remain during upgrading.
View the Addon annotation
Run the command below to view the annotations of Addons.
If you want to check whether the annotation for an Addon was added successfully, replace {addonName} with the actual Addon name and run the command below.
Fix "cannot patch 'kubeblocks-dataprotection' with kind Deployment" error
When upgrading KubeBlocks to v0.8.x/v0.9.x, you might encounter the following error:
Error: UPGRADE FAILED: cannot patch "kubeblocks-dataprotection" with kind Deployment: Deployment.apps "kubeblocks-dataprotection" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"dataprotection", "app.kubernetes.io/instance":"kubeblocks", "app.kubernetes.io/name":"kubeblocks"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable && cannot patch "kubeblocks" with kind Deployment: Deployment.apps "kubeblocks" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"apps", "app.kubernetes.io/instance":"kubeblocks", "app.kubernetes.io/name":"kubeblocks"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
This error occurs due to label modifications introduced for KubeBlocks and KubeBlocks-Dataprotection in KubeBlocks v0.9.x.
To resolve the issue, manually delete the kubeblocks and kubeblocks-dataprotection deployments, then run helm upgrade to complete the upgrade to v0.9.x.
Specify an image registry during upgrading KubeBlocks
Starting from v0.9.0, one of KubeBlocks' image registries has changed. Specifically, the registry prefix for one of the repositories has been updated from infracreate-registry to apecloud-registry. Other image registries remain unaffected. If you installed KubeBlocks before v0.9.0, check and update your image registry configuration during the upgrade.
Check the image registry of KubeBlocks.
helm -n kb-system get values kubeblocks -a | yq .image.registry
If the image registry starts with infracreate-registry as shown below, you must specify the new image registry during the upgrade by changing the image registry prefix to apecloud-registry.
Output
infracreate-registry.cn-xxx.xxx.com
Override the default image registry by specifying the following parameters.