January 2019
Intermediate to advanced
484 pages
11h 48m
English
Similar to previous examples in the Secrets subsection, we mount a volume with configmap syntax and add volumeMounts inside a container template. The command in centos will loop to cat ${MOUNTPOINT}/$CONFIG_FILENAME:
cat 3-2-3_pod_vol_configmap.yamlapiVersion: v1kind: Podmetadata: name: configmap-volspec: containers: - name: configmap image: centos command: ["/bin/sh", "-c", "while : ;do cat /src/app/config/database.properties; sleep 10; done"] volumeMounts: - name: config-volume mountPath: /src/app/config volumes: - name: config-volume configMap: name: example // create configmap# kubectl create -f 3-2-3_pod_vol_configmap.yamlpod "configmap-vol" created // check out the logs# kubectl logs -f configmap-volendpoint=k8s.us-east-1.rds.amazonaws.com ...
Read now
Unlock full access