Repository navigation
fix(k8s): replace privileged DinD with rootless DinD - #2044
Conversation
The DinD sidecar ran with securityContext.privileged: true, granting full host kernel access and enabling trivial container escape via nsenter. Switch to rootless Docker-in-Docker to eliminate that attack surface while preserving the nested k3s sandbox architecture. Changes: - Image: docker:24-dind → docker:24-dind-rootless - Security context: privileged: true replaced with non-root UID 1000, drop-all capabilities, selective add (SETUID, SETGID, SETFCAP, NET_ADMIN, NET_RAW), Unconfined seccomp for rootlesskit user-ns setup - Remove command override — let the rootless entrypoint handle dockerd-rootless.sh / rootlesskit startup - Volume paths updated for rootless user home: /var/lib/docker → /home/rootless/.local/share/docker /var/run → /run/user/1000 /etc/docker → /home/rootless/.config/docker - Workspace DOCKER_HOST updated to rootless socket path - Workspace drops unused docker-config mount - Init container writes daemon.json to rootless config path - Pod-level: add fsGroup: 1000, RuntimeDefault seccomp baseline - Rootlesskit env vars: DOCKERD_ROOTLESS_ROOTLESSKIT_NET=host (use pod network, not isolated slirp4netns) and --propagation=rslave (mount propagation for k3s volume mounts) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughReplaced privileged Docker-in-Docker with rootless DinD in the Kubernetes Pod manifest and adjusted securityContext, mounts, env vars, and sockets; plus a small robustness fix in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
verifyGatewayContainerRunning() called .trim() directly on result.stdout, but spawnSync returns a Buffer (not a string) when no encoding option is passed. Buffer is truthy so the || "" fallback never fires, and Buffer has no .trim() method — causing a TypeError on every re-onboard that hits an existing gateway container. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Squashed PR #2044 as base for socket proxy work. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Take main's String() wrapper over PR's .toString() since both fix the same stdout coercion and main's landed first.
Summary
k8s/nemoclaw-k8s.yamlwith rootless Docker-in-Docker (docker:24-dind-rootless), eliminating trivial host escape viansenterDOCKERD_ROOTLESS_ROOTLESSKIT_NET=host,--propagation=rslave) to ensure k3s networking and mount propagation work inside the podSecurity changes
privileged: trueprivileged: false, UID 1000,runAsNonRoot: truefsGroup: 1000for emptyDir volume ownershipKnown limitations of rootless DinD
--net=hostfor inner containersTest plan
kubectl exec -it nemoclaw -c dind -- nsenter --target 1 --mount --uts --ipc --net --pid -- bash→ "Operation not permitted"kubectl exec -it nemoclaw -c workspace -- docker info🤖 Generated with Claude Code
Summary by CodeRabbit