autoscaler/cluster-autoscaler/cloudprovider/cloudstack
davidjumani 97b0d60a4e
Fix tests
2022-03-21 16:28:05 +05:30
..
examples Update image for cloudstack cluster-autoscaler 2021-09-15 11:57:54 +05:30
service Refactor code 2022-03-21 16:07:22 +05:30
testdata Adding support for Apache CloudStack cloudprovider 2020-11-11 10:24:47 +05:30
OWNERS Adding support for Apache CloudStack cloudprovider 2020-11-11 10:24:47 +05:30
README.md Adding support for Apache CloudStack cloudprovider 2020-11-11 10:24:47 +05:30
cloudstack_cloud_provider.go Adding support for Apache CloudStack cloudprovider 2020-11-11 10:24:47 +05:30
cloudstack_cloud_provider_test.go Fix tests 2022-03-21 16:28:05 +05:30
cloudstack_manager.go Refactor code 2022-03-21 16:07:22 +05:30
cloudstack_manager_test.go Fix tests 2022-03-21 16:28:05 +05:30
cloudstack_node_group.go Refactor code 2022-03-21 16:07:22 +05:30
cloudstack_node_group_test.go Fix tests 2022-03-21 16:28:05 +05:30
cloudstack_option.go Adding support for Apache CloudStack cloudprovider 2020-11-11 10:24:47 +05:30

README.md

Cluster Autoscaler on CloudStack

The cluster autoscaler on CloudStack scales worker nodes within any specified cluster. It runs as a Deployment in your cluster. This README will go over some of the necessary steps required to get the cluster autoscaler up and running.

Requirements

Cluster Autoscaler requires Apache CloudStack 4.16 onward as well as Kubernetes v1.16.0 or greater.

Deployment

The CloudStack kubernetes cluster can be autoscaled via the scaleKubernetesCluster by passing autoscalingenabled=true along with the minsize and maxsize parameters API from 4.16 onwards. eg:

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

Autoscaling on the cluster can be disabled by passing autoscalingenabled=false. This will delete the deployment and leave the cluster at its current size. eg:

scaleKubernetesCluster id=<cluster-id> autoscalingenabled=false

To manually deploy the cluster autoscaler, please follow the guide below :

To configure API access to your CloudStack management server, you need to create a secret containing a cloud-config that is suitable for your environment.

cloud-config should look like this:

[Global]
api-url = <CloudStack API URL>
api-key = <CloudStack API Key>
secret-key = <CloudStack API Secret>

The access token needs to be able to execute the listKubernetesClusters and scaleKubernetesCluster APIs.

To create the secret, use the following command:

kubectl -n kube-system create secret generic cloudstack-secret --from-file=cloud-config

Finally, to deploy the autoscaler, modify the cluster-autoscaler-standard.yaml with the cluster id, minsize and maxsize located here and execute it

kubectl apply -f cluster-autoscaler-standard.yaml

Common Notes and Gotchas:

  • The automated deployment of the autoscaler will run with the defaults configured here. To change it, alter the file and deploy it again.
  • By default, cluster autoscaler will not terminate nodes running pods in the kube-system namespace. You can override this default behaviour by passing in the --skip-nodes-with-system-pods=false flag.
  • By default, cluster autoscaler will wait 10 minutes between scale down operations, you can adjust this using the --scale-down-delay flag. E.g. --scale-down-delay=5m to decrease the scale down delay to 5 minutes.