Files
platform-core/infrastructure/host/k3s/server/audit.yaml
T
DongHyeonka e88725aab8 feat(host): add the k3s kubelet, audit and pod security drop-ins
The kubelet has no memory eviction threshold and no reservations, so
under memory pressure the kernel OOM killer picks a victim and
Postgres (oom_score_adj 985) is near the front. The API server writes
no audit log. Namespaces without labels have no Pod Security level, and
graceful node shutdown is off.

Add the files for one k3s restart: a kubelet drop-in (system 1 CPU/2Gi,
kube 0.5 CPU/1Gi, hard eviction memory 500Mi plus the two k3s disk
defaults, soft eviction 1Gi for 1m, shutdown 60s/20s), an API server
drop-in that appends the audit and admission-config flags, a Metadata
audit policy and a cluster Pod Security default (baseline, warn and
audit restricted, kube-system exempt).

Rejected: protect-kernel-defaults, recommended in review 7.3. CIS
dropped it in v1.7, and the sysctls it requires include
kernel.panic_on_oops=1, which reboots this dual-boot desktop on any
kernel oops; a reboot started the 2026-11-11 clock incident. The README
records the reason.

Risk: nothing is installed by this commit. The kubelet merges the
drop-in after k3s's 00-k3s-defaults.conf (k3s passes only --config-dir);
evictionHard lists all three keys because setting the map zeroes the
others.

Verification: the apply script's --check parses every file and asserts
the invariants (next commit).
2026-11-12 00:49:58 +09:00

29 lines
704 B
YAML

# Installed as /var/lib/rancher/k3s/server/audit.yaml (mode 0600).
# Metadata level only: who did what to which object, never request or
# response bodies, so Secret values are not written to the log.
apiVersion: audit.k8s.io/v1
kind: Policy
omitStages:
- RequestReceived
rules:
# High-volume, low-value traffic.
- level: None
resources:
- group: coordination.k8s.io
resources: ["leases"]
- level: None
resources:
- group: ""
resources: ["events"]
- level: None
nonResourceURLs:
- /healthz*
- /livez*
- /readyz*
- /version
- /metrics
- level: None
users: ["system:kube-proxy"]
verbs: ["watch"]
- level: Metadata