diff --git a/services/priority-classes/README.md b/services/priority-classes/README.md new file mode 100644 index 0000000..26eb2dc --- /dev/null +++ b/services/priority-classes/README.md @@ -0,0 +1,20 @@ +# 플랫폼 PriorityClass + +노드가 한 대라 자원이 모자라면 kubelet이 파드를 내보낸다. 내보낼 순서는 requests를 넘었는지, +그다음 우선순위로 정한다. 2026-11-09 디스크 축출 때 플랫폼 파드는 모두 우선순위 0이라 tech-log +운영 파드가 Grafana·kube-state-metrics와 같은 순위로 나갔다. + +| 이름 | 값 | 선점 | 붙일 곳 | +| --- | --- | --- | --- | +| `platform-critical` | 1000000 | 낮은 것을 선점 | platform-postgres, Gitea, Keycloak, tech-log | +| `platform-low` | -1000 | 선점 안 함 | Grafana, pgAdmin, Loki, Tempo | + +- 아무것도 안 붙인 파드는 기본값 0이다. 시스템 클래스(`system-*`, 20억)는 그대로 가장 높다. +- `globalDefault`는 둘 다 끈다. 새 파드가 모르게 우선순위를 얻지 않게 하려는 것이다. +- 클래스를 만드는 것은 아무 파드도 바꾸지 않는다. **붙이는 것은 파드 재시작을 부르므로** + k3s 재시작 창에 한다(`infrastructure/host/k3s/README.md`). + +```sh +kubectl apply -k services/priority-classes +kubectl get priorityclass platform-critical platform-low +``` diff --git a/services/priority-classes/kustomization.yaml b/services/priority-classes/kustomization.yaml new file mode 100644 index 0000000..8ba8781 --- /dev/null +++ b/services/priority-classes/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - priority-classes.yaml diff --git a/services/priority-classes/priority-classes.yaml b/services/priority-classes/priority-classes.yaml new file mode 100644 index 0000000..38f87ea --- /dev/null +++ b/services/priority-classes/priority-classes.yaml @@ -0,0 +1,25 @@ +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: platform-critical + labels: + app.kubernetes.io/part-of: platform +value: 1000000 +globalDefault: false +preemptionPolicy: PreemptLowerPriority +description: >- + Stateful platform services and production workloads that other services depend on + (platform-postgres, Gitea, Keycloak, tech-log). Evicted after everything else. +--- +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: platform-low + labels: + app.kubernetes.io/part-of: platform +value: -1000 +globalDefault: false +preemptionPolicy: Never +description: >- + Tools whose loss does not stop a user-facing service (Grafana, pgAdmin, Loki, Tempo). + Evicted first and never preempts another pod.