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

[cka]kodekloud-Env Variables

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 environment variable name set on the container in the pod?

# k describe pod webapp-color

A) APP_COLOR

 

3.What is the value set on the environment variable APP_COLOR on the container in the pod?

 : 같은 이미지A) pink

 

4.View the web application UI by clicking on the Webapp Color Tab above your terminal.

  This is located on the right side.

 

 : click

 

5.Update the environment variable on the POD to display a green background

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

  • Pod Name: webapp-color

  • Label Name: webapp-color

  • Env: APP_COLOR=green
# k get pods
 # k edit pod webapp-color
# k replace --force -f  /tmp/kubectl-edit-1449135409.yaml 

* 해당 문구 확인 될 시 

  : /tmp/kubectl-edit-14~~.yaml 파일이 임시로 저장되었다는 의미이다. 

  : 이전에도 포스팅 했듯이 해당 경로로 repalce 하면 됨 

6. What is the value set on the environment variable APP_COLOR on the container in the pod?

  : green 으로 변경되면 정상

 A) ok 

 

7. How many ConfigMaps exists in the default namespace?

# k get configMaps

A) 2

 

8. Identify the database host from the config map db-config

# k describe configMaps db-config

A) SQL01.example.com

 

9. Create a new ConfigMap for the webapp-color POD. Use the spec given below.

  • ConfigName Name: webapp-config-map

  • Data: APP_COLOR=darkblue
 # k create cm webapp-config-map --fron-literal=APP_COLOR=darkblue
# k describe cm webapp-config-map

10.Update the environment variable on the POD to use the newly created ConfigMap.

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

  • Pod Name: webapp-color

  • EnvFrom: webapp-config-map
# k replace --force -f  <yaml파일>

 : docs 를 찾아서 해결한다. 

 : 띄어쓰기 조심 

 

11.View the changes to the web application UI by clicking on the Webapp Color Tab above your terminal.

     If you already have it open, simply refresh the browser.

 

A) ok 

728x90
반응형