Kubernetes ConfigMap Operations: Difference between revisions
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
The entire content of the file is keyed under the file name (by default) or under an arbitrary name, if specified. | The entire content of the file is keyed under the file name (by default) or under an arbitrary name, if specified. | ||
kubectl create configmap example --from-file=some-config-file.txt | |||
<syntaxhighlight lang='yaml'> | |||
apiVersion: v1 | |||
kind: ConfigMap | |||
metadata: | |||
name: example | |||
... | |||
data: | |||
some-config-file.txt: | | |||
color=blue | |||
shape=circle | |||
</syntaxhighlight> |
Revision as of 22:11, 22 October 2019
External
Internal
Inspect a ConfigMap
kubectl get cm <name> -o yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: example
...
data:
color: red
shape: square
Create a ConfigMap with CLI
Specify Key/Value Pairs on Command Line
kubectl create configmap example --from-literal=color=red --from-literal=shape=square
Multiple --from-literal=
entries are allowed.
Use the Content of a File
The entire content of the file is keyed under the file name (by default) or under an arbitrary name, if specified.
kubectl create configmap example --from-file=some-config-file.txt
apiVersion: v1
kind: ConfigMap
metadata:
name: example
...
data:
some-config-file.txt: |
color=blue
shape=circle