The purpose of the ConfigMap object is to store non-sensitive data in key-value pairs. This makes reusing of configuration easy because the configuration is separated from the containers.

Creating ConfigMaps

There are two ways to create ConfigMaps.

Declarative

apiVersion: v1
kind: ConfigMap
metadata:
  name: name-of-config-map
data:
  name: Ali
  age: '19'

Imperative

kubectl create config-map name-of-config-map --from-literal=ENV_1=VALUE_1 --from-literal=ENV_2=VALUE_2

Resources