configmap
Creating non-confidential key-value pair data in clusters
A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.
A ConfigMap allows you to decouple environment-specific configuration from your container images, so that your applications are easily portable.
Warning
ConfigMap does not provide secrecy or encryption. If the data you want to store are confidential, use a Secret rather than a ConfigMap, or use additional (third party) tools to keep your data private.Command using File
kubectl create configmap my-config --from-file=path/to/bar Example
Input File
# application.properties FOO=Bar Command
kubectl create configmap my-config --from-file=application.properties Output
$ kubectl get configmap NAME DATA AGE my-config 1 21s Command using Literal
kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2 Example
Command
kubectl create configmap my-config --from-literal=FOO=Bar Output
$ kubectl get configmap NAME DATA AGE my-config 1 21s Command using env file
kubectl create configmap my-config --from-env-file=path/to/bar.env Example
Input File
# tracing.env ENABLE_TRACING=true SAMPLER_TYPE=probabilistic SAMPLER_PARAMETERS=0.1 Command
kubectl create configmap my-config --from-env-file=tracing.env Output
$ kubectl get configmap NAME DATA AGE my-config 1 21s Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified February 15, 2021: Update _index.md (95b1dcc)