January 2019
Intermediate to advanced
484 pages
11h 48m
English
To use ConfigMap inside a pod, you'll have to use configMapKeyRef as the value source in the env section. This will populate whole ConfigMap pairs to environment variables:
# cat 3-2-3_pod_ev_configmap.yamlapiVersion: v1kind: Podmetadata: name: configmap-evspec: containers: - name: configmap image: centos command: ["/bin/sh", "-c", "while : ;do echo $DATABASE_ENDPOINT; sleep 10; done"] env: - name: DATABASE_ENDPOINT valueFrom: configMapKeyRef: name: example key: database.properties// create configmap# kubectl create -f 3-2-3_pod_ev_configmap.yamlpod/configmap-ev created// check out the logs# kubectl logs configmap-evendpoint=k8s.us-east-1.rds.amazonaws.com port=1521
The Kubernetes system itself also ...
Read now
Unlock full access