Skip to content
Kubernetes (K8s)

icon picker
ConfigMap and secret

ConfigMap is used to store non-sensitive key-value data pairs which can be passed to containers

ConfigMap via Config File
kubectl create configmap [NAME] --from-file [/path/to/file.properties] --from-file [/path/to/file2.properties]

Directories can also be provided

kubectl create configmap [NAME] --from-file [/Path/to/directory]

Getting ConfigMap via CLI
kubectl get configmap <configmap_name> -o yaml/json


Secrets


They are similar to configmaps but are used to store sensitive data.

Create secret from a file
kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt

List secret
kubectl get secrets

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.