Watch
0
0
Fork
You've already forked hyperhive
0

k8s: the hyperhive namespace enforces pod security restricted

No pod in the namespace has a hostPort any more, and the census found nothing else that restricted refuses. The namespace now carries the restricted level for enforce, warn and audit, so the API server refuses a pod that drifts. The bao-login test's probe pods get the container security context restricted asks for. The controller switch test shows the API server admitting a compliant pod and refusing the same pod with a host port, a kept capability or privilege.
This commit is contained in:
atlas 2026-11-23 19:32:16 +01:00 • committed by maia
commit 51565fdba6

View file

@ -1098,7 +1098,15 @@ in
kind = "Namespace";
metadata = {
name = k8sCfg.namespace;
labels."app.kubernetes.io/part-of" = "hyperhive";
labels = {
"app.kubernetes.io/part-of" = "hyperhive";
# The API server refuses a pod that breaks Pod Security `restricted` (a
# host port, root, a kept capability, ...), and warns on and audits a
# workload whose pods would. The level is the cluster's own version.
"pod-security.kubernetes.io/enforce" = "restricted";
"pod-security.kubernetes.io/warn" = "restricted";
"pod-security.kubernetes.io/audit" = "restricted";
};
};
};
}