When scale in worker node of vSphere with Tanzu guest cluster (TKC), worker nodes will be deleted randomly. The article is to provide solution how to delete specific worker node.
VMware vSphere with Tanzu
Important Note: Newer versions of VKS utilize the standard upstream Cluster API (cluster object), while older versions use the deprecated TanzuKubernetesCluster (tkc object) API. The steps below apply to both, but you must use the correct object type and YAML path for your specific cluster version when editing.
Follow the steps to delete specific worker node when scale in:
ubectl get machine -n <namespace>kubectl annotate machine -n <namespace> <worker-machine-name-to-delete> "cluster.x-k8s.io/delete-machine"="yes"cluster / tkc Objectcluster for modern VKS clusters, or tkc for legacy clusters):kubectl edit cluster -n <namespace> <cluster-name>kubectl edit tkc -n <namespace> <tkc-name>workers:
machineDeployments:
- class: node-pool
metadata:
annotations:
run.tanzu.vmware.com/resolve-os-image: os-name=photon
name: kubernetes-cluster-#####-#######
replicas: 3 # <-- Decrease this number