-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
images/krte: add Rootless Docker (and systemd as a dependency) #30744
Conversation
c74094b
to
f3ddf76
Compare
@aojea @BenTheElder Could you take a look? |
This helps locally experimenting the image with `docker build`. Prior to this commit, `docker build` was failing unless `--build-arg GO_VERSION=...` was explicitly specified. Signed-off-by: Akihiro Suda <[email protected]>
The `RUN` cache below the `COPY` instruction is invalidated on updating the script. Signed-off-by: Akihiro Suda <[email protected]>
This commit adds the following runtime variables to support running Rootless Docker: - `KRTE_SYSTEMD=true` (default: `false`): enable systemd - `KRTE_SYSTEMD_ROOTLESS=true` (default: `false`): switch to a non-root user via systemd. The KRTE container itself still has to be run as the root, so DO NOT specify `securityContext.runAsUser`. e.g., ```console $ docker build -t krte . $ docker run -t --rm --privileged \ -e KRTE_SYSTEMD=true \ -e KRTE_SYSTEMD_ROOTLESS=true \ -e DOCKER_IN_DOCKER_ENABLED=true \ krte \ docker info wrapper.sh] [INFO] Re-executing in systemd: `docker info` ... wrapper.sh] [INFO] Switching to rootless: `docker info` ... wrapper.sh] [TEST] Running Test Command: `docker info` ... Cgroup Driver: systemd Cgroup Version: 2 ... Security Options: seccomp Profile: builtin rootless cgroupns ... ``` This is planned to be used for testing the `KubeletInUserNamespace` feature gate (KEP 2033), by running Kubernetes inside Rootless Docker. [FAQ: Why is systemd needed?] For delegating cgroup controllers to a non-root user. https://rootlesscontaine.rs/getting-started/common/cgroup2/#enabling-cpu-cpuset-and-io-delegation systemd is still opt-in for the default "rootful" mode, so this change will not affect the existing test jobs. Signed-off-by: Akihiro Suda <[email protected]>
f3ddf76
to
751a5c4
Compare
ping @aojea @BenTheElder 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
I've never tried to run systemd as anything other than PID1, will that work? In Kubernetes's CI there's an injected PID1 binary wrapping the test command unfortunately. https://docs.prow.k8s.io/docs/components/pod-utilities/entrypoint/
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AkihiroSuda, BenTheElder The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Attempting to catch back up today on all the things, if yes go ahead and |
Unlikely
Is this a hard requirement? |
@AkihiroSuda the entrypoint process is for injecting a bunch of stuff, collecting logs etc, so someone will have to do the same work somehow i think. |
Ish? Without it we don't get the log uploads etc. so ... The injected entrypoint redirects logs, handles signals, etc. https://docs.prow.k8s.io/docs/components/pod-utilities/ It should be possible to design the same functionality without this sort of entrypoint wrapper, but it doesn't exist, and would take a bit of work. It's a pretty old unresolved topic #8779 (comment) |
It's possible to handle these things some other way but it will be high-friction. I think the fastest path to getting rootless CI up is probably to spin up AWS/GCP VMs from a prowjob. |
Thank you, will consider using VMs |
@BenTheElder |
Yes, It would need to be a new deployer, and we're hoping to phase out the kube-up bash in favor of a more mature tool (kops), kubernetes/enhancements#4250. |
This commit adds the following runtime variables to support running Rootless Docker:
KRTE_SYSTEMD=true
(default:false
): enable systemdKRTE_SYSTEMD_ROOTLESS=true
(default:false
): switch to a non-root user via systemd.The KRTE container itself still has to be run as the root, so DO NOT specify
securityContext.runAsUser
.e.g.,
This is planned to be used for testing the
KubeletInUserNamespace
feature gate (KEP 2033),by running Kubernetes inside Rootless Docker.
FAQ: Why is systemd needed?
For delegating cgroup controllers to a non-root user.
https://rootlesscontaine.rs/getting-started/common/cgroup2/#enabling-cpu-cpuset-and-io-delegation
systemd is still opt-in for the default "rootful" mode, so this change will not affect the existing test jobs.