Does Kubernetes support auto-scaling now?

3/18/2015

Can Kubernetes automatically add or reduce the number of pods,when it monitors for increases or decreases in load (i.e. CPU load, traffic)?

If it's possible, how can I configure it?

-- kanchuanqi
kubernetes

3 Answers

11/1/2017

Yes Kubernetes support auto-scaling of pods base on limit set i.e. CPU or Memory imagePullPolicy: Always resources: limits: memory: "1Gi" cpu: "256m" requests: memory: "64Mi" cpu: "60m"

kubectl autoscale deployment nginx --cpu-percent=80 --min=5 --max=10 To view kubectl get hpa

NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE nginx Deployment/nginx 0% / 50% 5 10 5 1d

-- sakkela
Source: StackOverflow

1/30/2019

Yes,new versions of kubernetes support auto-scaling.It was added to K8 as horizontal pod scaling.Find out more on https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/

In order to use auto-scaling

kubectl autoscale deployment deployment_name --cpu-percent=10 --min=2 --max=5

--cpu-percent to denote the limit up to which scaling will not be performed .
--min denote minimum number of pods.
--max denote maximum number of pods.

run

kubectl get hpa

observe the result . TARGETS column shows the current-cpu%/cpu-percent-mentioned-during-autoscale For this scenario it is 10 . Kubernetes automatically create new pods as load increases. to check this go to this link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/ . after running busybox execute

kubectl get pods 

to check the no of pods.

-- shubham_asati
Source: StackOverflow

3/18/2015

Auto scaling of pods is not yet available, but it's definitely on our roadmap, as mentioned by Brendan in a previous answer.

It could actually be easily built outside of the core of Kubernetes, using the public Kubernetes API. If you'd rather wait for someone else to build it, though, it looks like a contributor has started planning a design for one.

-- Alex Robinson
Source: StackOverflow