IT 강의/도커 쿠버

[CKA 강의 요약] Practice Test - Deployments, Solution - Deployments (Optional)

rnany 2024. 6. 19. 20:16

Udemy의 Certified Kubernetes Administrator (CKA) with Practice Tests  강의의 34. Practice Test - Deployments, 34. Solution - Deployments (Optional)  챕터를 공부한 내용으로 강의 내용과 다를 수 있습니다. 정확한 내용은 강의를 들으시는 것을 추천드립니다.


https://uklabs.kodekloud.com/topic/practice-tests-deployments-2/에서 핸즈온을 사용 할 수 있다.


Q1. How many PODs exist on the system?

In the current(default) namespace.

A. kubectl get pod



Q2. How many ReplicaSets exist on the system?

In the current(default) namespace.

A. kubectl get replicasets



Q3. How many Deployments exist on the system?

A. kubectl get Deployments



Q4. How many Deployments exist on the system now? 
We just created a Deployment! Check again!

A. kubectl get Deployments



Q5. How many ReplicaSets exist on the system now?
A. kubectl get all


Q6. How many PODs exist on the system now?
A. kubectl get all


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


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

A. kubectl describe pods



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

A. 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.

A. 하단과 같이 yaml 파일 수정 후 "kubectl create -f deployment-definition-1.yaml"  명령어 입렵

vim deployment-definition-1.yaml
...
kind: 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

A. 하단 명령어를 사용하여 생성 가능하다.

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

명령어가 기억나지 않으면 하단 명령어로 옵션 확인이 가능하다.

$ kubectl create deployment --help

 

or

$ vim deployment-definition-httpd.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpd-frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      name: httpd-frontend
  template:
    metadata:
      labels:
        name: httpd-frontend
    spec:
      containers:
      - name: httpd-frontend
        image: httpd:2.4-alpine
        
        
$ kubectl create -f deployment-definition-httpd.yaml