-
Notifications
You must be signed in to change notification settings - Fork 440
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
Auto-instrumentation docker images run as root #2053
Comments
I think this should be fixed if you use a securityContext. Except for Apache #2050 |
Sorry could you explain a bit more? We are using a securityContext in our main app container, which looks like: securityContext:
allowPrivilegeEscalation: false
privileged: false
runAsNonRoot: true the autoinstrumentation container seems to copy this security context which doesn't work because runAsNonRoot only works if the docker image has a "USER #" line. |
Maybe I'm wrong but, if you set the user like in https://github.com/open-telemetry/opentelemetry-operator/blob/8d3000e/tests/e2e-instrumentation/instrumentation-python/01-install-app.yaml, it should be fine. I understand that just setting the |
@iblancasa could a perma link instead? 🦝 |
The tests were moved to a different folder. I corrected the link. |
We don't always have control over whether the docker images have users and if their application permissions depend on running as a certain user. So it's hard for us to enforce everyone to run as a particular user/group. The k8s-sidecar container image runs as "nobody": |
Looking into this now. Did anyone find a solution without specifying a user and using runAsNonRoot: true in the deployment? I am using the nodejs instrumentation. |
Maybe the solution proposed by @andrewdinunzio can work. @andrewdinunzio, did you try to build the instrumentation images with that change? |
Sorry we moved away from auto-instrumentation at the k8s level towards using the autoinstrumentation offered in opentelemetry sdks in the source itself, so I haven't tested that. |
Thanks, but I would also like to not have to rebuild the image! |
It is not the solution. It would be to test if that solves your issue. Later, we can discuss if include or not as part of the published images. |
Ok cool! And.... It works!! :) I only added Well it starts, I still have other things to iron out the comply with the policy |
This also worked for me. Why run as root if not needed?? |
I'm using the nodejs autoinstrumentation image, which uses busybox as its base image. Because it's not set to run as a different user (a non-zero integer, specifically) in the Dockerfile, Kubernetes rejects it and I get:
for the auto-instrumentation init container.
I suggest some kind of distroless base image that has some nonroot user (or add one) and adding an explicit "USER #" line in the autoinstrumentation dockerfiles.
I'm using opentelemetry helm chart version 0.36.0. After downgrading back to 0.24.x it appears to work again. From what I can tell, at some point the OTel operator started copying the security context of the app container, which doesn't work if the security context has runAsNonroot and the autoinstrumentation image runs as root.
The text was updated successfully, but these errors were encountered: