ConfigMap
API Version Compatibility Table
Kubernetes Version
Core API Version
Creating a ConfigMap
Create from Key-Value String
$ kubectl create configmap special-config --from-literal=special.how=very
configmap "special-config" created
$ kubectl get configmap special-config -o go-template='{{.data}}'
map[special.how:very]Create from ENV File
$ echo -e "a=b\nc=d" | tee config.env
a=b
c=d
$ kubectl create configmap special-config --from-env-file=config.env
configmap "special-config" created
$ kubectl get configmap special-config -o go-template='{{.data}}'
map[a:b c:d]Create from Directory
Create from Yaml/Json File
Using ConfigMap
Use as Environment Variable
Use as Command Line Arguments
Mount ConfigMap as File or Directory in Volume Directly
Using Subpath to Mount ConfigMap as Individual File to Directory
Immutable ConfigMap
Further Reading
最后更新于