skills/kubeblocks-minor-version-upgrade/SKILL.md
Upgrade the database engine minor version for KubeBlocks clusters via OpsRequest. Performs a rolling upgrade with minimal downtime. Use when the user wants to upgrade, update, or patch the database engine version (e.g. MySQL 8.0.33 to 8.0.35, PostgreSQL 14.7 to 14.10). NOT for upgrading the KubeBlocks operator itself (see KubeBlocks official upgrade docs) or for major version upgrades (e.g. MySQL 5.7 to 8.0, which requires data migration).
npx skillsauth add apecloud/kubeblocks-skills kubeblocks-minor-version-upgradeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
KubeBlocks supports upgrading the database engine's minor version (e.g., MySQL 8.0.33 → 8.0.35, PostgreSQL 16.1 → 16.2). The upgrade performs a rolling update: secondary pods restart first, then a switchover promotes a secondary to primary, and finally the original primary restarts — minimizing downtime.
Official docs: https://kubeblocks.io/docs/preview/user_docs/handle-an-exception/upgrade-database-engine
Before proceeding, verify the cluster is healthy and no other operation is running:
# Cluster must be Running
kubectl get cluster <cluster-name> -n <namespace> -o jsonpath='{.status.phase}'
# No pending OpsRequests
kubectl get opsrequest -n <namespace> -l app.kubernetes.io/instance=<cluster-name> --field-selector=status.phase!=Succeed
If the cluster is not Running or has a pending OpsRequest, wait for it to complete before proceeding.
Check current version and available upgrade targets:
# Current version
kubectl get cluster <cluster-name> -n <namespace> -o jsonpath='{.spec.componentSpecs[*].serviceVersion}'
# Available versions
kubectl get cmpv
- [ ] Step 1: Check current version
- [ ] Step 2: List available versions
- [ ] Step 3: Update serviceVersion in Cluster CR
- [ ] Step 4: Verify upgrade
kubectl get cluster <cluster> -n <ns> -o jsonpath='{.spec.componentSpecs[*].serviceVersion}'
Or check from the running pods:
kubectl get cluster <cluster> -n <ns> -o yaml | grep serviceVersion
List available component versions for the addon:
kubectl get cmpv
Example output:
NAME VERSIONS AGE
apecloud-mysql 8.0.30, 8.0.33, 8.0.35 10d
postgresql 14.11.0, 15.7.0, 16.4.0 10d
redis 7.0.6, 7.2.4 10d
mongodb 6.0.5, 7.0.12 10d
For detailed information about a specific version:
kubectl get cmpv <addon-name> -o yaml
This shows the exact image tags, compatibility rules, and supported version transitions.
Edit the Cluster CR to set the new serviceVersion:
kubectl edit cluster <cluster> -n <ns>
Change the serviceVersion field in the relevant component spec:
spec:
componentSpecs:
- name: <component>
serviceVersion: "8.0.35" # new version
# ... rest of component spec
Or patch it directly. Before patching, validate with dry-run:
kubectl patch cluster <cluster> -n <ns> --type merge -p '
{
"spec": {
"componentSpecs": [
{
"name": "<component>",
"serviceVersion": "<new-version>"
}
]
}
}' --dry-run=server
If dry-run reports errors, fix the patch before proceeding.
kubectl patch cluster <cluster> -n <ns> --type merge -p '
{
"spec": {
"componentSpecs": [
{
"name": "<component>",
"serviceVersion": "<new-version>"
}
]
}
}'
kubectl get pods -n <ns> -l app.kubernetes.io/instance=<cluster> -w
Success condition: All pods
.status.phase=Running| Typical: 5-15min for rolling upgrade | If stuck >20min:kubectl describe pod <pod> -n <ns>
The rolling upgrade follows this sequence:
This order matters: by upgrading secondaries first, the cluster maintains a working primary throughout the process. If a secondary fails to start on the new version, the primary is still on the old (known-good) version and the cluster remains fully operational — you can investigate and roll back without any write downtime. Upgrading the primary last also ensures the switchover only happens once, minimizing the brief write interruption to a single event.
Ref: https://kubeblocks.io/blog/in-place-updates
# Check cluster spec
kubectl get cluster <cluster> -n <ns> -o jsonpath='{.spec.componentSpecs[*].serviceVersion}'
# Verify from the database itself
# MySQL
kubectl exec -it <pod> -n <ns> -- mysql -u root -p -e "SELECT VERSION();"
# PostgreSQL
kubectl exec -it <pod> -n <ns> -- psql -U postgres -c "SELECT version();"
# Redis
kubectl exec -it <pod> -n <ns> -- redis-cli INFO server | grep redis_version
# MongoDB
kubectl exec -it <pod> -n <ns> -- mongosh --eval "db.version()"
ComponentVersion CR for supported upgrade paths — not all version transitions may be allowed.Upgrade stuck or pods in CrashLoopBackOff:
kubectl describe pod <pod> -n <ns>kubectl logs <pod> -n <ns>Version not available:
helm upgrade kb-addon-<addon> kubeblocks/<addon> -n kb-system --version <addon-version>Rollback:
serviceVersion back to the previous version to trigger a rollbackFor general agent safety conventions (dry-run, status confirmation, production protection), see safety-patterns.md.
devops
Expand persistent volume storage for KubeBlocks database clusters via OpsRequest. Requires the StorageClass to support volume expansion (allowVolumeExpansion=true). Use when the user needs more disk space, wants to increase storage, expand volumes, or resize PVCs. NOT for changing CPU/memory (see vertical-scaling) or adding more replicas (see horizontal-scaling). Note that volume shrinking is not supported by Kubernetes.
data-ai
Scale CPU and memory resources for KubeBlocks database clusters via OpsRequest (vertical scaling). Supports in-place updates when the feature gate is enabled. Use when the user wants to change, increase, decrease, resize, or adjust CPU or memory resources of a database cluster. NOT for adding/removing replicas or shards (see horizontal-scaling) or expanding disk storage (see volume-expansion).
data-ai
Upgrade the KubeBlocks operator itself via Helm. Covers update operator, upgrade to v1.0, update kubeblocks version, and CRD updates. Use when the user wants to upgrade KubeBlocks, update the operator, or upgrade to a new KubeBlocks release. NOT for upgrading database engine versions (see minor-version-upgrade).
development
Diagnostic guide for KubeBlocks-managed database clusters. Use when the user reports troubleshoot, debug, diagnose, not working, error, failed, stuck, CrashLoopBackOff, cluster exception, or similar problems with their database cluster. This skill guides the agent through diagnostic steps — it does NOT perform actions.