You can scale out a Tanzu Kubernetes cluster by increasing the number of worker nodes using kubectl.

Prerequisites

Procedure

  1. Switch to the namespace where the Kubernetes cluster is running.
    kubectl config use-context NAMESPACE
  2. List the Kubernetes clusters that are running in the namespace.
    kubectl get tanzukubernetescluster -n NAMESPACE
    For example:
    kubectl get tanzukubernetescluster -n tkg-cluster-ns
    The command returns the name of the clusters running, the number of control plane VMs, the number of worker nodes, software version, age, and phase. For a description of the status fields, see Tanzu Kubernetes Cluster Lifecycle Status in kubectl.
  3. Get the number of nodes running in the target cluster.
    kubectl get tanzukubernetescluster CLUSTER-NAME
    This example cluster has 3 control plane nodes and 3 worker nodes.
    NAME                CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkg-cluster-01      3               3        v1.18.5+vmware.1-tkg.1.886c781   1d    running
    
  4. To load the cluster manifest for editing, run the command kubectl edit.
    kubectl edit tanzukubernetescluster/CLUSTER-NAME
    For example:
    kubectl edit tanzukubernetescluster/tkg-cluster-01
    The cluster manifest opens in the text editor defined by your KUBE_EDITOR or EDITOR environment variables. When you save the file, kubectl updates the manifest.
  5. Edit the spec.workers.count parameter in the cluster manifest by incrementing or decrementing the worker count depending on if you are increasing or decreasing capacity.
    To scale out a cluster, increase the number of worker nodes, for example, from 3 to 4:
    ...
    workers:
        count: 3
    ...
    
    ...
    workers:
        count: 4
    ...
    
  6. To apply the changes, save the file in the text editor.
    When you save the file, kubectl applies the changes to the cluster. In the background, the Virtual Machine Service on the Supervisor Cluster provisions the new worker node.
  7. To verify that the new node is added, run the following command.
    kubectl get tanzukubernetescluster CLUSTER-NAME
    After scaling out, there are now 4 worker nodes.
    NAME                CONTROL PLANE   WORKER   DISTRIBUTION                     AGE   PHASE
    tkg-cluster-01      3               4        v1.18.5+vmware.1-tkg.1.886c781   1d    running