CKA &. CKAD/Application Lifecycle Management
ConfigMap Practice Test
Clark Shim
2021. 3. 27. 17:58
ㅁ How many PODs exist on the system?
kubectl get pods
ㅁ What is the environment variable name set on the container in the pod?
kubectl describe pod webapp-color
ㅁ Update the environment variable on the POD to display a 'green' background
kubectl get pod web-app -o yaml > pod-definition.yaml
이후 필요 부분 수정
ㅁ How many ConfigMaps exist in the environment?
kubectl get configmaps
ㅁ Identify the database host from the config map 'db-config'
kubectl get configmap
식별된 Configmap을 확인하여 해당 ConfigMap에 대해 describe해본다.
kubectl describe configmaps db-config
ㅁ Create a new ConfigMap for the 'webapp-color' POD. Use the spec given on the right.
- ConfigName Name: webapp-config-map
- Data: APP_COLOR=darkblue
webapp-config-map.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: webapp-config-map
data:
APP_COLOR: darkblue
kubectl create -f webapp-color.yaml
or
kubectl create cm webapp-color --from-literal=APP_COLOR=darkblue
ㅁ Update the environment variable on the POD use the newly create ConfigMap
- Pod Name: webapp-color
- EnvFrom: webapp-config-map
spec:
containers:
image: kodekloud/webapp-color
imagePullPolicy: Always
name: webapp-color
envFrom:
- configMapRef:
name: webapp-config-map
tips
kubectl explain pods --recursive | grep envFrom -A3