Kubernetes DaemonSet 완벽 가이드! Node 단위 Application 배포 구조 이해하기

Kubernetes 환경에서는 Application 종류에 따라 다양한 배포 방식이 필요합니다.

일반적인 Web Application은 Deployment를 사용하여 여러 개의 Pod를 실행하고 관리합니다.

하지만 모든 Node에서 반드시 하나씩 실행되어야 하는 Application도 존재합니다.

예를 들어 Log 수집 Agent, Monitoring Agent, Security Agent 같은 시스템 Component는 Cluster 내부 모든 Node에서 실행되어야 합니다.

이러한 경우 Deployment 방식으로 관리하면 Node 추가나 삭제 시 원하는 구조를 유지하기 어렵습니다.

Kubernetes에서는 이러한 요구사항을 해결하기 위해 DaemonSet 기능을 제공합니다.

DaemonSet은 Kubernetes Cluster의 모든 Node 또는 특정 Node에 하나의 Pod를 자동으로 실행하고 관리하는 Controller입니다.

구성 요소역할
DaemonSetNode 단위 Pod 관리
NodePod 실행 대상
PodAgent Application 실행
Controller상태 유지 관리

DaemonSet 구조를 이해하면 Kubernetes Cluster 전체에 필요한 시스템 Application을 안정적으로 배포하는 방법을 이해할 수 있습니다.

Kubernetes DaemonSet이란 무엇인가?

DaemonSet은 Kubernetes에서 모든 Node에 동일한 Pod를 하나씩 실행하기 위한 Controller입니다.

Deployment가 Application Replica 개수를 기준으로 관리한다면 DaemonSet은 Node 개수를 기준으로 관리합니다.

Deployment:

Replica 3개 설정

Pod 3개 실행

DaemonSet:

Node 5개 존재

Pod 5개 자동 생성

각 Node에 하나씩 배치

Cluster Node마다 반드시 필요한 Application 운영에 적합합니다.

Kubernetes DaemonSet이 필요한 이유

서버 운영 환경에서는 모든 Node에서 실행되어야 하는 서비스가 있습니다.

대표적인 예:

Application목적
Log AgentNode Log 수집
Monitoring Agent서버 상태 확인
Security Agent보안 검사
Network PluginContainer Network 관리

이러한 Application은 특정 개수의 Replica보다 모든 Node 존재 여부가 중요합니다.

Kubernetes DaemonSet 동작 구조

DaemonSet Controller는 Cluster Node 상태를 확인하고 필요한 Pod를 자동 생성합니다.

구조:

구성 요소역할
DaemonSet ControllerPod 관리
Node실행 위치
PodAgent 실행
Scheduler배치 관리

동작 과정:

단계내용
1단계DaemonSet 생성
2단계Node 확인
3단계각 Node Pod 생성
4단계Node 추가 시 Pod 자동 생성
5단계Node 제거 시 Pod 정리

Node 변화에 따라 자동으로 상태를 유지합니다.

Kubernetes DaemonSet과 Deployment 차이

두 Controller는 관리 기준이 다릅니다.

구분DaemonSetDeployment
기준Node 개수Replica 개수
목적Node별 실행서비스 운영
배치 방식Node마다 하나필요 개수만큼
대표 사용AgentWeb Application

Application 목적에 따라 선택해야 합니다.

Kubernetes DaemonSet Pod 배치 방식

DaemonSet은 기본적으로 모든 Node에 Pod를 배치합니다.

예:

Worker Node 1

Log Agent Pod

Worker Node 2

Log Agent Pod

Worker Node 3

Log Agent Pod

모든 Node에서 동일한 기능을 수행합니다.

Kubernetes DaemonSet과 Node 추가

Cluster에 새로운 Node가 추가되면 DaemonSet은 자동으로 Pod를 생성합니다.

과정:

새로운 Worker Node 추가

DaemonSet Controller 감지

Pod 생성

Agent 실행

운영자가 직접 Pod를 배치할 필요가 없습니다.

Kubernetes DaemonSet과 Node 삭제

Node가 제거되면 해당 Node의 DaemonSet Pod도 함께 정리됩니다.

구조:

Node 제거

Pod 종료

Cluster 상태 업데이트

자동으로 원하는 상태를 유지합니다.

Kubernetes DaemonSet NodeSelector 활용

DaemonSet은 특정 Node에만 Pod를 배치할 수도 있습니다.

예:

GPU Node

GPU Monitoring Agent 실행

Storage Node

Storage 관리 Agent 실행

NodeSelector를 사용하면 원하는 Node 그룹에만 배포할 수 있습니다.

Kubernetes DaemonSet Toleration 활용

Taint가 설정된 Node에도 DaemonSet Pod를 실행할 수 있습니다.

예:

Master Node

Taint 설정

DaemonSet Toleration 적용

Monitoring Agent 실행

Cluster 관리 Component에서 많이 사용됩니다.

Kubernetes DaemonSet 활용 사례

DaemonSet은 시스템 관리 영역에서 많이 사용됩니다.

활용 사례설명
Fluent BitLog 수집
Prometheus Node ExporterMetric 수집
CNI PluginNetwork 관리
Security Agent보안 검사

Kubernetes 운영 환경의 필수 Component입니다.

Kubernetes DaemonSet Rolling Update

DaemonSet도 Application Version 변경을 지원합니다.

업데이트 방식:

기존 Pod

새로운 Version Pod 생성

기존 Pod 제거

Node별로 순차 업데이트가 진행됩니다.

Kubernetes DaemonSet 운영 시 고려사항

Production 환경에서는 Resource 관리가 중요합니다.

항목설명
Resource LimitNode 영향 관리
Node 선택배포 대상 관리
Update 전략서비스 영향 최소화
MonitoringAgent 상태 확인

잘못된 DaemonSet 설정은 전체 Cluster 성능에 영향을 줄 수 있습니다.

Kubernetes DaemonSet 장점

장점설명
자동 배포Node별 Pod 관리
확장 대응Node 추가 자동 처리
운영 자동화Agent 관리 편리
일관성 유지전체 Node 동일 구성

DaemonSet은 Kubernetes Cluster 운영 관리에 필수적인 Controller입니다.

자주 묻는 질문

DaemonSet과 Deployment 차이는 무엇인가요?

Deployment는 필요한 Replica 수만큼 Pod를 실행하고 DaemonSet은 Node마다 하나씩 Pod를 실행합니다.

DaemonSet도 Scaling이 필요한가요?

DaemonSet은 Replica 개수가 아니라 Node 개수에 따라 자동으로 증가합니다.

DaemonSet은 어디에 많이 사용되나요?

Log 수집, Monitoring, Network Plugin 같은 Node 단위 작업에 많이 사용됩니다.

마무리

Kubernetes DaemonSet은 Cluster 모든 Node에 필요한 Application을 자동 배포하고 관리하는 핵심 Controller입니다.

구성 요소역할
DaemonSetNode별 Pod 관리
Node실행 대상
PodAgent 실행
Controller상태 유지

DaemonSet 구조를 이해하면 Kubernetes 환경에서 Monitoring, Logging, Security 같은 운영 Component를 효율적으로 관리할 수 있습니다.

다음 글에서는 Kubernetes Horizontal Pod Autoscaler(HPA) 완벽 가이드! CPU·Memory 기반 Pod 자동 Scaling 구조 이해하기를 알아보겠습니다.

댓글 남기기