oot@manager:~/k8slab/etc# kubectl get daemonset -n kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
calico-node 4 4 4 4 4 kubernetes.io/os=linux 7d
kube-proxy 4 4 4 4 4 kubernetes.io/os=linux 7d
root@manager:~/k8slab/etc# kubectl describe node manager
Name: manager
...
Taints: node-role.kubernetes.io/master:NoSchedule
Taint : Pod 배포에 대한 스케쥴을 관리하는데, 현재 master에는 NoSchedule이므로 pod가 배포되지 않는다.
root@manager:~/k8slab/etc# kubectl describe node worker1
Name: worker1
...
Taints: <none>
Taint : 무조건 패드가 배포된다.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: test
spec:
selector:
matchLabels:
name: test
template:
metadata:
labels: # pod에 name: test 라벨을 붙임
name: test
spec:
tolerations: # taints가 무시되고 아래에 적용한 부분에 따라 포드가 배포됨. 마스터도 배포
- key: node-role.kubernetes.io/master
effect: NoSchedule # 이걸 무시하고 배포
containers:
- name: test
image: busybox
args: ["tail","-f","/dev/null"] # pod가 중지 되지 않도록 하기위한 설정
resources:
limits:
cpu: 100m # CPU 0.1개 제공
memory: 200Mi # 메모리는 200MB 제공
root@manager:~/k8slab/etc# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
test-8wzvc 1/1 Running 0 4m54s 192.168.102.77 manager <none> <none>
test-bqqwl 1/1 Running 0 4m54s 192.168.189.76 worker2 <none> <none>
test-hpmbw 1/1 Running 0 4m54s 192.168.182.11 worker3 <none> <none>
test-xv7lw 1/1 Running 0 4m54s 192.168.235.138 worker1 <none> <none>
manager에도 배포된 것을 볼 수 있다.
root@manager:~/k8slab/etc# kubectl delete pod test-8wzvc
pod "test-8wzvc" deleted
root@manager:~/k8slab/etc# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
test-bqqwl 1/1 Running 0 6m34s 192.168.189.76 worker2 <none> <none>
test-dm74x 1/1 Running 0 19s 192.168.102.78 manager <none> <none>
test-hpmbw 1/1 Running 0 6m34s 192.168.182.11 worker3 <none> <none>
test-xv7lw 1/1 Running 0 6m34s 192.168.235.138 worker1 <none> <none>
manager 노드에 있는 것 삭제 후 확인 해보면 다시 생성되어 있다.