Hands-On: Creating ConfigMaps Imperatively

Learn to implement ConfigMaps imperatively.

We'll cover the following

As with most Kubernetes objects, you can create them imperatively and declaratively. We’ll look at the imperative method first.

The command to imperatively create a ConfigMap is kubectl create configmap, but you can shorten configmap to cm. The command accepts two sources of data:

  • literal values on the command line (--from-literal)
  • files referenced on the command line (--from-file)

Run the following command to create a, ConfigMap called testmap1, populated with two map entries from literal values passed on the command line.

Get hands-on with 1200+ tech skills courses.