EKS Auto Mode

Node Lifecycle Management

Junseok Oh

Sr. Solutions Architect

Amazon Web Services

노드 가용성 모니터링이 어려운 이유

Block 2: 노드 라이프사이클 & 모니터링

"Auto Mode에서 노드가 갑자기 사라지는데, 왜 사라졌는지 파악하기 어렵습니다"
"Spot 인터럽트인지, Consolidation인지, Drift 교체인지 구분이 안 됩니다"

핵심 과제

  • 노드 종료 원인 가시성 부족 — 왜 이 노드가 사라졌는지 로그 추적 필요
  • Karpenter 이벤트 추적 어려움 — Consolidation, Drift, Expiry 구분 필요
  • Spot 인터럽트 사전 감지 필요 — 2분 경고 내에 Pod 안전 이동
이 블록에서 학습할 내용: 노드 상태 시각화, kubectl 진단, Prometheus 쿼리, Spot 대응, expireAfter 전략, AlertManager 알림 구성

Grafana: EKS Node Monitoring

CPU Requests vs Usage — Karpenter 판단 기준 시각화

kubectl 진단 명령어

노드 상태 및 Karpenter 이벤트 확인

kubectl get nodepools
NAME NODECLASS NODES READY AGE general-purpose default 8 8 5d system default 2 2 5d gpu-workload gpu 0 0 5d
kubectl get nodeclaims -o wide
NAME TYPE ZONE CAP-TYPE NODE READY AGE nc-abc123 m5.xlarge ap-ne-2a on-demand ip-10-0-1-5 True 2h nc-def456 c5.2xlarge ap-ne-2b spot ip-10-0-2-8 True 45m nc-ghi789 m5.2xlarge ap-ne-2c on-demand ip-10-0-3-2 True 3h nc-jkl012 r5.xlarge ap-ne-2a spot ip-10-0-1-9 True 1h
kubectl get nodes -L karpenter.sh/nodepool,karpenter.sh/capacity-type
NAME STATUS ROLES AGE NODEPOOL CAPACITY-TYPE ip-10-0-1-5 Ready 2h general-purpose on-demand ip-10-0-2-8 Ready 45m general-purpose spot ip-10-0-3-2 Ready 3h general-purpose on-demand ip-10-0-1-9 Ready 1h general-purpose spot
kubectl get events --sort-by='.lastTimestamp' | grep karpenter
12m Normal Launched karpenter nodeclaim/nc-abc123 Launched node ip-10-0-1-5 10m Normal Registered karpenter nodeclaim/nc-abc123 Registered node 5m Normal Consolidating karpenter nodeclaim/nc-xyz789 Consolidating node (underutilized) 3m Warning SpotInterrupted karpenter nodeclaim/nc-old123 Spot instance interrupted 2m Normal Drifted karpenter nodeclaim/nc-def456 NodeClass changed
kubectl get pods -A --field-selector=status.phase=Pending
NAMESPACE NAME READY STATUS AGE default web-app-7d9f8b6c5-xyz 0/1 Pending 2m production api-server-5c8d7e-abc 0/1 Pending 1m monitoring prometheus-0 0/1 Pending 30s

Prometheus 쿼리: 노드 모니터링

핵심 Karpenter 메트릭 쿼리

karpenter_cluster_state_node_count

클러스터 내 현재 노드 수 추적

general-purpose
8
system
2
gpu-workload
0
karpenter_pods_state{phase="Pending"}

스케줄 대기 중인 Pod 수 (프로비저닝 필요 신호)

Current
3
Alert 조건: karpenter_pods_state{phase="Pending"} > 10 for 5m
count(karpenter_pods_state{capacity_type="spot"}) / count(karpenter_pods_state) * 100

전체 중 Spot 인스턴스 비율 (pods_state의 capacity_type 라벨 활용)

Spot 비율
40%
60%
On-Demand
40%
Spot
histogram_quantile(0.99, rate(karpenter_pods_startup_duration_seconds_bucket[5m]))

Pod 생성~Running까지 P99 지연 시간 (노드 프로비저닝 포함)

P50
45s
P90
72s
P99
98s
📖 더 알아보기: PromQL 분석 패턴

Spot 인터럽트 시뮬레이션

EventBridge → SQS → Karpenter → Pod 퇴거 → 재스케줄링 전체 플로우

Spot Overprovisioning 전략

Pause 컨테이너로 사전 용량 확보 — 즉시 스케줄링

Phase 1
Buffer Ready
Dummy pods가 용량 예약
Phase 2
Real Workload 도착
Dummy 삭제 → 워크로드 즉시 스케줄링
Phase 3
Karpenter 보충
Pending dummy (AntiAffinity) → 새 노드 프로비저닝 → 버퍼 복원
Dummy Workload Pending Node
apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: overprovisioning value: -1 # 가장 낮은 우선순위 globalDefault: false description: "Overprovisioning placeholder pods"
apiVersion: apps/v1 kind: Deployment metadata: name: overprovisioning spec: replicas: 2 # 노드당 1개씩 분산 배치 selector: matchLabels: app: overprovisioning template: metadata: labels: app: overprovisioning spec: priorityClassName: overprovisioning terminationGracePeriodSeconds: 0 affinity: # 같은 노드 배치 방지 podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchLabels: app: overprovisioning topologyKey: kubernetes.io/hostname containers: - name: pause image: registry.k8s.io/pause:3.9 resources: requests: cpu: "1" memory: "2Gi"
핵심 원리
value: -1 → 가장 낮은 우선순위
실제 워크로드 도착 시 Dummy pod가 즉시 Preempt → 노드 대기 없이 스케줄링
📖 더 알아보기: Spot 노드 활용 전략

expireAfter 전략 비교

환경별 노드 최대 수명 설정

168h
24h 48h 72h 168h 240h 336h

프로덕션 권장

안정성과 보안 패치 속도의 균형

보안 패치 속도
안정성

NodePool YAML

apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: general-purpose spec: template: spec: # 프로덕션 권장 값 expireAfter: 168h # 7일 disruption: consolidationPolicy: WhenEmptyOrUnderutilized consolidateAfter: 1m
📖 더 알아보기: 노드 생명주기 관리

AMI 업데이트 & Drift 감지

NodeClass 변경 시 자동 노드 교체 흐름

AL2023 vs Bottlerocket 비교

특성 AL2023 Bottlerocket
부팅 시간 40-60초 20-30초
보안 표준 강화 (immutable)
SSH 접근 가능 제한적
권장 사용처 디버깅 필요 환경 프로덕션, 보안 중요
📖 더 알아보기: Consolidation & Drift 동작 이해

AlertManager 알림 규칙

Karpenter 및 노드 상태 알림 구성

PrometheusRule YAML

apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: karpenter-alerts spec: groups: - name: karpenter rules: # Selected alerts will appear here
📖 더 알아보기: 관측성 알림 구성 가이드

Day-2 운영 체크리스트

EKS Auto Mode 운영 준비 상태 점검

Disruption & 안정성

  • Disruption Budget 설정 완료
    # NodePool spec: disruption: budgets: - nodes: "10%"
  • PodDisruptionBudget 적용
    apiVersion: policy/v1 kind: PodDisruptionBudget spec: minAvailable: 1 selector: matchLabels: app: my-app
  • Spot 인터럽트 알림 구성
    # PrometheusRule - alert: SpotInterruptionRate expr: increase(karpenter_nodeclaims_terminated_total {reason="SpotInterruption"}[1h]) > 3
  • expireAfter 정책 설정
    # NodePool spec: template: spec: expireAfter: 168h # 7일
  • 노드 모니터링 대시보드 구축
    # Grafana 대시보드 핵심 패널 karpenter_cluster_state_node_count karpenter_pods_state{phase="Pending"} karpenter_nodes_allocatable

최적화 & 비용

  • AMI 업데이트 자동화
    # NodeClass spec: amiSelectorTerms: - alias: bottlerocket@latest
  • 비용 태깅 (CostCenter, Team)
    # NodePool spec: template: metadata: labels: CostCenter: "engineering" Team: "platform"
  • Multi-AZ 배포 확인
    # NodePool requirements - key: topology.kubernetes.io/zone operator: In values: [ap-northeast-2a, 2b, 2c]
  • Topology Spread Constraints 적용
    # Pod spec topologySpreadConstraints: - maxSkew: 1 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: DoNotSchedule
  • 정기 비용 리뷰 스케줄
    # CronJob으로 비용 리포트 자동화 schedule: "0 9 * * MON" # 매주 월요일 image: kubecost/cost-analyzer
Tip: 항목을 클릭하면 관련 YAML 설정을 확인할 수 있습니다. 모든 항목을 점검 후 프로덕션 배포를 진행하세요.
📖 더 알아보기: Auto Mode Day-2 운영 가이드

Block 2 요약 & 퀴즈

노드 라이프사이클 & 모니터링 핵심 내용 정리

노드 모니터링

kubectl, Prometheus 쿼리로 노드 상태 및 이벤트 추적

Spot 대응

2분 경고 내 Pod 안전 이동, PDB 준수

운영 전략

expireAfter, Drift, AlertManager 알림

1. Spot 인스턴스 종료 전 경고 시간은?
2. 프로덕션 환경의 권장 expireAfter 값은?
3. 노드 종료 원인을 파악할 수 있는 kubectl 명령은?

Thank You

Block 2 — 노드 라이프사이클 & 모니터링 완료

← 목차로 돌아가기 다음: Block 3 →