AWS Cloud

[Cloud] Using Amazon EKS Auto scaling

트리스탄1234 2023. 5. 18. 06:23
728x90
반응형

 

 

In this post, I will post about how to increase or decrease pods previously deployed by using auto-scaling.

  1. Use the command below to check the status and quantity of currently deployed Pods.
sh-4.2$ kubectl get pods -n default
NAME READY STATUS RESTARTS AGE
ecsdemo-crystal-69bd6dbf88-wjbmc 1/1 Running 0 39m
ecsdemo-frontend-5744c78747-6h676 1/1 Running 0 34m
ecsdemo-nodejs-6f79d847d9-xlsd8 1/1 Running 0 52m

As you can see above, you can see that 3 Pods are deployed in 1/1 in the READY part. This means that one is required and one is running.

2. Let's use the command below to increase the value of nodejs and crystal deployment's replcas to see the number of pods.

sh-4.2$ kubectl scale deployment ecsdemo-nodejs --replicas=3
deployment.apps/ecsdemo-nodejs scaled
sh-4.2$
sh-4.2$ kubectl scale deployment ecsdemo-crystal --replicas=3
deployment.apps/ecsdemo-crystal scaled

 

3. Let's check how the number of pods changes using the command below.

sh-4.2$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
ecsdemo-crystal 3/3 3 3 45m
ecsdemo-frontend 1/1 1 1 41m
ecsdemo-nodejs 3/3 3 3 58m
sh-4.2$ kubectl get pods -n default
NAME READY STATUS RESTARTS AGE
ecsdemo-crystal-69bd6dbf88-8t8rh 1/1 Running 0 96s
ecsdemo-crystal-69bd6dbf88-qpxsq 1/1 Running 0 96s
ecsdemo-crystal-69bd6dbf88-wjbmc 1/1 Running 0 43m
ecsdemo-frontend-5744c78747-6h676 1/1 Running 0 38m
ecsdemo-nodejs-6f79d847d9-7clzq 1/1 Running 0 97s
ecsdemo-nodejs-6f79d847d9-qg8gg 1/1 Running 0 97s
ecsdemo-nodejs-6f79d847d9-xlsd8 1/1 Running 0 56m
반응형

As shown in the log above, you can see that the number of crystal pods has increased to 3, and nodejs pods to 3. ​

 

4. Now let's increase the number of pods on the front end to three using auto scaling.

sh-4.2$ kubectl scale deployment ecsdemo-frontend --replicas=3
deployment.apps/ecsdemo-frontend scaled

 

5. Now, let's check the increased number of pods using the command below..

sh-4.2$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
ecsdemo-crystal 3/3 3 3 48m
ecsdemo-frontend 3/3 3 3 43m
ecsdemo-nodejs 3/3 3 3 61m

h-4.2$ kubectl get pod -n default
NAME READY STATUS RESTARTS AGE
ecsdemo-crystal-69bd6dbf88-8t8rh 1/1 Running 0 6m48s
ecsdemo-crystal-69bd6dbf88-qpxsq 1/1 Running 0 6m48s
ecsdemo-crystal-69bd6dbf88-wjbmc 1/1 Running 0 48m
ecsdemo-frontend-5744c78747-6h676 1/1 Running 0 44m
ecsdemo-frontend-5744c78747-cvdgl 1/1 Running 0 87s
ecsdemo-frontend-5744c78747-zdl6h 1/1 Running 0 87s
ecsdemo-nodejs-6f79d847d9-7clzq 1/1 Running 0 6m49s
ecsdemo-nodejs-6f79d847d9-qg8gg 1/1 Running 0 6m49s
ecsdemo-nodejs-6f79d847d9-xlsd8 1/1 Running 0 61m

 

As you can see in the log above, the frontend deployment now has 3 Pods as well.

In this way, you can increase or decrease Pods by using the --replicas option of the scale command. So, I hope this helps you today.

"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."

 

728x90
반응형