Repository navigation
fix: Ship a nonroot user in the scratch image - #33
Merged
Merged
Conversation
A scratch image has no /etc/passwd, so the kubelet starts the container as uid 65532 but gid 0 despite USER 65532:65532. The cert-manager CSI client certificate is mounted with fs-group 65532, so the process cannot read it and crashes at startup. Docker on a laptop honours the group and does not reproduce this. Key changes: - Write a minimal /etc/passwd and /etc/group for nonroot (65532) in the builder stage and copy them into the runtime image Related to datum-cloud/infra#7436
ecv
force-pushed
the
fix/scratch-nonroot-user
branch
from
November 6, 2026 16:10
1c706e0 to
b309078
Compare
ecv
marked this pull request as ready for review
November 6, 2026 16:13
scotwells
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every new service starts from this template, so each one inherits a scratch image that runs with group 0 and can't read its cert-manager certificate.
A scratch image has no
/etc/passwd, so on our clusters the container starts as uid 65532 but gid 0, even though the image saysUSER 65532:65532. The cert-manager CSI client certificate is mounted withfs-group: 65532, so the process can't read it and crash-loops. This is what took staging down on 21 October (network-services-operator#685, datum#312). Docker on a laptop doesn't reproduce it, because Docker honours the group.This writes a minimal
nonrootuser and group (65532) in the builder stage and copies/etc/passwdand/etc/groupinto the scratch image. Root CAs are unaffected: the binary already embeds them throughx509roots/fallback.Related to datum-cloud/infra#7436, closes #27 once proven in staging.
Test plan
/etc/passwdand/etc/groupwithnonroot:65532, user65532:65532