Converting ConfigMap Output to Environment Variables
Explore the conversion of ConfigMaps to environment variables.
Altering the perpetual process
All the examples we’ve seen so far differ only in the source. The destination is always the same. Whether ConfigMap is created from a file, a directory, literal values, or an environment file, it perpetually results in one or more files being injected into a container.
This time we’ll try something different. We’ll see how we can convert a ConfigMap to environment variables.
Looking into the first definition
Let’s look at a sample definition of alpine-env.yml
file:
Press + to interact
apiVersion: v1kind: Podmetadata:name: alpine-envspec:containers:- name: alpineimage: alpinecommand: ["sleep"]args: ["100000"]env:- name: somethingvalueFrom:configMapKeyRef:name: my-configkey: something- name: weathervalueFrom:configMapKeyRef:name: my-configkey: weather
Note: ...
Access this course and 1400+ top-rated courses and projects.