Creating a ConfigMap

You can create a ConfigMap using the kubectl create configmap command, with the data for the configuration set on the command line, or coming from one or more files that you have stored. It also supports loading a directory of files for convenience.

Creating from single key/value pairs on the command line is very simple, but probably the least convenient for managing configuration. For example, run the following command:

kubectl create configmap example-config --from-literal=log.level=err

This will create a ConfigMap named example-config with a single key/value pair. You can see the list of all configurations loaded with the following:

kubectl get configmap
NAME             DATA      AGEexample-config   0         2d

And view that ConfigMap using ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.