brunch

8. 오라클 클라우드 - 쿠버네티스 - 데몬셋

by Master Seo

<1> 데몬셋 ?

<2> Oracle Cloud 에서 데몬셋 사용



<1> 데몬셋 ?


모든 노드에 Pod를 1개씩 생성해주는 오브젝트 , node당 1개씩 pod가 생긴다.

pod를 삭제 하더라도 데몬셋에 의해 자동으로 pod가 재 생성 된다.

기본 work node에만 생성 된다. 마스터 노드는 생성되지 않는다.생성하려면 따로 옵션을 줘야 한다.

데몬셋은 리플리카 세트가 필요 없어 리플리카 세트는 사용하지 않는다.




<2> Oracle Cloud 에서 데몬셋 사용


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get daemonsets.apps -n kube-system

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE

csi-oci-node 2 2 2 2 2 <none> 6d20h

kube-flannel-ds 2 2 2 2 2 <none> 6d20h

kube-proxy 2 2 2 2 2 beta.kubernetes.io/os=linux 6d20h

nvidia-gpu-device-plugin 0 0 0 0 0 <none> 6d20h

proxymux-client 2 2 2 2 2 node.info.ds_proxymux_client=true 6d20h



2

topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > daemonset-1.yaml

> apiVersion: apps/v1

> kind: DaemonSet

> metadata:

> name: daemonset-1

> spec:

> selector:

> matchLabels:

> name: daemonset-cndk

> template:

> metadata:

> labels:

> name: daemonset-cndk

> spec:

> containers:

> - name: daemonset-pod

> image: nginx

> EOF



3

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f daemonset-1.yaml

daemonset.apps/daemonset-1 created


4

pod , ds 보기~


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pods,ds -o wide

NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES

pod/daemonset-1-b4t49 1/1 Running 0 12s 10.244.0.54 10.0.10.80 <none> <none>

pod/daemonset-1-k4czb 1/1 Running 0 12s 10.244.0.162 10.0.10.141 <none> <none>


NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR

daemonset.apps/daemonset-1 2 2 2 2 2 <none> 12s daemonset-pod nginx name=daemonset-cndk



5

pod 라벨 보기~


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod --show-labels

NAME READY STATUS RESTARTS AGE LABELS

daemonset-1-b4t49 1/1 Running 0 108s controller-revision-hash=749f4f6bc8,name=daemonset-cndk,pod-template-generation=1

daemonset-1-k4czb 1/1 Running 0 108s controller-revision-hash=749f4f6bc8,name=daemonset-cndk,pod-template-generation=1


6

파드 삭제해 보기

파드는 유지 된다.

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod,ds

NAME READY STATUS RESTARTS AGE

pod/daemonset-1-lpsp8 1/1 Running 0 12s

pod/daemonset-1-md6lx 1/1 Running 0 12s

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE

daemonset.apps/daemonset-1 2 2 2 2 2 <none> 12s



topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete pod --all

pod "daemonset-1-lpsp8" deleted

pod "daemonset-1-md6lx" deleted



topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod,ds

NAME READY STATUS RESTARTS AGE

pod/daemonset-1-5b5tf 1/1 Running 0 4s

pod/daemonset-1-s8skp 0/1 ContainerCreating 0 4s

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE

daemonset.apps/daemonset-1 2 2 1 2 1 <none> 28s


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get pod,ds

NAME READY STATUS RESTARTS AGE

pod/daemonset-1-5b5tf 1/1 Running 0 10s

pod/daemonset-1-s8skp 1/1 Running 0 10s

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE

daemonset.apps/daemonset-1 2 2 2 2 2 <none> 34s



7

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get ds -o wide

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR

daemonset-1 2 2 2 2 2 <none> 6m9s daemonset-pod nginx name=daemonset-cndk


8

데몬셋 지우기

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl delete ds daemonset-1

daemonset.apps "daemonset-1" deleted



9

확인

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get ds -o wide

No resources found in default namespace.



감사합니다.

keyword
매거진의 이전글7. 오라클 클라우드 - 쿠버네티스 - 리플리카세트