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
참고
정답
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