-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Podman with Kubernetes executor in Gitlab CI #7982
Comments
It looks like whatever you're running Podman inside is blocking the |
@mheon Thanks for the quick reply. Has anyone tried a sample of Podman executing in containerd - GKE? I am not using anything else since Gitlab runner just spawns a pod in K8 (https://docs.gitlab.com/runner/executors/kubernetes.html) Podman is running as root within containerd with all permissions given to it (not sure about filesystem mounting though). Are you talking about something like this - https://docs.gitlab.com/runner/executors/kubernetes.html#using-volumes Is there any volume to be specifically mounted to use inside kubernetes? I did try mounting I have no issues using Buildah since I just want to build images, not run containers within my CI pipeline but I thought Podman itself uses buildah underneath. Am I missing something here? |
@tvvignesh Podman does use Buildah for the |
@TomSweeneyRedHat Hmm. Thanks for the clarification. Not sure how that would affect my build though, but still just tried using buildah rather and I get this: And this is all I have in my CI: Get the same error as podman with overlayfs |
More details on the environment I am running this in:
|
A friendly reminder that this issue had no activity for 30 days. |
The issue is that the default seccomp rules that are being used are blocking the mount syscall and a few others. We do not believe that these should be blocked by default and use less stringent rules for seccomp.json then Docker did. Which allows buildah to be run within a locked down container. If you switch to using /usr/share/containers/seccomp.json from containers-common, package you should be able to get this to work. If you switched to CRI-O backend then it should work out of the box. |
Hi. I am trying to run Podman in Gitlab CI using the Kubernetes executor (GKE with containerd specifically) (https://docs.gitlab.com/runner/executors/kubernetes.html) and am struggling to build the image. Details below.
My Sample Dockerfile:
My Sample CI:
While I wanted to go with the restricted PSP (https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml) I thought I should get it running first, so I have given all permissions to the PSP exactly using this PSP and have no securityContext in the POD as well: https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/privileged-psp.yaml
Case 1: All permissions given, and replacing vfs with overlayfs driver
When trying to use overlayfs I did add mount settings like this to gitlab runner but it didn't help:
Case 2: All permissions given, vfs driver
I am stuck with this error. I did see in this blog: https://blog.42.be/2018/10/buildah-inside-centos-container.html that they are facing the same error and they fixed it by enabling user namespace.
So, I tried adding the
--userns
flag and set its value to bothhost
andcontainer
and it did not work.I saw a similar issue #3402 using Go and I am facing the same issue with Node running Podman as root.
Also saw somewhat similar issue here with arm (I am using amd64) but not sure if its related: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4246
Case 3: Trying out security-opt
I did add the security-opt flag as per this comment: containers/buildah#2175 (comment) but that didn't work either and I get the same error as above.
Also tried adding
--security-opt seccomp=/usr/share/containers/seccomp.json
but that didn't seem to work either.podman build --security-opt seccomp=unconfined -t ${IMAGE_TAG} .
Case 4: Trying to set the storage driver to fuse
I did try changing storage driver to fuse by setting
STORAGE_DRIVER: "fuse"
but it didn't work since it said fuse is not supported.Tried both
fuse
and/dev/fuse
Is there any way or guide/recommendation to run Podman in Kubernetes executor providing minimum privilege as possible to build images? Currently I am stuck with Case 2 above.
Since I don't have any docker here (everything is running within Containerd since it is using the Kubernetes executor), I don't think that is the problem? I am using the
quay.io/podman/stable
image as well.Also referred to https://medium.com/prgcont/using-buildah-in-gitlab-ci-9b529af19e42 but that didn't help due to the errors above.
Any help is appreciated. Thanks.
The text was updated successfully, but these errors were encountered: