Introduction

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,

References

https://github.com/kubernetes/autoscaler/pull/3629

https://github.com/apache/cloudstack/pull/4329

https://github.com/apache/cloudstack-primate/pull/733


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

Implementation

Kubernetes Cluster Autoscaler

API


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.