###########################################################
###########################################################
mkdir -p configure-pod-container/configmap/
wget https://kubernetes.io/examples/configmap/game.properties -O configure-pod-container/configmap/game.properties wget https://kubernetes.io/examples/configmap/ui.properties -O configure-pod-container/configmap/ui.properties
kubectl create configmap game-config --from-file=configure-pod-container/configmap/
kubectl describe configmaps game-config
curl -OL https://k8s.io/examples/pods/config/redis-config
kubectl create configmap example-redis-config --from-file=redis-config
vi pod-accessing-configmap.yml
apiVersion: v1 kind: Pod metadata: name: redis spec: containers:
- name: redis
image: redis
volumeMounts:
- mountPath: /redis-master name: config volumes:
- name: config
configMap:
name: example-redis-config
items:
- key: redis-config path: redis.conf
kubectl exec -it redis -- cat /redis-master/redis.conf
kubectl create configmap special-config --from-literal=special.how=very
vi pod-accessing-confimap-using-env.yml
apiVersion: v1 kind: Pod metadata: name: test-pod spec: containers:
- name: test-container
image: busybox
command: [ "env" ]
env:
- name: SPECIAL_LEVEL_KEY valueFrom: configMapKeyRef: name: special-config key: special.how restartPolicy: Never
kubectl logs test-pod | grep SPECIAL