Open In App

Kubernetes – Create ConfigMap From YAML File

A ConfigMap is a dictionary consisting of non-confidential data. Its primary role is to keep the configuration separate from the container image. ConfigMap can be created in different ways. This article will cover the declarative approach to creating ConfigMap from the YAML file.

Example:



 

Step 1. To create a Kubernetes ConfigMap object from the config.yaml file above, run the following command.

$ kubectl create configmap [configmap_name] [attribute] 

Depending on the source, the attribute will be:



 

Step 2. To get more details about the created ConfigMap, run the following command.

$ kubectl describe configmap app-config

Output:

 

Article Tags :