/
6. How to configure HI GIO Kunernetes cluster autoscale

6. How to configure HI GIO Kunernetes cluster autoscale

Overview

Step-by-step guide on how to configure HI GIO Kubernetes cluster autoscale

  • Install tanzu-cli

  • Create cluster-autoscaler deployment from tanzu package using tanzu-cli

  • Enable cluster autoscale for your cluster

  • Test cluster autoscale

  • Delete cluster-autoscaler deployment and clean up test resource

 

Procedure

  1. Pre-requisites:
  • Ubuntu bastion can connect to your Kubernetes cluster

  • Permission for access to your Kubernetes cluster

 

  1. Procedure:
  1. Install tanzu-cli

    #Install tanzu-cli to ubuntu sudo apt update sudo apt install -y ca-certificates curl gpg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://storage.googleapis.com/tanzu-cli-installer-packages/keys/TANZU-PACKAGING-GPG-RSA-KEY.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/tanzu-archive-keyring.gpg echo "deb [signed-by=/etc/apt/keyrings/tanzu-archive-keyring.gpg] https://storage.googleapis.com/tanzu-cli-installer-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list sudo apt update sudo apt install -y tanzu-cli #Verify tanzu-cli installation tanzu version
    image-20241223-082306.png

To install tanzu-cli in other environments, please refer to the documentation below:

https://techdocs.broadcom.com/us/en/vmware-tanzu/cli/tanzu-cli/1-5/cli/index.html

 

  1. Create cluster-autoscaler deployment from tanzu package using tanzu-cli

  • Switched to your Kubernetes context

    kubectl config use-context <your context name>
    image-20241223-083216.png
  • List available cluster-autoscaler in tanzu package and note the version name

    tanzu package available list cluster-autoscaler.tanzu.vmware.com
  • Create kubeconfig secret name cluster-autoscaler-mgmt-config-secret in cluster kube-system namespace

  • Create cluster-autoscaler-values.yaml file

  • Install cluster-autoscaler

  • Configure the minimum and maximum number of nodes in your cluster

    • Get machinedeployments name and namespace

    • Set cluster-api-autoscaler-node-group-min-size and cluster-api-autoscaler-node-group-max-size

       

  • Enable cluster autoscale for your cluster

 

  1. Test cluster autoscale

  • Get the current number of nodes

  • Create test-autoscale.yaml file

  • Apply test-autoscale.yaml file to deploy 2 replicas of nginx pod in the default namespace (it will trigger to create a new worker node)

  • Get nginx deployment

  • Waiting for a new node to be provisioned, then you can see a new worker node has been provisioned and new nginx pod status is running

  • Clean up test resource

  • Delete cluster-autoscaler deployment (Optional)

End.

Related pages