-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow proxy-init container to run as non-root #7162
Conversation
@@ -44,8 +44,6 @@ securityContext: | |||
privileged: false | |||
{{- end }} | |||
readOnlyRootFilesystem: true | |||
runAsNonRoot: false |
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.
According to k8s reference docs, the default for runAsNonRoot
is already false
. So I think we should have here runAsNonRoot: true
instead, for the Kubelet to check that the container is not triggered under user 0
.
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.
I re-added runAsNonRoot and set it to true
. This will enforce the proxy-init container that it needs to run as non-root.
This then will require the changes from linkerd/linkerd2-proxy-init#49 .
Indicates that the container must run as a non-root user. If true, the
Kubelet will validate the image at runtime to ensure that it does not run
as UID 0 (root) and fail to start the container if it does. If unset or
false, no such validation will be performed. May also be set in
PodSecurityContext. If set in both SecurityContext and PodSecurityContext,
the value specified in SecurityContext takes precedence.
(fromkubectl explain pod.spec.initContainers.securityContext.runAsNonRoot
As mentioned I re-added runAsNonRoot and set it to true. This will enforce the proxy-init container that it needs to run as non-root. I also adjusted the tests to match the new chart. |
Thanks @chrischdi, we'll wait for linkerd/linkerd2-proxy-init#49 to get one more review to get it merged, then I'll create a new release |
As mentioned in linkerd/linkerd2-proxy-init#49 (comment) : We may have to switch to the following because of the configurable
|
requires rebase after #7203 was done :-) |
a5287b0
to
0a2e9ea
Compare
Rebased changes to main branch because #7203 got merged :-) |
Still requires this change, I'll update the PR |
0a2e9ea
to
9402a9d
Compare
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.
Looking good. So the idea is to have proxy-init run as non-root, unless closeWaitTimeoutSecs
is used. Any objections to that @mateiidavid ?
Also could you please take care of the DCO?
bf899a9
to
74a176a
Compare
Thanks for the review. Looks like I missed the zero and signing the commits again :-) should be ok now 👍 |
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.
Thanks @chrischdi !
Not at all! Think everything looks great. |
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.
I think you might have to do yet another rebase, sorry about that. We bumped up proxy-init
to v1.5.1
, the base image was modified. Ready to 🚢 from my side after that.
Linkerd proxy-init container is currently enforced to run as root. Removes hardcoding `runAsNonRoot: false` and `runAsUser: 0`. This way the container inherits the user ID from the proxy-init image instead which may allow to run as non-root. Validation should happen during the usual tests. Fixes linkerd#5505 Signed-off-by: Schlotter, Christian <christian.schlotter@daimler.com>
74a176a
to
6bf93e3
Compare
No worries :-) done, I squashed the commits again, I hope that's okay (the second and third only have been fixups). |
@alpeb So how do we track down which stable release this is is going to make into, and when? |
Additive changes like this typically make it into the next stable release which will If there is a stable |
@kleimkuhler many thanks for the prompt response on this! |
Linkerd proxy-init container is currently enforced to run as root. Removes hardcoding `runAsNonRoot: false` and `runAsUser: 0`. This way the container inherits the user ID from the proxy-init image instead which may allow to run as non-root. Fixes #5505 Signed-off-by: Schlotter, Christian <christian.schlotter@daimler.com> (cherry picked from commit 9853353) Signed-off-by: Oliver Gould <ver@buoyant.io>
Linkerd proxy-init container is currently enforced to run as root. Removes hardcoding `runAsNonRoot: false` and `runAsUser: 0`. This way the container inherits the user ID from the proxy-init image instead which may allow to run as non-root. Fixes #5505 Signed-off-by: Schlotter, Christian <christian.schlotter@daimler.com> (cherry picked from commit 9853353) Signed-off-by: Oliver Gould <ver@buoyant.io>
Linkerd proxy-init container is currently enforced to run as root.
Removes hardcoding
runAsNonRoot: false
andrunAsUser: 0
. This waythe container inherits the user ID from the proxy-init image instead which
may allow to run as non-root.
Validation should happen during the usual tests.
Fixes #5505
Signed-off-by: Schlotter, Christian christian.schlotter@daimler.com
Requires linkerd/linkerd2-proxy-init#49 for having the correct capabilities set for the iptables binaries.
It would be also possible to keep the option for users to run as root by adding something like:
Christian Schlotter christian.schlotter@daimler.com, Daimler AG on behalf of Daimler TSS GmbH
Provider Information