TKG 1.4 on Azure – Part 5 : Scaling operations

Reading Time: 2 mins

Scale management clusters:

If you have deployed a development management cluster, like I did while creating i.e., with 1 control and worker nodes. You can scale the management clusters to production cluster type anytime using simple commands. In this post, I have covered manual scaling, but there is also auto scaling feature available in TKG on Azure which I will covering in other post.

Similar way, scaling down is also possible for both management and workload clusters.

Before Scaling: 

reddye@reddye-a02 ~ % tanzu management-cluster get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
capv-mgmt tkg-system running 1/1 1/1 v1.21.2+vmware.1 management


Details:

NAME READY SEVERITY REASON SINCE MESSAGE
/capv-mgmt True 3m9s
├─ClusterInfrastructure - AzureCluster/capv-mgmt True 3m13s
├─ControlPlane - KubeadmControlPlane/capv-mgmt-control-plane True 3m9s
│ └─Machine/capv-mgmt-control-plane-lvglk True 3m12s
└─Workers
└─MachineDeployment/capv-mgmt-md-0
└─Machine/capv-mgmt-md-0-57db8c6b48-9t5s2 True 3m12s


Providers:

NAMESPACE NAME TYPE PROVIDERNAME VERSION WATCHNAMESPACE
capi-kubeadm-bootstrap-system bootstrap-kubeadm BootstrapProvider kubeadm v0.3.23
capi-kubeadm-control-plane-system control-plane-kubeadm ControlPlaneProvider kubeadm v0.3.23
capi-system cluster-api CoreProvider cluster-api v0.3.23
capz-system infrastructure-azure InfrastructureProvider azure v0.4.15

#Management cluster scaling syntax

tanzu cluster scale {management_cluster_name} --controlplane-machine-count {number} --worker-machine-count {number}

reddye@reddye-a02 scripts % tanzu cluster scale capv-mgmt --controlplane-machine-count 3 --worker-machine-count 3
Successfully updated control plane replica count for cluster capv-mgmt
Successfully updated worker node machine deployment replica count for cluster capv-mgmt
Workload cluster 'capv-mgmt' is being scaled

reddye@reddye-a02 scripts % tanzu mc get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
capv-mgmt tkg-system updating 1/3 3/3 v1.21.2+vmware.1 management

After Scaling: 

reddye@reddye-a02 scripts % tanzu mc get
NAME NAMESPACE STATUS CONTROLPLANE WORKERS KUBERNETES ROLES
capv-mgmt tkg-system running 3/3 3/3 v1.21.2+vmware.1 management


Details:

NAME READY SEVERITY REASON SINCE MESSAGE
/capv-mgmt True 99s
├─ClusterInfrastructure - AzureCluster/capv-mgmt True 46h
├─ControlPlane - KubeadmControlPlane/capv-mgmt-control-plane True 99s
│ └─3 Machines... True 3m42s See capv-mgmt-control-plane-7v5cw, capv-mgmt-control-plane-htg2d, ...
└─Workers
└─MachineDeployment/capv-mgmt-md-0
└─3 Machines... True 46h See capv-mgmt-md-0-57db8c6b48-9pms4, capv-mgmt-md-0-57db8c6b48-9t5s2, ...


Providers:

NAMESPACE NAME TYPE PROVIDERNAME VERSION WATCHNAMESPACE
capi-kubeadm-bootstrap-system bootstrap-kubeadm BootstrapProvider kubeadm v0.3.23
capi-kubeadm-control-plane-system control-plane-kubeadm ControlPlaneProvider kubeadm v0.3.23
capi-system cluster-api CoreProvider cluster-api v0.3.23
capz-system infrastructure-azure InfrastructureProvider azure v0.4.15

Scale Down: 

reddye@reddye-a02 scripts % tanzu cluster scale capv-mgmt --controlplane-machine-count 1 --worker-machine-count 1
Successfully updated control plane replica count for cluster capv-mgmt
Successfully updated worker node machine deployment replica count for cluster capv-mgmt
Workload cluster 'capv-mgmt' is being scaled

Scale workload clusters:

#Get the credentials for workload cluster: capv-workload

reddye@reddye-a02 scripts % tanzu cluster kubeconfig get capv-workload --admin
Credentials of cluster 'capv-workload' have been saved
You can now access the cluster by running 'kubectl config use-context capv-workload-admin@capv-workload'

# Show contexts and below output shows the current context as capv-workload-admin
reddye@reddye-a02 scripts % kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
capv-mgmt-admin@capv-mgmt capv-mgmt capv-mgmt-admin
* capv-workload-admin@capv-workload capv-workload capv-workload-admin

Before scaling: 

reddye@reddye-a02 scripts % kubectl get nodes
NAME STATUS ROLES AGE VERSION
capv-workload-control-plane-4p2qw Ready control-plane,master 28h v1.21.2+vmware.1
capv-workload-md-0-8s8pb Ready <none> 28h v1.21.2+vmware.1
reddye@reddye-a02 scripts % tanzu cluster scale capv-workload -w 2
Successfully updated worker node machine deployment replica count for cluster capv-workload
Workload cluster 'capv-workload' is being scaled
  • Back in Azure portal, you can see the vm creation in progress.

After Scaling:

reddye@reddye-a02 scripts % kubectl get nodes
NAME STATUS ROLES AGE VERSION
capv-workload-control-plane-4p2qw Ready control-plane,master 29h v1.21.2+vmware.1
capv-workload-md-0-8s8pb Ready <none> 29h v1.21.2+vmware.1
capv-workload-md-0-jn7fn Ready <none> 5m47s v1.21.2+vmware.1