MLOps/Doker & Kubernetes

Udemy CKA 강의 정리 34: Solution - Deployments (Optional)

공부하는 무니 2023. 1. 5. 05:11
반응형

해당 내용은 Udemy의 Certified Kubernetes Administrator (CKA) with Practice Tests  강의를 공부한 내용입니다. 내용을 그대로 번역하기보다는, 제가 이해하기 쉬운 대로 수정한 부분들이 있습니다.

⚠️ 영어 독해가 많이 부족합니다. 틀린 내용이 있으면 알려주시면 감사하겠습니다.


Q1. How many PODs exist on the system? In the current(default) namespace.

답: 0

Q2. How many ReplicaSets exist on the system? In the current(default) namespace.

답: 0

Q3. How many Deployments exist on the system?

답: 0

Q4. How many Deployments exist on the system now?

답: 1

Q5. How many ReplicaSets exist on the system now?

 NAME을 보면 방금 생성된 Deployments가 자동으로 생성한 ReplicaSet이라는 것을 확인할 수 있습니다.

답: 1

Q6. How many PODs exist on the system now?

kubectl get pods커맨드를 입력했을 때 나오는 결과에서 확인할 수 있습니다.

여기에서 확인하고 싶은 것은 deployment가 replicaset을 만들고, replicaset이 pods를 만들었다는 것입니다.

답: 4

Q7. Out of all the existing PODs, how many are ready?

답: 0

Q8. What is the image used to create the pods in the new deployment?

kubectl describe pod 파드이름커맨드를 통해 확인할 수 있습니다.

답: BUSYBOX888

Q9. Why do you think the deployment is not ready?

kubectl describe pod 파드이름커맨드의 Events:에서 에러 메세지를 확인할 수 있습니다.

답: The image BUSYBOX888 doesn’t exist

Q10. Create a new Deployment using the deployment-definition-1.yamlfile located at /root/. There is an issue with the file, so try to fix it.

kubectl create -f yaml파일 커맨드로 deployment을 만들 수 있습니다.

그런데 에러가 났네요. apiVersion 이나 kind가 잘못 들어간 것 같습니다.

따라서 yaml 파일을 수정해야 합니다.

vi deployment-definiton-1.yaml

kind에 deployment를 Deployement로 바꿔줍니다.

수정 후, 다시 deployment 생성 커맨드를 실행합니다.

Q11. Create a new Deployment with the below attributes using your own deployment definition file. Name: httpd-frontend; Replicas: 3; Image: httpd:2.4-alpine

아래 명령어로 생성할 수 있습니다.

kubectl create deployment httpd-frontend --replicas=3 --image=httpd:2.4-alpine 

헷갈릴 때는 kubectl create deployment --help 커맨드로 필요한 옵션을 확인할 수 있습니다.

반응형