환경(dev, pord)에 따라 변하는 설정과 관련된 값들을 관리하는 Object
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-dev
data:
SSH: 'false'
User: dev
apiVersion: v1
kind: Secret
metadata:
name: sec-dev
data:
Key: MTlzNA== # base64 encoded
apiVersion: v1
kind: Pod
metadata:
name: pod-1
spec:
containers:
- name: container
image: something
envFrom:
- configMapRef:
name: cm-dev
- secretReg:
name: sec-dev
$ kubectl create secret generic ...
$ kubectl create configmap cm-file --from-file=./file-c.txt
$ kubectl create secret generic sec-file --from-file=./file-s.txt
apiVersion: v1
kind: Pod
metadata:
name: file
spec:
containers:
- name: container
image: something
env:
- name: file-c # key 변경
valueFrom:
configMapKeyRef:
name: cm-file
key: file-c.txt # 기존 key
- name: file-s
valueFrom:
secretKeyRef:
name: sec-file
key: file-s.txt
$ kubectl create secret generic ...
$ kubectl create configmap cm-file --from-file=./file-c.txt
$ kubectl create secret generic sec-file --from-file=./file-s.txt
apiVersion: v1
kind: Pod
metadata:
name: mount
spec:
containers:
- name: container
image: something
volumeMounts:
- name: file-volume
mountPath: /mount
volumes:
- name: file-volume
configMap:
name: cm-file