ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • k8s - 띄어쓰기에 중요함
    스마트팩토리 개발자 교육(23.05.08 ~ 23.10.27)7/Kubernetes 2023. 10. 24. 15:32

    문제사항

    - configmag적용이 안되어 Pod 생성시 DB 접속 에러 발생

    apiVersion: apps/v1
    kind: ReplicaSet
    metadata:
      name: was-replica-a
    spec:
      replicas: 2
      selector:
        matchLabels:
          type: was
          label: blue
      template:
        metadata: 
          name: was-a
          labels:
            type: was
            label: blue
        spec:
          containers:
          - name: container
            image: ljj9730/spring:latest
          envFrom: # 문제발생 띄어쓰기에 의해 문제발생
            - configMapRef:
                name: db-cm
            - secretRef:
                  name: db-secret
    terminationGracePeriodSeconds: 0

    들여 써주니 문제 해결

    #Labels로 blue 와 green을 구분한다
    
    apiVersion: apps/v1
    kind: ReplicaSet
    metadata:
      name: was-replica-b
    spec:
      replicas: 2
      selector:
        matchLabels:
          type: was
          label: green
      template:
        metadata: 
          name: was-b
          labels:
            type: was
            label: green
        spec:
          containers:
          - name: container
            image: ljj9730/spring:latest
            envFrom:
              - configMapRef:
                  name: db-cm
              - secretRef:
                  name: db-secret
    terminationGracePeriodSeconds: 0

    '스마트팩토리 개발자 교육(23.05.08 ~ 23.10.27)7 > Kubernetes' 카테고리의 다른 글

    k8s - namespace  (0) 2023.09.27
    k8s - configMap  (0) 2023.09.26
    k8s - Volume  (0) 2023.09.26
    k8s - service  (0) 2023.09.26
    k8s - pod  (0) 2023.09.26

    댓글

Designed by Tistory.