CKA SimA 11 모든 노드에 DaemonSet 배포

(CKA 1.32A - Q11 모든 노드에 DaemonSet 배포에서 넘어옴)

1 개요[ | ]

모든 노드에 Pod을 배포하기 위한 DaemonSet 예시

2 DaemonSet 매니페스트 예시[ | ]

  • 레이블 추가(id, uuid)
  • 리소스 요청 설정(cpu: 10m, memory: 10Mi)
  • control-plane 노드에도 스케줄될 수 있도록 toleration 지정
# /tmp/ds-important.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ds-important
  namespace: project-tiger
  labels:
    id: ds-important
    uuid: 18426a0b-5f59-4e10-923f-c0e078e82462
spec:
  selector:
    matchLabels:
      id: ds-important
      uuid: 18426a0b-5f59-4e10-923f-c0e078e82462
  template:
    metadata:
      labels:
        id: ds-important
        uuid: 18426a0b-5f59-4e10-923f-c0e078e82462
    spec:
      containers:
      - name: ds-important
        image: httpd:2-alpine
        resources:
          requests:
            cpu: 10m
            memory: 10Mi
      tolerations:
      - key: node-role.kubernetes.io/control-plane
        effect: NoSchedule

3 매니페스트 적용[ | ]

  • 매니페스트 적용
# k apply -f /tmp/ds-important.yaml
daemonset.apps/ds-important created

4 실행 확인[ | ]

  • DaemonSet 상태 확인: 모든 노드에 배포되었는지 확인
# k -n project-tiger get ds
NAME           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
ds-important   3         3         3       3            3           <none>          15s
  • 생성된 Pod 확인 및 각 노드에 하나씩 존재하는지 확인
# k -n project-tiger get po -l id=ds-important -o wide
NAME                 READY   STATUS    RESTARTS   AGE   IP            NODE              NOMINATED NODE   READINESS GATES
ds-important-xxxxx   1/1     Running   0          20s   10.244.1.5    cka2556-node1     <none>           <none>
ds-important-yyyyy   1/1     Running   0          20s   10.244.2.7    cka2556-node2     <none>           <none>
ds-important-zzzzz   1/1     Running   0          20s   10.244.0.3    cka2556           <none>           <none>

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}