Upgrading Clusters on VMware vSphere
This document explains how to upgrade Kubernetes clusters on VMware vSphere after the platform-side distribution upgrade is complete. The documented workflow focuses on updating the control plane and worker nodes through Cluster API resources.
Upgrade Sequence
Upgrade VMware vSphere clusters in the following order:
- Complete the distribution-version upgrade described in Upgrading Clusters.
- Verify that the control plane is healthy and the current cluster is stable.
- Upgrade the control plane Kubernetes version.
- Upgrade worker nodes to the target Kubernetes version.
Prerequisites
Before you begin, ensure the following conditions are met:
- The distribution-version upgrade is complete.
- The control plane is healthy and reachable.
- All nodes are in the
Readystate. - The target VM template is compatible with the target Kubernetes version.
- The CAPV static allocation pools have enough capacity for rolling updates.
Templates are immutable
VSphereMachineTemplate resources cannot be modified in-place. Each upgrade that changes VM specifications or the VM template name requires creating a new VSphereMachineTemplate with a new name and updating the reference in KubeadmControlPlane or MachineDeployment.
Steps
Create the target machine templates
Before you start the rolling upgrade, create new VSphereMachineTemplate resources for the control plane and workers.
-
Export the existing control plane template
-
Modify the control plane template
Edit
new-cp-template.yaml:- Set
metadata.nameto a new unique name (for example,<cluster_name>-control-plane-v2) - Update
spec.template.spec.templateto the target VM template name - Update CPU, memory, or disk settings if needed
- Remove server-generated fields:
metadata.resourceVersion,metadata.uid,metadata.generation,metadata.creationTimestamp,metadata.managedFields,metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"], andstatus
- Set
-
Export and modify the worker template
Edit
new-worker-template.yaml:- Set
metadata.nameto a new unique name (for example,<cluster_name>-worker-v2) - Update
spec.template.spec.templateto the target VM template name - Update CPU, memory, or disk settings if needed
- Remove the same server-generated fields listed above
- Set
-
Apply both new templates
Upgrade the control plane
Update the KubeadmControlPlane resource to reference the new control plane template and the target Kubernetes version.
Typical changes include:
spec.version— the target Kubernetes versionspec.machineTemplate.infrastructureRef.name— the newVSphereMachineTemplatename- Related image tags such as
dns.imageTagandetcd.local.imageTagwhen the target release requires them
Apply the changes:
If the target Kubernetes release also requires updated image tags (for example, dns.imageTag or etcd.local.imageTag), include them in the patch payload or apply a complete manifest with kubectl apply -f.
Monitor the control plane rollout:
Upgrade the worker nodes
After the control plane upgrade completes, update the MachineDeployment to reference the new worker template and the target Kubernetes version.
Typical changes include:
spec.template.spec.version— the target Kubernetes versionspec.template.spec.infrastructureRef.name— the newVSphereMachineTemplatenamespec.template.spec.bootstrap.configRef.name— the newKubeadmConfigTemplatename, if bootstrap settings must change (see Updating Bootstrap Templates)
Apply the changes:
Monitor the worker rollout:
Rolling Back a Failed Upgrade
If the rolling update fails (for example, new VMs fail to boot or nodes do not become Ready), revert the template references back to the previous template names. The old templates still exist and Cluster API will roll back to the previous configuration.
- For control plane: patch
KubeadmControlPlaneto restore the previousspec.machineTemplate.infrastructureRef.nameandspec.version. - For workers: patch
MachineDeploymentto restore the previousspec.template.spec.infrastructureRef.nameandspec.template.spec.version.
Verification
Confirm the following results after the upgrade:
KubeadmControlPlanereaches the target version and desired replica count.MachineDeploymentreaches the target version and desired replica count.- Control plane and worker nodes return to the
Readystate. - The vSphere CPI daemonset remains available in the workload cluster.
Next Steps
After the Kubernetes upgrade is complete, continue with routine node operations in Managing Nodes on VMware vSphere.