Repository navigation
Commit baea2bf
fix(openshell): inject AppArmor unconfined annotation on sandbox pods
The openshell sandbox `agent` container needs to call mount(2) with
MS_SHARED to set up its own network namespace via `ip netns`. The
default containerd AppArmor profile (`cri-containerd.apparmor.d`)
denies `mount` outright, regardless of CAP_SYS_ADMIN — AppArmor
blocks the syscall before the kernel's capability check. Without
this, the pod CrashLoops with:
mount --make-shared /run/netns failed: Permission denied
(See issue #310 for the full diagnostic history.)
Pod-spec `securityContext.appArmorProfile.type: Unconfined` SHOULD
work but doesn't always propagate through containerd —
kubernetes/kubernetes#125069. The legacy
annotation form (`container.apparmor.security.beta.kubernetes.io/<name>`)
does work.
Add a Kyverno ClusterPolicy that mutates sandbox pods at admission to
inject this annotation. Selector is narrow:
- Namespace: openshell
- ownerReferences contains kind=Sandbox (excludes the gateway
StatefulSet pod and any unrelated pods in the namespace)
- The pod has a container literally named `agent`
Live-tested against the cluster before commit. New sandbox pod ran
to Ready=true with 0 restarts on first try; AgentHarness reached
Ready=True with reason=SandboxReady.
Remove this policy when one of these lands upstream:
- openshell ships NetworkMode::Platform (skips netns creation
entirely) — NVIDIA/OpenShell#899
- sigs.k8s.io/agent-sandbox propagates runtimeClassName so we can
pin sandbox pods to a less restrictive runtime (e.g. crun)
- kubelet/containerd honor the pod-level appArmorProfile field
Closes #310.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 91af407 commit baea2bf
1 file changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments