본문 바로가기
Certification/CKAD

문제 4: configMap을 volume으로 마운트

by 인 체리 2025. 4. 10.

다음 조건을 만족하는 Pod YAML을 작성하시오:

  • 이름: config-pod
  • 컨테이너 이름: config-reader
  • 이미지: busybox
  • 커맨드: ["sh", "-c", "cat /etc/config/MODE; sleep 3600"]
  • /etc/config 디렉토리에 my-config 라는 configMap을 볼륨으로 마운트
  • 라벨: purpose=configmap


    나의 대답
apiVersion: v1
kind: Pod
metadata:
  name: config-pod
  labels:
    purpose: configmap
spec:
  containers:
  - name: config-reader
    image: busybox
    command: ["sh", "-c", "cat /etc/config/MODE; sleep 3600"]
    volumeMounts:
    - name: my-config
      mountPath: /etc/config
  volumes:
  - name: my-config
    configMap:
      name: my-config

 

정답