This task describes how to update the Tanzu Kubernetes release version for a TKG cluster by editing the TKG cluster manifest.
You can a initiate a rolling update of a TKGS cluster by upgrading the
Tanzu Kubernetes release version using the
kubectl edit
command.
Note: You cannot use the
kubectl apply
command to update the TKR version for a deployed cluster.
Prerequisites
This task requires the use of the kubectl edit command. This command opens the cluster manifest in the text editor defined by your KUBE_EDITOR or EDITOR environment variable. When you save the file, the cluster is updated with the changes. To configure an editor for kubectl so you can run the kubectl edit
command, see Configure a Text Editor for Kubectl.
Procedure
- Authenticate with the Supervisor.
kubectl vsphere login --server=IP-ADDRESS --vsphere-username USERNAME
- Switch context to the vSphere Namespace where the target workload cluster is provisioned.
kubectl config use-context SUPERVISOR-NAMESPACE
- Get the target TKG cluster and version.
v1alpha3 cluster:
kubectl get tanzukubernetescluster
v1beta1 cluster:
kubectl get cluster
- List the available TKG releases.
kubectl get tanzukubernetesreleases
- Run the following command to edit the cluster manifest.
v1alpha3 cluster:
kubectl edit tanzukubernetescluster/CLUSTER-NAME
v1beta1 cluster:
kubectl edit cluster/CLUSTER-NAME
- Edit the manifest by updating Tanzu Kubernetes release string.
For example, for a v1alpha3 cluster, change from TKR v1.25.7:
topology:
controlPlane:
replicas: 1
storageClass: vsan-default-storage-policy
tkr:
reference:
name: v1.25.7---vmware.3-fips.1-tkg.1
vmClass: guaranteed-large
nodePools:
- name: worker-tkg-pool01
replicas: 3
storageClass: vsan-default-storage-policy
tkr:
reference:
name: v1.25.7---vmware.3-fips.1-tkg.1
vmClass: guaranteed-large
volumes:
- capacity:
storage: 128Gi
mountPath: /var/lib/containerd
name: containerd
To TKR v1.26.5:
topology:
controlPlane:
replicas: 1
storageClass: vsan-default-storage-policy
tkr:
reference:
name: v1.26.5---vmware.2-fips.1-tkg.1
vmClass: guaranteed-large
nodePools:
- name: worker-tkg-pool01
replicas: 3
storageClass: vsan-default-storage-policy
tkr:
reference:
name: v1.26.5---vmware.2-fips.1-tkg.1
vmClass: guaranteed-large
volumes:
- capacity:
storage: 128Gi
mountPath: /var/lib/containerd
name: containerd
Note: The Control Plane and Worker nodes must have the same TKR version. You can either update all TKr instances or update the Control Plane version and remove the TKR name from Worker nodes.
For example, for a v1beta1 cluster, change from TKR v1.25.7:
apiVersion: cluster.x-k8s.io/v1beta1
...
topology:
class: tanzukubernetescluster
version: v1.25.7---vmware.3-fips.1-tkg.1
controlPlane:
replicas: 3
workers:
...
variables:
...
To TKR v1.26.5:
apiVersion: cluster.x-k8s.io/v1beta1
...
topology:
class: tanzukubernetescluster
version: v1.26.5---vmware.2-fips.1-tkg.1
controlPlane:
replicas: 3
workers:
...
variables:
...
- Save the changes you made to the manifest file.
When you save the file, kubectl applies the changes to the cluster. In the background, the Virtual Machine Service on the Supervisor provisions the new worker node.
- Verify that kubectl reports that the manifest edits were successfully recorded.
kubectl edit tanzukubernetescluster/tkg-cluster-1
tanzukubernetescluster.run.tanzu.vmware.com/tkg-cluster-1 edited
Note: If you receive an error, or kubectl does not report that the cluster manifest was successfully edited, make sure you have properly configured your default text editor using the KUBE_EDITOR environment variable. See
Configure a Text Editor for Kubectl.
- Verify that the cluster is updating.
kubectl get tanzukubernetescluster
NAME CONTROL PLANE WORKER DISTRIBUTION AGE PHASE
tkgs-cluster-1 3 3 v1.26.5---vmware.2-fips.1-tkg.1 21h updating
- Verify that the cluster is updated.
kubectl get tanzukubernetescluster
NAME CONTROL PLANE WORKER DISTRIBUTION AGE PHASE
tkgs-cluster-1 3 3 v1.26.5---vmware.2-fips.1-tkg.1 22h running