Priority Classes
Kubernetes Priority Classes는 클러스터 리소스가 부족할 때 어떤 파드를 먼저 스케줄링하고 유지할지를 결정합니다. Lumie 플랫폼은 세 단계의 우선순위 계층으로 워크로드를 분류합니다.
우선순위 계층
클래스 목록
| 클래스 이름 | 값 | 기본값 | 대상 워크로드 |
|---|---|---|---|
high-priority | 1000 | false | ArgoCD, CNPG, Vault, MinIO |
medium-priority | 500 | false | Thanos, Prometheus, Loki, Tempo |
low-priority | 100 | true | 그 외 모든 애플리케이션 |
low-priority가 globalDefault: true로 설정되어 있어, priorityClassName을 명시하지 않은 파드는 자동으로 우선순위 100을 가집니다.
매니페스트
# High Priority (1000) - 중요 인프라
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000
globalDefault: false
description: "High priority for critical infrastructure"
---
# Medium Priority (500) - 관측성 스택
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: medium-priority
value: 500
globalDefault: false
description: "Medium priority for observability stack"
---
# Low Priority (100) - 그 외 모든 워크로드
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: low-priority
value: 100
globalDefault: true
description: "Low priority for all other applications"
동작 원리
선점(Preemption)
클러스터 리소스가 부족할 때 높은 우선순위의 파드가 스케줄링 대기 중이면, Kubernetes 스케줄러는 낮은 우선순위의 파드를 축출(evict)하여 리소스를 확보합니다.
예를 들어, high-priority 파드가 pending 상태일 때 노드에 리소스가 없으면, low-priority 파드가 먼저 축출됩니다.
스케줄링 우선순위
같은 리소스 요청을 가진 파드가 여러 개 대기 중일 때, 우선순위 값이 높은 파드가 먼저 스케줄링됩니다.
사용법
파드 또는 디플로이먼트 스펙에 priorityClassName을 명시합니다:
# 중요 인프라 컴포넌트 예시
spec:
priorityClassName: high-priority
containers:
- name: vault
image: zot.lumie-infra.com/library/vault:1.18.4
# 관측성 스택 예시
spec:
priorityClassName: medium-priority
containers:
- name: prometheus
image: zot.lumie-infra.com/library/prometheus:v3.3.0
# 일반 애플리케이션 — priorityClassName 생략 시 low-priority 자동 적용
spec:
containers:
- name: lumie-backend
image: zot.lumie-infra.com/lumie/backend:latest
ArgoCD 배포
Priority Classes는 단순 매니페스트로 구성되어 있어 Helm 없이 직접 경로를 소스로 사용합니다:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: priority-classes
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/Lumie-Edu/lumie-infra.git
targetRevision: main
path: platform/priority-classes/manifests
destination:
server: https://kubernetes.default.svc
syncPolicy:
automated:
prune: true
selfHeal: true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
destination.namespace를 지정하지 않는 것에 주의하세요. PriorityClass는 클러스터 스코프 리소스로 특정 네임스페이스에 속하지 않습니다.
운영 지침
새 워크로드 분류 기준
| 유형 | 권장 클래스 |
|---|---|
| 데이터 손실 위험이 있는 스토리지/DB 컨트롤러 | high-priority |
| 플랫폼 가시성에 필요한 모니터링 컴포넌트 | medium-priority |
| 애플리케이션 서비스, 워커, 배치 잡 | low-priority (기본) |
주의 사항
high-priority를 남용하면 우선순위 계층의 의미가 퇴색됩니다. 실제로 다른 워크로드보다 먼저 복구되어야 할 컴포넌트에만 사용하세요.- 우선순위 클래스는
scheduling.k8s.io/v1API로 관리되며 Kubernetes 클러스터 전역에 적용됩니다. prune: true설정으로 매니페스트에서 제거된 클래스는 ArgoCD가 자동으로 삭제합니다. 클래스를 제거하기 전에 해당 클래스를 사용하는 파드가 없는지 반드시 확인하세요.