컨피그맵(Configmap)

설정값을 pod로 전달하는 방법

컨피그맵

일반적인 설정 정보(값)을 저장할 수 있는 쿠버네티스 오브젝트로 네임스페이스 별 존재한다.

컨피그맵 설정

vagrant@ubuntu:~$ kubectl create configmap log-level-configmap --from-literal LOG_LEVEL=DEBUG
configmap/log-level-configmap created

vagrant@ubuntu:~$ kubectl create configmap start-k8s --from-literal k8s=kubernetes --from-literal container=docker
configmap/start-k8s created

컨피그맵 확인

vagrant@ubuntu:~$ kubectl get configmap
NAME                  DATA   AGE
log-level-configmap   1      3m41s
start-k8s             2      2m27s

vagrant@ubuntu:~$ kubectl describe configmap log-level-configmap
Name:         log-level-configmap
Namespace:    default
Labels:       <none>
Annotations:  <none>

Data
====
LOG_LEVEL:
----
DEBUG
Events:  <none>

컨피그맵을 YAML 로 출력

vagrant@ubuntu:~$ kubectl get configmap log-level-configmap -o yaml
apiVersion: v1
data:
  LOG_LEVEL: DEBUG
kind: ConfigMap
metadata:
  creationTimestamp: "2020-09-22T01:13:06Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:data:
        .: {}
        f:LOG_LEVEL: {}
    manager: kubectl-create
    operation: Update
    time: "2020-09-22T01:13:06Z"
  name: log-level-configmap
  namespace: default
  resourceVersion: "68473"
  selfLink: /api/v1/namespaces/default/configmaps/log-level-configmap
  uid: 6ddcde79-4ff9-4403-87ac-00335744bb7a

 

반응형

+ Recent posts