From 497c37b44b0600ccc7225599ccbb3eb3a4934e24 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 11 Nov 2026 23:39:23 +0900 Subject: [PATCH] fix(traefik): give the ingress controller requests and a memory limit The k3s-bundled Traefik runs with no requests or limits, so it is a BestEffort pod. The kubelet on this node has no memory eviction threshold (the k3s default evictionHard only covers nodefs and imagefs), so under memory pressure the kernel OOM killer chooses, and BestEffort containers have oom_score_adj 1000. Every public route goes through this one pod. Set requests cpu 50m / memory 64Mi and a 256Mi memory limit in the base and in both overlay patches, because the baseline and trust patches replace valuesContent as a whole. No CPU limit, to avoid throttling. Measured use on 2026-11-11 was about 5m CPU and 42Mi memory. Rejected: raising Traefik to Guaranteed. It would reserve CPU the ingress does not use, and the real fix for memory pressure is kubelet reservation and eviction thresholds, which need a k3s restart. Risk: applying the trust overlay makes the k3s helm-controller roll Traefik once (RollingUpdate, a few seconds). Not applied here. Verification (desktop): - infrastructure/networking/traefik/scripts/validate.sh passes. - kubectl diff of the trust overlay against the live HelmChartConfig adds only the resources block. - baseline and observe renders both contain the same resources. --- infrastructure/networking/traefik/README.md | 9 +++++++++ .../networking/traefik/base/helm-chart-config.yaml | 6 ++++++ .../overlays/baseline/service-boundary-only-patch.yaml | 6 ++++++ .../traefik/overlays/trust/trusted-proxy-cidr-patch.yaml | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/infrastructure/networking/traefik/README.md b/infrastructure/networking/traefik/README.md index d9606d4..3901fa9 100644 --- a/infrastructure/networking/traefik/README.md +++ b/infrastructure/networking/traefik/README.md @@ -101,6 +101,15 @@ infrastructure/networking/traefik/ 세 overlay는 모두 Service `NodePort`, `externalTrafficPolicy: Cluster`와 `30080/30443`을 명시적으로 소유한다. +세 overlay는 같은 `resources`도 소유한다: requests `cpu: 50m`·`memory: 64Mi`, +limit `memory: 256Mi`, CPU limit 없음. k3s 기본 Traefik은 requests·limits가 없는 +BestEffort다. 이 노드의 kubelet에는 메모리 축출 문턱이 없어(k3s 기본 `evictionHard`는 +디스크 두 항목뿐) 메모리가 모자라면 커널 OOM killer가 고르는데, BestEffort 컨테이너는 +`oom_score_adj` 1000이라 가장 먼저 죽는다. 모든 공개 경로가 Traefik 하나를 지나므로 +Burstable로 올린다. 2026-11-11 실측 사용량은 CPU 약 5m, +메모리 약 42Mi다. CPU limit은 throttling을 피하려고 두지 않는다. overlay 둘이 +`valuesContent`를 통째로 바꾸므로 값을 바꿀 때는 base와 두 patch를 함께 고친다. + - `baseline`: Service 경계만 남긴다. access log와 forwarded-header trust는 없다. - `observe`: Service 경계와 header를 버리는 JSON access log를 적용한다. trust는 없다. - `trust`: observe 설정에 `web.forwardedHeaders.trustedIPs=10.42.0.1/32`만 추가한다. diff --git a/infrastructure/networking/traefik/base/helm-chart-config.yaml b/infrastructure/networking/traefik/base/helm-chart-config.yaml index 7f778c6..172a8f3 100644 --- a/infrastructure/networking/traefik/base/helm-chart-config.yaml +++ b/infrastructure/networking/traefik/base/helm-chart-config.yaml @@ -14,6 +14,12 @@ spec: prometheus.io/path: /metrics prometheus.io/port: "9100" prometheus.io/scrape: "true" + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 256Mi service: spec: type: NodePort diff --git a/infrastructure/networking/traefik/overlays/baseline/service-boundary-only-patch.yaml b/infrastructure/networking/traefik/overlays/baseline/service-boundary-only-patch.yaml index 1f5d5de..12169ae 100644 --- a/infrastructure/networking/traefik/overlays/baseline/service-boundary-only-patch.yaml +++ b/infrastructure/networking/traefik/overlays/baseline/service-boundary-only-patch.yaml @@ -6,6 +6,12 @@ prometheus.io/path: /metrics prometheus.io/port: "9100" prometheus.io/scrape: "true" + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 256Mi service: spec: type: NodePort diff --git a/infrastructure/networking/traefik/overlays/trust/trusted-proxy-cidr-patch.yaml b/infrastructure/networking/traefik/overlays/trust/trusted-proxy-cidr-patch.yaml index df422a3..8eddf3c 100644 --- a/infrastructure/networking/traefik/overlays/trust/trusted-proxy-cidr-patch.yaml +++ b/infrastructure/networking/traefik/overlays/trust/trusted-proxy-cidr-patch.yaml @@ -6,6 +6,12 @@ prometheus.io/path: /metrics prometheus.io/port: "9100" prometheus.io/scrape: "true" + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 256Mi service: spec: type: NodePort