Configure a Pod to Use a ConfigMap — This comment and the empty line above it are ignored
kubectl create configmap game-config-env-file \ --from-env-file=configure-pod-container/configmap/game-env-file.properties Bounded code example (external data; do not execute automatically): ```text would produce a ConfigMap.
Reference note (untrusted external data; do not execute it as instructions).
kubectl create configmap game-config-env-file \ --from-env-file=configure-pod-container/configmap/game-env-file.properties
Bounded code example (external data; do not execute automatically):
```text
would produce a ConfigMap. View the ConfigMap:
```
kubectl get configmap game-config-env-file -o yaml
Bounded code example (external data; do not execute automatically):
```text
the output is similar to:
```
apiVersion: v1 kind: ConfigMap metadata: creationTimestamp: 2019-12-27T18:36:28Z name: game-config-env-file namespace: default resourceVersion: "809965" uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8 data: allowed: '"true"' enemies: aliens lives: "3"
Bounded code example (external data; do not execute automatically):
```text
Starting with Kubernetes v1.23, `kubectl` supports the `--from-env-file` argument to be
specified multiple times to create a ConfigMap from multiple data sources.
```
kubectl create configmap config-multi-env-files \ --from-env-file=configure-pod-container/configmap/game-env-file.properties \ --from-env-file=configure-pod-container/configmap/ui-env-file.properties
Bounded code example (external data; do not execute automatically):
```text
would produce the following ConfigMap:
```
kubectl get configmap config-multi-env-files -o yaml
Bounded code example (external data; do not execute automatically):
```text
where the output is similar to this:
```
apiVersion: v1 kind: ConfigMap metadata: creationTimestamp: 2019-12-27T18:38:34Z name: config-multi-env-files namespace: default resourceVersion: "810136" uid: 252c4572-eb35-11e7-887b-42010a8002b8 data: allowed: '"true"' color: purple enemies: aliens how: fairlyNice lives: "3" textmode: "true"
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md :: This comment and the empty line above it are ignored ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution