How can Kubernete auto scale nodes?

5/21/2019

I am using kubernete to manage docker cluster. Right now, I can set up POD autoscale using Horizontal Pod Scaler, that is fine. And now I think the next step is to autoscale nodes. I think for HPA, the auto-created pod is only started in the already created nodes, but if all the available nodes are utilized and no available resource for any more pods, I think the next step is to automatically create node and have node join the k8s master. I googled a lot and there are very limited resources to introduce this topic. Can anyone please point me to any resource how to implement this requirement. Thanks

-- user3006967
kubernetes

3 Answers

5/21/2019

kubernetes operations (kops) helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes clusters from the command line.

Features:

  • Automates the provisioning of Kubernetes clusters in AWS and GCE
  • Deploys Highly Available (HA) Kubernetes Masters

Most of the managed kubernetes service providers provide auto scaling feature of the nodes

Elastic Kubernetes Service EKS- configure cluster auto scalar

Google Kubernetes Engine GKE Auto Scalar

-- Barath
Source: StackOverflow

5/21/2019

Auto scaling feature needs to be supported by the underlying cloud provider. Google cloud supports auto scaling during cluster creation or update by passing flags --enable-autoscaling --min-nodes and --max-nodes to the corresponding gcloud commands.

Examples:

gcloud container clusters create mytestcluster --zone=us-central1-b --enable-autoscaling --min-nodes=3 --max-nodes=10 --num-nodes=5
gcloud container clusters update mytestcluster --enable-autoscaling --min-nodes=1 --max-nodes=15

below link would be helpful

https://medium.com/kubecost/understanding-kubernetes-cluster-autoscaling-675099a1db92

-- P Ekambaram
Source: StackOverflow

5/21/2019

One way to do using AWS and setting up your own Kubernetes cluster is by following these steps :

  1. Create an Instance greater than t2.micro (will be master node).
  2. Initialize the Kubernetes cluster using some tools like Kubeadm. After the initialisation would be completed you would get a join command, which needs to e run on all the nodes who want to join the cluster. (Here is the link)

  3. Now create an Autoscaling Group on AWS with start/boot script containing that join command.

  4. Now whenever the utilisation specified by you in autoscaling group is breached the scaling would happen and the node(s) would automatically join the Kubernetes cluster. This would allow the Kubernetes to schedule pods on the newly joined nodes based on the HPA.

(I would suggest to use Flannel as pod network as it automatically removes the node from Kubernetes cluster when it is not available)

-- Anshul Jindal
Source: StackOverflow