Improve configmap usage as pod command and args
parent
de6d96dc5c
commit
1ec78b1f28
content/en
docs/tasks/configure-pod-container
examples/pods
|
@ -532,7 +532,7 @@ This functionality is available in Kubernetes v1.6 and later.
|
||||||
|
|
||||||
## Use ConfigMap-defined environment variables in Pod commands
|
## Use ConfigMap-defined environment variables in Pod commands
|
||||||
|
|
||||||
You can use ConfigMap-defined environment variables in the `command` section of the Pod specification using the `$(VAR_NAME)` Kubernetes substitution syntax.
|
You can use ConfigMap-defined environment variables in the `command` and `args` of a container using the `$(VAR_NAME)` Kubernetes substitution syntax.
|
||||||
|
|
||||||
For example, the following Pod specification
|
For example, the following Pod specification
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ spec:
|
||||||
containers:
|
containers:
|
||||||
- name: test-container
|
- name: test-container
|
||||||
image: k8s.gcr.io/busybox
|
image: k8s.gcr.io/busybox
|
||||||
command: [ "/bin/sh", "-c", "echo $(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)" ]
|
command: [ "/bin/echo", "$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)" ]
|
||||||
env:
|
env:
|
||||||
- name: SPECIAL_LEVEL_KEY
|
- name: SPECIAL_LEVEL_KEY
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
|
Loading…
Reference in New Issue