How to Create a ConfigMap in Kubernetes

Planted . Last tended .

To create a ConfigMap in Kubernetes:

  1. Create a file
  2. Or directly create it using cli

Sample File

apiVersion: v1
kind: ConfigMap
metadata: 
  name: myconfigmap 
data:
  username: sajal
  access_level: 1

Then apply using kubectl apply -f

You can set it to immutable by using immutable: true

Create from literal values

kubectl create configmap my-confi —-from-literal=username=sajal —-from-literal=access_leve=1
Updated . Thoughts? Email me.