omrikiei / ktunnel

A cli that exposes your local resources to kubernetes
GNU General Public License v3.0
958 stars 75 forks source link

OpenShift compatibility (RunAsUser) #87

Open criztovyl opened 2 years ago

criztovyl commented 2 years ago

When using ktunnel with OpenShift, for me ktunnel expose does not reliably work because the Deployment created has RunAsUser, which OCP does not allow unless you adjust it's security configuration.

OpenShift runs containers with non-root user by default, and the Deployment works fine when I manually remove the RunAsUser.

So far the bug, I am open to providing a PR, but maybe you already have a solution in mind?

ciis0 commented 2 years ago

https://github.com/omrikiei/ktunnel/blob/fbd3f4e2740e552ff8a2464d9724fe04b8e18563/pkg/k8s/common.go#L169-L171

gms1 commented 1 month ago

containerUid is hardcoded set to 1000 so that the container runs as non-root https://github.com/omrikiei/ktunnel/commit/05b502b6ce0ba2388674fc935e392239081b92b9

A simple way to run the container as non-root, but without running into this issue, would be to specify the non-root user via Dockerfile and not via "RunAsUser" e.g. like this https://github.com/gms1/ktunnel/blob/develop/Dockerfile