KILLERCODA - CKAD - ConfigMap Access in Pods 오답노트

hyereen·2025년 1월 31일

Kubernetes

목록 보기
39/53

2
1.Create a Pod named pod1 of image nginx:alpine
2.Make key tree of ConfigMap trauerweide available as environment variable TREE1
3.Mount all keys of ConfigMap birke as volume. The files should be available under /etc/birke/*
4.Test env+volume access in the running Pod

참고

정답

  • mountPath: /etc/birke임을 주의!! (/etc/birke/* 그대로 쓰면 틀림)
controlplane $ cat pod1.yaml 
apiVersion: v1
kind: Pod
metadata:
  name: pod1
spec:
  containers:
  - name: nginx
    image: nginx:alpine
    env:
    - name: TREE1
      valueFrom:
        configMapKeyRef:
          name: trauerweide
          key: tree
    volumeMounts:
      - name: config-volume
        mountPath: /etc/birke
  volumes:
    - name: config-volume
      configMap:
        # Provide the name of the ConfigMap containing the files you want
        # to add to the container
        name: birke
  restartPolicy: Never

0개의 댓글