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

[cka] kodekloud-commands and Arguments

by mozi2 2022. 6. 15.
반응형

1.How many PODs exist on the system?

in the current(default) namespace

# k get pods

A) 1

 

2. What is the command used to run the pod ubuntu-sleeper?

# k describe pods ubuntu-sleeper

A) sleep 4800

 

3.Create a pod with the ubuntu image to run a container to sleep for 5000 seconds. Modify the file ubuntu-sleeper-2.yaml. Note: Only make the necessary changes. Do not modify the name.

  • Pod Name: ubuntu-sleeper-2

  • Command: sleep 5000
# vi ubuntu-sleepler-2.yaml
# k apply -f ubuntu-sleeper-2.yaml

4. Create a pod using the file named ubuntu-sleeper-3.yaml. There is something wrong with it. Try to fix it! Note: Only make the necessary changes. Do not modify the name.

#  k apply -f ubuntu-sleeper-3.yaml 
# vi ubuntu-sleeper-3.yaml 

                        (전)                                                                                           (후)

5.Update pod ubuntu-sleeper-3 to sleep for 2000 seconds.

Note: Only make the necessary changes. Do not modify the name of the pod. Delete and recreate the pod if necessary.

  • Pod Name: ubuntu-sleeper-3

  • Command: sleep 2000
# k delete pod ubuntu-sleepoer-3
# vi ubuntu-sleepoer-3
# k apply -f ubuntu-sleepoer-3.yaml

6. Inspect the file Dockerfile given at /root/webapp-color directory. What command is run at container startup?

 :   /root/webapp-color 해당 경로에 가서 dockerfile 파일을 열어보면 확인 할 수 있다. 

 :  entrypoint 는 지정한 명령어를 수행하도록 지정하는 것을 의미한다. 

 

A) python app.py

 

7. Inspect the file Dockerfile2 given at /root/webapp-color directory. What command is run at container startup?

# vi Dockerfile2

A) python app.py --color red

 

8.Inspect the two files under directory webapp-color-2. What command is run at container startup?

Assume the image was created from the Dockerfile in this folder.

 : 더 효율적인 파일에 명령어가 실행 된다. 

A) --color green

 

9.Inspect the two files under directory webapp-color-3. What command is run at container startup?

Assume the image was created from the Dockerfile in this folder.

# vi webapp-color-pod-2.yaml

 

A) python app.py --color pink

 

10.Create a pod with the given specifications. By default it displays a blue background. Set the given command line arguments to change it to green

  • Pod Name: webapp-green

  • Image: kodekloud/webapp-color

  • Command line arguments: --color=green

# k run webapp-green --image=kodekloud/webapp-color --restart=Never --dry-run=client -o yaml > pod.yaml

# vi pod.yaml

# k apply -f pod.yaml

# k describe pod webapp-green

 

 : vi 에서 argument 설정시 

 : [" --color=green"]  describe 출력시 -> --color=green

 : [ "--color","green"]  describe 출력시 -> color  green 

 : 다르게 출력된다. 

 

 

728x90
반응형