Adding support for CloudStack as a cloud provider in the Kubernetes cluster-autoscaler. This will allow Kubernetes itself to scale up / down the cluster based on capacity requirements since external autoscaling is discouraged

It will provide the following features,

  • An interface for Kubernetes cluster-autoscaler to communicate with CloudStack
  • Scale up the cluster, if pods can not be scheduled - up to the maximum configured cluster size

  • Scale down the cluster, if nodes can be removed - down to the minimum configured cluster size


Use Cases

Dynamically scale the cluster size based on capacity requirements without user intervention

Feature Specification

As per Kubernetes documentation, 'external' autoscaling using CPU usage metrics is strongly advised against for a number of technical reasons; instead, it is recommended that Kubernetes it's be allowed to make these scaling decision

This feature adds CloudStack to the list of cloud providers in the Kubernetes cluster-autoscaler. It provides an interface by which Kubernetes can communicate with CloudStack to change the size of the cluster

This will run as a `cluster-autoscaler` service on the Kubernetes cluster consisting of one pod which determines the capacity needs of the cluster


Kubernetes Cluster Autoscaler

  • cloudstack_cloudprovider : Consists of the configuration and methods required to communicate with CloudStack
  • cloudstack_node_group : Consists of the configurations and methods to control the CKS Cluster
  • cloudstack_manager : The control plane that connects Kubernetes with CloudStack and manages the CKS Cluster
  • cloudstack/service : A library to communicate with CloudStack


  • scaleKubernetesCluster

    New Parameters

    autoscalingenabled = (bool) Indicates whether autoscaling is enabled on the cluster
    maxsize = (integer) The maximum size to which the cluster can grow
    minsize = (integer) The minimum size of the cluster
    nodeids = ([]uuid) List of nodes to be removed from the cluster

Example :

scaleKubernetesCluster id=<cluster-id> autoscalingenabled=true minsize=<minsize> maxsize=<maxsize>

scaleKubernetesCluster id=<cluster-id> autoscalingenabled=false

Limitations :

Autoscaling is only supported for CloudStack version 4.16 onward and Kubernetes cluster versions 1.16.0 onward.

  • No labels