Kubernetes - DaemonSet

category DevOps/Kubernetes 2021. 11. 25. 08:19
728x90
반응형

DaemonSet

정의

  • 전체 노드에서 Pod가 한개씩 실행되도록 보장
  • 로그 수집기, 모니터링 에이전트와 같은 프로그램 실행시 적용

생성

root@master:~# cat > daemonset-exam.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: daemonset-nginx
spec:
  selector:
    matchLabels:
      app: webui
  template:
    metadata:
      name: nginx-pod
      labels:
        app: webui
    spec:
      containers:
      - name: nginx-container
        image: nginx:1.14
root@master:~# kubectl create -f daemonset-exam.yaml 
daemonset.apps/daemonset-nginx created

조회

root@master:~# kubectl get daemonsets -o wide
NAME              DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE   CONTAINERS        IMAGES       SELECTOR
daemonset-nginx   2         2         2       2            2           <none>          83s   nginx-container   nginx:1.14   app=webui
root@master:~# kubectl get pods -o wide
NAME                    READY   STATUS    RESTARTS   AGE   IP          NODE                NOMINATED NODE   READINESS GATES
daemonset-nginx-6v5rj   1/1     Running   0          89s   10.36.0.1   node1.example.com   <none>           <none>
daemonset-nginx-snt4x   1/1     Running   0          89s   10.44.0.1   node2.example.com   <none>           <none>

삭제

root@master:~# kubectl delete daemonsets daemonset-nginx 
daemonset.apps "daemonset-nginx" deleted
728x90
반응형

'DevOps > Kubernetes' 카테고리의 다른 글

Kubernetes - Service (서비스)  (0) 2021.11.30
Kubernetes - Deployment  (0) 2021.11.25
Kubernetes - CronJob  (0) 2021.11.24
Kubernetes -Job Controller  (0) 2021.11.23
Kubernetes - StatefulSet  (0) 2021.11.22