본문으로 건너뛰기
김신건의 로그

[K8s] DaemonSet: 모든 노드에 한 pod

· 수정 · 📖 약 1분 · 209자/단어 #kubernetes #daemonset #k8s #infrastructure
DaemonSet, DS, node-level pod, log collector daemonset, node-exporter

정의

DaemonSet = 각 노드에 정확히 1 pod 보장. 노드 추가 시 자동 배치, 노드 제거 시 자동 정리.

흔한 사용

사용예시
로그 수집fluent-bit, fluentd, vector
메트릭 수집node-exporter, datadog-agent
네트워크calico-node, cilium, kube-proxy
스토리지csi-driver, longhorn-manager
보안falco, sysdig

YAML

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit
  namespace: logging
spec:
  selector: { matchLabels: { app: fluent-bit } }
  template:
    metadata: { labels: { app: fluent-bit } }
    spec:
      tolerations:
        - operator: Exists       # 모든 taint 무시 (master 노드도)
      hostNetwork: true          # 노드 네트워크 직접 사용
      containers:
        - name: fluent-bit
          image: fluent/fluent-bit:3
          volumeMounts:
            - name: varlog
              mountPath: /var/log
              readOnly: true
            - name: containers
              mountPath: /var/lib/docker/containers
              readOnly: true
      volumes:
        - name: varlog
          hostPath: { path: /var/log }
        - name: containers
          hostPath: { path: /var/lib/docker/containers }

동작

flowchart TB
    DS[DaemonSet] --> Node1[Node 1]
    DS --> Node2[Node 2]
    DS --> Node3[Node 3]
    Node1 --> P1["Pod (fluent-bit)"]
    Node2 --> P2["Pod (fluent-bit)"]
    Node3 --> P3["Pod (fluent-bit)"]
    Note["새 노드 자동 배포, 제거 자동 회수"]

Node Selector / Tolerations

특정 노드에만 배포:

spec:
  template:
    spec:
      nodeSelector:
        kubernetes.io/os: linux
        accelerator: nvidia-tesla-v100
      tolerations:
        - key: nvidia.com/gpu
          operator: Exists
          effect: NoSchedule

GPU 노드, ARM 노드, edge 노드 등 특화.

흔한 함정

WARNING

  1. Tolerations 누락 = master node, taint 있는 node 에 배치 안 됨. 로그 / 메트릭 누락.
  2. Resource limit 너무 작음 = 트래픽 큰 노드에서 OOM. 노드 크기 비례 큰 limit.
  3. hostNetwork 부주의 = 노드 포트 충돌 가능. 명시적 namespace 분리.
  4. updateStrategy동시 update = 클러스터 전체 동시 재시작 → 일시 log/metric blind. RollingUpdate + maxUnavailable=1.

관련 위키

이 글의 용어 (4개)
[K8s] Deployment: ReplicaSet, rolling update, rollbackkubernetes
정의 Deployment = stateless 워크로드를 위한 컨트롤러. 내부적으로 ReplicaSet 관리 + rolling update / rollback. 계층 | 객체 |…
[K8s] Pod: 컨테이너의 최소 단위, sidecar, lifecyclekubernetes
정의 Pod = K8s 의 가장 작은 배포 단위. 1개 이상의 컨테이너 + 공유 네트워크 + 공유 스토리지. [!IMPORTANT] Pod 는 컨테이너의 wrapping 이 아니…
[Observability] OpenTelemetry: 표준화된 trace/metric/logdevops
정의 OpenTelemetry (OTel) = observability 의 vendor-neutral 표준. CNCF. trace + metric + log 의 SDK + pro…
[Observability] Prometheus: pull 기반 메트릭, PromQLdevops
정의 Prometheus = pull 기반 시계열 metric 시스템. PromQL 로 쿼리. CNCF graduated. 2026 클라우드 네이티브 메트릭 표준. 아키텍처 Pu…

💬 댓글

사이트 검색 / 명령어

검색

스크롤 = 확대/축소 · 드래그 = 이동 · 0 = 원래 크기 · ESC = 닫기