Kubernetes - Daemonset

choko's avatar
Jun 29, 2024
Kubernetes - Daemonset
 

데몬셋

  • deployment와 유사하게 파드를 생성하고 관리
  • 특정 노드 또는 모든 노드에 항상 실행되어야 할 특정 파드를 관리
    • 보통 로그 수집기, 노드 모니터링 같은 클러스터에서 항상 실행해두어야 하는 파드에 사용한다.

데몬셋 생성 및 확인

  • 생성
notion image
  • nodeselector를 생성해주면 특정 label에만 daemonset을 적용시킬 수 있고, nodeselector가 없다면 모든 노드에서 작업이 진행된다.
    • kubectl apply -f daemonset.yaml
 
  • 확인
    • kubectl get daemonset -n kube-system
 
 

ex) Prometheus의 node-exporter

apiVersion: apps/v1 kind: DaemonSet metadata: name: node-exporter namespace: mdl labels: app: node-exporter spec: selector: matchLabels: app: node-exporter template: metadata: labels: app: node-exporter ... volumeMounts: - mountPath: /host/proc mountPropagation: HostToContainer name: proc readOnly: true ports: - containerPort: 9100 protocol: TCP name: http volumes: - hostPath: path: /proc name: proc --- apiVersion: v1 kind: Service metadata: annotations: prometheus.io/scrape: 'true' labels: app: node-exporter name: node-exporter spec: ports: - name: http port: 9100 targetPort: 9100 selector: app: node-exporter
  • 이 daemonset을 apply 시키면 node-exporter pod가 생성된다.
  • node-exporter는 시스템의 리소스를 수집하여 프로메테우스 서버로 전달해 통합 모니터링이 가능해진다.
 
Share article

Tom의 TIL 정리방