Injecting Config Map to POD
Many applications rely on the configuration which is used during either application initialization or runtime. Most of the time there is a requirement to adjust values assigned to configuration parameters. ConfigMaps is the Kubernetes way to inject application pods with configuration data. ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable. This page provides a series of usage examples demonstrating how to create ConfigMaps and configure Pods using data stored in ConfigMaps.
How to inject config map in pods
apiVersion: v1 kind: Pod metadata: name: firstPod spec: containers: - image: image:latest name: firstcontainer env: -name: variablefromcm valueFrom: configMapKeyRef: key:variable2 name: cm4 -name: variablefromcm valueFrom: configMapKeyRef: key:variable2 name: cm4
Inject multiple variables using a single map name
apiVersion: v1 kind: Pod metadata: name: firstPod spec: containers: - image: image:latest name: firstcontainer envFrom: -configMapRef: name: cm4