Gerenciar Configmaps no Kubernetes

$ kubectl create configmap variaveis --from-literal VAR1=VALOR1 --from-literal VAR2=VALOR2 --from-literal VAR3=VALOR3
configmap/variaveis created
$ kubectl get configmaps
NAME               DATA   AGE
kube-root-ca.crt   1      4d15h
variaveis          3      66s
$ kubectl describe cm variaveis
Name:         variaveis
Namespace:    default
Labels:       <none>
Annotations:  <none>
 
Data
====
VAR1:
----
VALOR1
VAR2:
----
VALOR2
VAR3:
----
VALOR3
 
BinaryData
====
 
Events:  <none>
$ cat bashrc-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: bashrc-configmap
data:
  PS1: '${debian_chroot:+($debian_chroot)}\h:\w\$ '
  TERM: linux
$ kubectl apply -f bashrc-configmap.yaml
configmap/bashrc-configmap created
$ cat pod-configmap.yaml
apiVersion: v1
kind: Pod
metadata:
  name: pod-configmap
spec:
  containers:
  - name: busybox
    image: busybox:1.28
    imagePullPolicy: IfNotPresent
    command:
      - sleep
      - "3600"
    envFrom:
      - configMapRef:
          name: bashrc-configmap
$ kubectl apply -f pod-configmap.yaml
pod/pod-configmap created
</code bash>
 
<code bash>
$ kubectl exec -it pod-configmap -- env | grep PS1
PS1=${debian_chroot:+($debian_chroot)}\h:\w\$
$ kubectl delete -f bashrc-configmap.yaml,pod-configmap.yaml
configmap "bashrc-configmap" deleted
pod "pod-configmap" deleted
$ kubectl delete cm variaveis
configmap "variaveis" deleted