본문 바로가기
네트워크

CKA Udemy Pratice Exam

by Lauren X Ming 2023. 4. 23.
  1. How many pods exist on the system?
    kubectl get pods --namespace=default

  2. Create a new pod with the nginx image.
    kubectl run pod --image=nginx

  3. What is the image used to create the new pods?(You must look at one of the new pods in detail to figure this out.)
    kubectl get pods -o wide kubectl describe pod newpods

  4. Which nodes are these pods placed on?(You must look at all the pods in detail to figure this out.)
    kubectl get pods -o wide

  5. How many containers are part of the pod webapp?
    kubectl get pod webapp

  6. What is the state of the container agentx in the pod webapp?
    kubectl get pod webapp -> 이 정보로 찾으면 됨

  7. Why do you think the container agentx in pod webapp is in error?(Try to figure it out from the events section of the pod.)
    kubectl get pod webapp

  8. Delete the webapp Pod.
    kubectl delete pod webapp

  9. Create a new pod with the name redis and with the image redis123.Use a pod-definition YAML file. And yes the image name is wrong!

  10. kubectl run redis --image=redis123 --dry-run=client -o yaml > redis.yaml kubectl apply -f ./redis.yaml

  11. Now change the image on this pod to redis.(Once done, the pod should be in a running state.)

kubectl edit pod redis

image : redis123 -> redis로 변경


  1. How many ReplicaSets exist on the system?
    kubectl get replicasets
  2. How about now? How many ReplicaSets do you see?
    kubectl get replicasets
  3. How many PODs are DESIRED in the new-replica-set?
    kubectl get replicasets
  4. replicaset image
    kubectl describe replicasets new-replica-set 
  5. How many PODs are READY in the new-replica-set?
    ~
    kubectl get replicasets

-> READY 0

6. Delete any one of the 4 PODs.

kubectl get pods
-> 현재 error 상태
kubectl delete pod new-replica-set-
-> pod을 하나씩 삭제하기에는 replica 설정되어있어서 계속 무한 생성됨. 그래서 replicatset을 삭제해야함
kubectl delete replicasets.apps new-replica-set

7. How many PODs exist now?

kubectl get pods --all-namespaces

-> **all namespace**
8. Fix the original replica set new-replica-set to use the correct busybox image. Either delete and recreate the ReplicaSet or Update the existing ReplicaSet and then delete all PODs, so new ones with the correct image will be created.

kubectl edit replicasets new-replica-set
-> edit 했어도 기존에 pod가 존재하기 때문에 기존 pod들은 error 상태임
kubectl get pods
kubectl delete pods new-replica-set-szcm7
-> 하나씩 총 4개 삭제 해줘야 함
~