This is adapted from: https://cluster-api.sigs.k8s.io/tasks/upgrading-clusters.html
For more complex upgrades, additional context or further considerations the upstream documentation is recommended.
Version Upgrades
It’s recommended to regularly upgrade your clusters. This avoids trying to maintain tooling version compatibility against major Kubernetes versions.
Multiple Version Upgrades
If you are upgrading multiple major Kubernetes versions you can only upgrade major step at a time. Additionally you need to check support against clusterctl here: https://cluster-api.sigs.k8s.io/reference/versions
To upgrade major versions you will need to follow the https://stfc.atlassian.net/wiki/spaces/CLOUDKB/pages/285704256/Cluster+API+Upgrade#Upgrade-Clusterctl-and-CAPI-components section first then https://stfc.atlassian.net/wiki/spaces/CLOUDKB/pages/285704256/Cluster+API+Upgrade#Upgrading-Kubernetes-Major-Version for each hop.
Upgrade Clusterctl and CAPI components
We need to upgrade clusterctl to be aware of the latest CAPI version. Download the latest version which supports your cluster version.
In the case of multiple upgrades, download the latest clusterctl which supports your current Kubernetes cluster version including the management plane.
Copy the latest release (with support for your cluster) URL from: https://github.com/kubernetes-sigs/cluster-api/releases . This should be the
linux-amd64
packagecurl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/<version>/clusterctl-linux-amd64 -o clusterctl
chmod +x ./clusterctl sudo mv ./clusterctl /usr/local/bin/clusterctl # Validate version clusterctl version
Plan the upgrade for the management cluster. These components handle the upgrades for the clusters it manages:
helm list -n clusters # print management cluster name clusterctl upgrade plan -n clusters <name>
Validate that the upgrade is valid and apply the command provided by clusterctl
Upgrading Kubernetes Major Version
Update the helm Cluster API charts:
helm repo update capi helm repo update capi-addons helm upgrade cluster-api-addon-provider capi-addons/cluster-api-addon-provider -n clusters --install --wait cd <folder_with_values>
Ensure the latest helm chart works without upgrading the K8s Major version:
helm upgrade <cluster_name> capi/openstack-cluster --install -f values.yaml -f clouds.yaml -f user-values.yaml -f flavors.yaml -n clusters
Update
user-values.yaml
by eithergit pull
the latest image from the cloud team, or manually editing themachineImage
andkubernetesVersion
fieldsRe-run the helm upgrade to upgrade the cluster version:
helm upgrade <cluster_name> capi/openstack-cluster --install -f values.yaml -f clouds.yaml -f user-values.yaml -f flavors.yaml -n clusters
Monitor the upgrade using
clusterctl describe cluster <cluster_name>