k8s에서 제공하는 Controller 중 하나로 클러스터 전체 노드에 특정 Pod를 실행할 때 사용된다.
nodeSelector을 사용하면 label을 통해 특정 노드에서 작업을 진행할 수 있고, nodeSelector 설정을 안했을 시는 모든 노드에서 작업이 진행된다.
watch -n1 kubectl get pods -o wied --show-labels

vi testapp-ds.yaml

nodeSelector 작성 없이 생성하면 모든 node에 pod가 생성되는 것을 확인 할 수 있다.
현재 kube-node1에 문제가 생겨 ErrImageNerverPull 오류가 발생했다.
kubectl create -f testapp-ds.yaml


vi testapp-ds-node.yaml

Daemonset을 생성해도 pod가 생성되지 않는다.
yaml 파일을 보면 nodeSelector부분에 node: dev라고 설정해서 그렇다.


label 명령어를 통해 dev로 변경하면 정상적으로 pod가 생성되는 것을 볼 수 있다.
kubectl label nodes kube-node1 node=dev


다른 label로 변경시 pod가 삭제되는 것을 볼 수 있다.
kubectl label nodes kube-node1 node-


kubectl delete daemonsets testapp-ds
