Home Explore Blog CI



kubernetes

4th chunk of `content/en/blog/_posts/2016-07-00-Autoscaling-In-Kubernetes.md`
1635cd1167a1f23a0e6394cf3db86a7cd67cff8af7e87e5c00000001000008d8
  FirstSeen From SubobjectPath Type Reason Message



  1m {default-scheduler } Warning FailedScheduling pod (php-apache-2046965998-3ewo6) failed to fit in any node

fit failure on node (kubernetes-minion-group-yhdx): Insufficient CPU

fit failure on node (kubernetes-minion-group-de5q): Insufficient CPU



  1m {cluster-autoscaler } Normal TriggeredScaleUp pod triggered scale-up, mig: kubernetes-minion-group, sizes (current/new): 2/3
 ```



The pod is pending as there was no CPU in the system for it. We see there’s a TriggeredScaleUp event connected with the pod. It means that the pod triggered reaction of Cluster Autoscaler and a new node will be added to the cluster. Now we’ll wait for the reaction (about 3 minutes) and list all nodes:





```
$ kubectl get nodes

NAME                           STATUS                     AGE

kubernetes-master              Ready,SchedulingDisabled   9m

kubernetes-minion-group-6z5i   Ready                      43s

kubernetes-minion-group-de5q   Ready                      9m

kubernetes-minion-group-yhdx   Ready                      9m
 ```



As we see a new node kubernetes-minion-group-6z5i was added by Cluster Autoscaler. Let’s verify that all pods are now running:




```
$ kubectl get pods

NAME                               READY     STATUS    RESTARTS   AGE

php-apache-2046965998-3ewo6        1/1       Running   0          3m

php-apache-2046965998-8m03k        1/1       Running   0          3m

php-apache-2046965998-ddpgp        1/1       Running   0          7m

php-apache-2046965998-lrik6        1/1       Running   0          3m

php-apache-2046965998-nj465        1/1       Running   0          3m

php-apache-2046965998-tmwg1        1/1       Running   0          3m

php-apache-2046965998-xkbw1        1/1       Running   0          3m
 ```



After the node addition all php-apache pods are running!



#### Stop Load


We will finish our example by stopping the user load. We’ll terminate both infinite while loops sending requests to the server and verify the result state:




```
$ kubectl get hpa

NAME         REFERENCE                     TARGET    CURRENT   MINPODS   MAXPODS   AGE

php-apache   Deployment/php-apache/scale   50%       0%        1         10        16m

Title: Cluster Autoscaler Response and Load Reduction
Summary
This section details the Cluster Autoscaler's response to pending pods caused by CPU insufficiency. It confirms the addition of a new node, kubernetes-minion-group-6z5i, and verifies that all PHP-Apache pods are now running. The process concludes by stopping the simulated user load, terminating the infinite request loops, and checking the final state of the Horizontal Pod Autoscaler (HPA) after the load reduction.