Scaling Worker Nodes in a TKG Management Cluster

Source -> VMware Doc

By default when we provision a TKG management cluster, it creates only one worker node and we might need to scale the number of worker node for different purposes. It was bit of troubles finding this and i thought to make it simple for you.

Steps to scale worker nodes in a TKG management cluster

First, access the management cluster and list it.

$ tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
tkg-cluster-mgmt tkg-system running 3/3 1/1 v1.20.5+vmware.1 management

It tells that there is 3 master nodes and only one worker node. Now, lets scale.

Note: There is no scale option directly with tanzu management-cluster flag in tanzu command and i figured out this needs to be done via tanzu cluster command.

Run the below command with desired number of worker nodes. e.g. i am scaling to 3

$ tanzu cluster scale tkg-cluster-mgmt -w 3Successfully updated worker node machine deployment replica count for cluster tkg-cluster-mgmtWorkload cluster 'tkg-cluster-mgmt' is being scaled

Check the scaling status

$ tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
tkg-cluster-mgmt tkg-system updating 3/3 1/3 v1.20.5+vmware.1 management
Details:NAME READY SEVERITY REASON SINCE MESSAGE
/tkg-cluster-mgmt True 24d
├─ClusterInfrastructure - VSphereCluster/tkg-cluster-mgmt True 24d
├─ControlPlane - KubeadmControlPlane/tkg-cluster-mgmt-control-plane True 24d
│ └─3 Machines... True 24d See tkg-cluster-mgmt-control-plane-d4lhr, tkg-cluster-mgmt-control-plane-mfwv6, ...
└─Workers
└─MachineDeployment/tkg-cluster-mgmt-md-0
├─2 Machines... False Info PoweringOn 9s See tkg-cluster-mgmt-md-0-568bc754b5-clwpm, tkg-cluster-mgmt-md-0-568bc754b5-fv249
└─Machine/tkg-cluster-mgmt-md-0-568bc754b5-dpk5x True 24d
Providers:NAMESPACE NAME TYPE PROVIDERNAME VERSION WATCHNAMESPACE
capi-kubeadm-bootstrap-system bootstrap-kubeadm BootstrapProvider kubeadm v0.3.14
capi-kubeadm-control-plane-system control-plane-kubeadm ControlPlaneProvider kubeadm v0.3.14
capi-system cluster-api CoreProvider cluster-api v0.3.14
capv-system infrastructure-vsphere InfrastructureProvider vsphere v0.7.7

Now, after few mins, run the below command again and you will notice that change in number of worker nodes.

$ tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
tkg-cluster-mgmt tkg-system running 3/3 3/3 v1.20.5+vmware.1 management

That’s all. So simple and quick. Thanks to Cluster API.

To get more stories like this, Follow me on Twitter or LinkedIn.

Twitter: https://twitter.com/dinesh30

LinkedIn: https://www.linkedin.com/in/dineshtripathi30/

--

--

Dinesh Tripathi- blogging at mappslearning.com

Learn VMware Tanzu Portfolio and Application Modernization using Tanzu quickly and easily.