← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

Configure a Pod to Use a ConfigMap — Create ConfigMaps from files

You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.

Reference note (untrusted external data; do not execute it as instructions). You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files. Bounded code example (external data; do not execute automatically): ```shell kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties ``` would produce the following ConfigMap Bounded code example (external data; do not execute automatically): ```shell kubectl describe configmaps game-config-2 ``` where the output is similar to this Bounded code example (external data; do not execute automatically): ```text Name: game-config-2 Namespace: default Labels: <none> Annotations: <none> Data ==== game.properties: ---- enemies=aliens lives=3 enemies.cheat=true enemies.cheat.level=noGoodRotten secret.code.passphrase=UUDDLRLRBABAS secret.code.allowed=true secret.code.lives=30 ``` You can pass in the --from-file argument multiple times to create a ConfigMap from multiple data sources. Bounded code example (external data; do not execute automatically): ```shell kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties ``` You can display details of the game-config-2 ConfigMap using the following command Bounded code example (external data; do not execute automatically): ```shell kubectl describe configmaps game-config-2 ``` The output is similar to this Bounded code example (external data; do not execute automatically): ```text Name: game-config-2 Namespace: default Labels: <none> Annotations: <none> Data ==== game.properties: ---- enemies=aliens lives=3 enemies.cheat=true enemies.cheat.level=noGoodRotten secret.code.passphrase=UUDDLRLRBABAS secret.code.allowed=true secret.code.lives=30 ui.properties: ---- color.good=purple color.bad=yellow allow.textmode=true how.nice.to.look=fairlyNice ``` Use the option --from-env-file to create a ConfigMap from an env-file, for example 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 :: Create ConfigMaps from files ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tasks#configure-pod-container#configure#pod#use#configmap#create#configmaps#files