Files
nvke/controller/profiles/README.md
Abhay Krishna 48dc309320 fix(chart): run the controller as an unprivileged user (#1874)
The chart defaulted podSecurityContext.runAsNonRoot to true, but the
controller image had no USER and the chart set no runAsUser, so the
kubelet would refuse to start the pod. Every deploy path worked around
it by setting podSecurityContext to null and turning the read-only root
filesystem off, which ran the controller as root everywhere. That
contradicted controller/SECURITY.md, which assumes the chart's non-root
and read-only-root settings are enforced.

The image now declares USER 65532:65532. The chart sets the same uid
explicitly, with runAsGroup, fsGroup and the RuntimeDefault seccomp
profile, and the container drops every capability and disallows
privilege escalation. Setting the uid in the chart rather than relying
on the image covers the materialize-profiles init container too, whose
operator-built content image usually has no USER. That init container
now copies with cp -R, since an unprivileged cp -a fails to preserve
the image's root ownership on every file, and it takes the controller
container's securityContext, so it too drops every capability and runs
on a read-only root.

The overrides come out of the nvkectl bootstrap values and the
deploy/nico, capd-e2e and capnico-e2e overlays. Tilt keeps running as
root on a writable root filesystem: live_update syncs the binary into
/usr/local/bin in the running container, which uid 65532 on a read-only
root would refuse.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-21 15:51:08 -07:00

1.8 KiB

Supply config profiles to the controller

Start with the example

example/ is a self-contained bundle. It contains a worker config profile, a runbook, and the Dockerfile needed to package them.

The controller does not load profiles from this directory when deployed. Copy the example to a separate repository or another location outside nke/controller, then replace every REPLACE_* value for your environment:

cp -R controller/profiles/example ../controller-profiles
cd ../controller-profiles
grep -R 'REPLACE_' .

Confirm that no placeholders remain before building:

test -z "$(grep -R 'REPLACE_' .)"

The copied bundle has this layout:

controller-profiles/
├── Dockerfile
├── profiles/
│   └── configProfiles/
└── runbooks/

Customize or add profiles while preserving this layout.

Build the content image

Build and push the content image to a registry accessible from the target cluster:

docker build -t ghcr.io/example/controller-profiles:v1 .
docker push ghcr.io/example/controller-profiles:v1

Configure the controller

Configure the controller Helm chart to consume the image:

profiles:
  path: /profiles
  image:
    enabled: true
    repository: ghcr.io/example/controller-profiles
    tag: v1

spiffe:
  enabled: false

The chart's materialize-profiles init container copies /profiles from the content image into the directory the controller reads. It runs as the chart's unprivileged uid, so the files under /profiles must be world-readable, as a plain COPY leaves them. If the registry is private, also configure imagePullSecrets with credentials that can pull the image. This example uses plaintext controller-to-agent transport for evaluation; configure SPIFFE before using it in production.