Question: buildkit rootless + AppArmor on k8s- could Kubernetes UserNamespacesStatelessPodsSupport feature (v1.25 alpha) make this possible?

Open
#4,022 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
gcp, kubernetes

Research direction

No repository file or test is named. Start with the Kubernetes UserNamespacesStatelessPodsSupport documentation and reproduce the newuidmap/AppArmor failure described in the issue. Done would require confirming a supported configuration or producing a scoped implementation proposal for rootless BuildKit.

Written by the indexing model from the issue text.

Description

area/kubernetes area/rootless kind/question

I am experimenting in the hopes of using rootless buildkit as a container builder in a Kubernetes cluster (specifically GKE Sandbox) that is secured in such a way that AppArmor must be enabled. It is documented that rootless buildkit requires disabling the default AppArmor profile (snippet below):

      annotations:
        container.apparmor.security.beta.kubernetes.io/buildkit: unconfined

When I attempt to run buildkit w/o this annotation (w/ an AppArmor profile) I see the following error (WAI from the docs, just adding the error message for future context):

$ kubectl logs buildkit-non-root-syncthing-v2
Defaulted container "buildkit" out of: buildkit, prepare (init)
could not connect to unix:///run/user/1000/buildkit/buildkitd.sock after 10 trials
========== log ==========
[rootlesskit:parent] error: failed to setup UID/GID map: newuidmap 11 [0 1000 1 1 100000 65536] failed: newuidmap: Could not set caps
: exit status 1
sh: can't kill pid 4: No such process

I was wondering if anyone here might be able to weigh in on if the new-ish Kubernetes alpha feature - UserNamespacesStatelessPodsSupport might be able to be used instead of newuidmap to get buildkit rootless working w/ AppArmor on k8s? I am not sure what the full set of capabilities buildkit rootless requires is but was wondering if anyone might know if theoretically using this feature and modifying buildkit rootless could provide a solution here? Happy to help explore this as well, currently having some issues getting the alpha UserNamespacesStatelessPodsSupport feature working for me in a kubernetes cluster. Thanks!

Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from moby/buildkit

All issues in moby/buildkit

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.