본문 바로가기

AWS Cloud School

[06.28] Kubernetes configMap, Secret, 3-tier-architecture

 

 

root@master:/k8s/configmap# cat info.yml 

apiVersion: v1

kind: ConfigMap

metadata:

  name: info

  namespace: default

data:

  db_host: 211.183.3.30

  username: root

 

apiVersion: v1
kind: Pod
metadata:
  name: my-pod-env
spec:
  containers:
  - name: my-container
    image: nginx
    env:
    - name: USERNAME
      valueFrom:
        configMapKeyRef:
          name: info
          key: username
    - name: DATABASE
      valueFrom:
        configMapKeyRef:
          name: info
          key: db_host

 

 

apiVersion: v1
kind: Secret
metadata:
  name: sec
type: Opaque
stringData:
  password: test123
apiVersion: v1
kind: Pod
metadata:
  name: pod-sec
spec:
  containers:
  - name: sec-con
    image: nginx
    envFrom:
    - secretRef:
        name: sec