Skip to content
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

Make image be rootless #86

Merged
merged 4 commits into from
Sep 15, 2020
Merged

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Aug 18, 2020

@camilamacedo86 camilamacedo86 force-pushed the solve-image branch 2 times, most recently from c67b951 to 249d2fb Compare August 18, 2020 16:14
@camilamacedo86 camilamacedo86 changed the title Make image be rootless WIP: Make image be rootless Aug 18, 2020
Copy link
Collaborator

@paulfantom paulfantom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is removing the whole vendor/ directory, could you also remove references to said directory from Makefile?

@paulfantom
Copy link
Collaborator

#87 is merged now, could you rebase?

Thank you for this enhancement! 💯

@camilamacedo86 camilamacedo86 force-pushed the solve-image branch 2 times, most recently from 55aea8f to 4171951 Compare August 19, 2020 11:25
@paulfantom
Copy link
Collaborator

It seems that an e2e test scenario using deployment files from https://github.com/brancz/kube-rbac-proxy/tree/master/test/e2e/allowpaths is failing in CI.

Pod is failing to start due to:

Error: container has runAsNonRoot and image has non-numeric user (nonroot), cannot verify user is non-root
Error: container has runAsNonRoot and image will run as root

@camilamacedo86 camilamacedo86 force-pushed the solve-image branch 2 times, most recently from 8c843ca to feca0a7 Compare August 19, 2020 12:40
@camilamacedo86 camilamacedo86 changed the title WIP: Make image be rootless Make image be rootless Aug 19, 2020
@camilamacedo86 camilamacedo86 changed the title Make image be rootless WIP: Make image be rootless Aug 19, 2020
@camilamacedo86 camilamacedo86 changed the title WIP: Make image be rootless WIP [do not merge]: Make image be rootless Aug 20, 2020
@paulfantom
Copy link
Collaborator

@camilamacedo86 Is there something left for this PR?

@camilamacedo86 camilamacedo86 changed the title WIP [do not merge]: Make image be rootless Make image be rootless Sep 1, 2020
@camilamacedo86
Copy link
Contributor Author

hi @paulfantom,

Thank you for your support and patient. I want to look better on how we could update the manifests as well. However, I need to stop to work on it. It is fine now and can get merged. Could you also to do. new release after this merge?

@harpratap
Copy link

@camilamacedo86 I tried this branch and I get this error - Error: failed to start container "kube-rbac-proxy": Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/home/nonroot\") set in config.json failed: permission denied": unknown changing the user to 65532:65532 gives it permission to access home dir (https://github.com/GoogleContainerTools/distroless/blob/master/base/base.bzl#L7)

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Sep 2, 2020

hi @harpratap,

I am unable to reproduce the error. could you please let us know how are you doing this test? also, these changes have been passing in these tests and against OCP as well. See: openshift#29. However, would be nice to know more about how are you testing it.

@paulfantom
Copy link
Collaborator

@harpratap ping

@harpratap
Copy link

harpratap commented Sep 11, 2020

@camilamacedo86 I'm trying out with this role & psp, forcing to user 65532 fixes it. Can check the error message in events when doing kubectl describe pod xx But unfortunately not able to reproduce this on Kind or minikube yet. I have a suspicion that this is happening because of our use of containerd instead of docker

@camilamacedo86
Copy link
Contributor Author

Hi @harpratap,

Shows that the problem is because you are not using the changes made in the manifests. See: https://github.com/brancz/kube-rbac-proxy/pull/86/files#diff-c669d94f3867a7c8d5a54532c08e029bR61-R77. You came with this USER ID because of you check it out in https://github.com/GoogleContainerTools/distroless/blob/master/base/base.bzl#L7. But it is only a value for the const. We do not need to use this value to be able to use the distroless image.

@harpratap
Copy link

@camilamacedo86 I did try again after adding spec.securityContext.runAsUser: 1001 and spec.containers.allowPrivilegeEscalation: false but still results in the same error

@harpratap
Copy link

harpratap commented Sep 11, 2020

This seems to be a known issue in distroless:nonroot with containerd.
This repo has a reproducible test and looks like there is some ongoing activity to fix it upstream - containerd/cri#1397

It isn't related to this PR so this should be good to go, I'll watch for fixes in upstream. Thanks everyone!

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Sep 11, 2020

Hi @harpratap,

could we get it merged and do a release with it? Also, just use the ID 65532 solved the problem for containerd/cri#1397 I have no objections to change it here as well. I will do that .

Copy link
Collaborator

@paulfantom paulfantom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@s-urbaniak
Copy link
Collaborator

LGTM too, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run the process as no root
5 participants