본문 바로가기
cloud/k8s(문제풀이)

[cka]kodekloud-rolling update and rollbacks

by mozi2 2022. 6. 15.
반응형

1.We have deployed a simple web application. Inspect the PODs and the Services

Wait for the application to fully deploy and view the application using the link called Webapp Portal above your terminal.

# alias

 

# k get pods 

 

2.What is the current color of the web application?  Access the Webapp Portal.

A) Blue

3. Run the script named curl-test.sh to send multiple requests to test the web application. Take a note of the output.

Execute the script at /root/curl-test.sh.

 # ls
# ./curl-test.sh

 4. Inspect the deployment and identify the number of PODs deployed by it

A) 4

 5. What container image is used to deploy the applications?

# k get pods
# k describe pod frontend-5c74c57d95-4cjks 

 A) kodekloud/webapp-color:v1

6.Inspect the deployment and identify the current strategy

# k describe deploy frontend

A) RollingUpdate 

 7. If you were to upgrade the application now what would happen?

  : AP 업그레이드시 어떤 일이 발생하는지 

 

 A) PODs are upgraded few at a time

 

 8. Let us try that. Upgrade the application by setting the image on the deployment to 

     kodekloud/webapp-color:v2

Do not delete and re-create the deployment. Only set the new image name for the existing deployment.

  • Deployment Name: frontend

  • Deployment Image: kodekloud/webapp-color:v2

          (전)                                                                                            (후)

 

: deploy 된 항목의 이미지 변경하는 방법 

# k set deploy frontend simple-webapp=kodekloud/webapp-color:v2
 : kubectl set deploy  : deploy 를 정의한다.
 : frontend : deployment name
 : simple-webapp : 컨테이너 이름
 : kodekloud/webapp-color:v2 : 변경할 이미지 

  9.Run the script curl-test.sh again. Notice the requests now hit both the old and newer versions. However none of them fail. Execute the script at /root/curl-test.sh.

 # ls
# ./curl-test.sh

 10. Up to how many PODs can be down for upgrade at a time.

    Consider the current strategy settings and number of PODs - 4

 # k describe deploy frontend

 :   Replicas 에 총 4개를 사용할 수 있는데 RollingUpdateStrategy 가 25% 이다.

 :  이 의미는 rolling update 중 정해진 pod수 이상으로 만들 수 있는 pod의 최대 개수. 그리고 기본값은 25% 이다.

 : 따라서, 25% 1개 ~50% 2개 75% 3개 100% 4개 

 

 A) 1

 

11.Change the deployment strategy to Recreate

Delete and re-create the deployment if necessary. Only update the strategy type for the existing deployment.

  • Deployment Name: frontend

  • Deployment Image: kodekloud/webapp-color:v2

  • Strategy: Recreate

   : strategy 는 type을 말하는 부분이고, 타입을 Recreate 로 변경해기 때문에 그 이전의 25% 는  제외해도 된다. 

 # k edit deploy frontend

12. Upgrade the application by setting the image on the deployment to kodekloud/webapp-color:v3

Do not delete and re-create the deployment. Only set the new image name for the existing deployment.

CheckCompleteIncomplete
 
  • Deployment Name: frontend

  • Deployment Image: kodekloud/webapp-color:v3
# k set image deploy frontend simple-webapp=kodekloud/webapp-color:v3

13.Run the script curl-test.sh again. Notice the failures. Wait for the new application to be ready. Notice that the requests now do not hit both the versions

Execute the script at /root/curl-test.sh.

# ls
# ./curl-test.sh

 

 

728x90
반응형