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 31f5438d36

View file

@ -22,14 +22,14 @@ A service gets manifests on the host whose configuration deploys it:
| service | workload | other objects |
| ------------------------- | ---------- | ------------------------------------------------------------------------------------------ |
| `swarm-controller` | Deployment | ServiceAccount, ConfigMap `swarm-controller-etc`; Service, NetworkPolicy with the listener |
| `swarm-nats` | Deployment | ServiceAccount, two Services, NetworkPolicy, PersistentVolume and Claim |
| `swarm-notify-router` | Deployment | ServiceAccount |
| `swarm-stt` | Deployment | ServiceAccount, NetworkPolicy `swarm-stt` |
| `swarm-review-classifier` | Deployment | ServiceAccount |
| `swarm-claude-login` | Deployment | ServiceAccount |
| `swarm-ci-metrics` | CronJob | ServiceAccount, PersistentVolumeClaim `swarm-ci-metrics-state` |
`namespace.yaml` holds the Namespace. NATS with its auth responder has no
manifests yet: its image doesn't exist yet.
`namespace.yaml` holds the Namespace ([Pod Security](#pod-security)).
## One source: the unit
@ -156,6 +156,23 @@ credential directory.
- **Rollout:** each Deployment has one replica and the `Recreate` strategy,
because each service runs once per swarm.
## Pod Security
`namespace.yaml` labels the namespace with the `restricted` level of Pod
Security for `enforce`, `warn` and `audit`. The API server refuses a pod that
breaks the level: a host port, a host namespace or path, root, a kept
capability or privilege escalation, or no seccomp profile. A Deployment that
would make such a pod gets a warning on apply, and its pods fail to start, so a
drifted workload shows as a Deployment with no ready replica. The security
settings of [Pods](#pods) are what the level asks for, and no pod needs a
`hostPort`: the controller's port and the queue's exporter are ClusterIP
Services, and the queue's client port is a `LoadBalancer` Service that k3s's
service load balancer binds on the node from `kube-system`, which the label
doesn't cover. The level follows the cluster's Kubernetes version, so an
upgrade can tighten it. `module-eval-k8s` reads every rendered pod against the
level's rules, and the VM test `k8s-controller-switch` shows the API server
refusing a pod with a host port, a kept capability or privilege.
## The store login
A service that has a role at the store's `jwt-k8s` auth mount