CKAD Prep Part 4 – Kubernetes Config Maps

Kubernetes Config Maps A ConfigMap is a Kubernetes object that stores configuration data in a key/value store. apiVersion: v1 kind: ConfigMap metadata: name: config-map-demo data: greetingOne: Hey there! greetingTwo: Howdy partner! A ConfigMap can be referenced in a Pod spec and used to configure an application running in a container. ConfigMap Data as Environment Variables The following example shows how we can define an environment variable for a container and then set its value using data from a ConfigMap. apiVersion: v1 kind: Pod metadata: name: config-map-demo-pod labels: app: demo-app spec: containers: - name: demo-app-container image: busybox command: ['sh', '-c', 'echo $GREETING & sleep 3600'] env: [...]