Skip to content

Commit

Permalink
rootless: guide for Bottlerocket OS (`sysctl -w user.max_user_namespa…
Browse files Browse the repository at this point in the history
…ces=N`)

Signed-off-by: Akihiro Suda <[email protected]>
(cherry picked from commit c67176a)
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Mar 11, 2023
1 parent d70b329 commit 58c8024
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/rootless.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ spec:
See also the [example manifests](#Kubernetes).
### Bottlerocket OS
Needs to run `sysctl -w user.max_user_namespaces=N` (N=positive integer, like 63359) on the host nodes.

See [`../examples/kubernetes/sysctl-userns.privileged.yaml`](../examples/kubernetes/sysctl-userns.privileged.yaml).

<details>
<summary>Old distributions</summary>

Expand Down Expand Up @@ -104,6 +110,11 @@ See https://rootlesscontaine.rs/getting-started/common/subuid/
### Error `Options:[rbind ro]}]: operation not permitted`
Make sure to mount an `emptyDir` volume on `/home/user/.local/share/buildkit` .

### Error `fork/exec /proc/self/exe: no space left on device` with `level=warning msg="/proc/sys/user/max_user_namespaces needs to be set to non-zero."`
Run `sysctl -w user.max_user_namespaces=N` (N=positive integer, like 63359) on the host nodes.

See [`../examples/kubernetes/sysctl-userns.privileged.yaml`](../examples/kubernetes/sysctl-userns.privileged.yaml).

## Containerized deployment

### Kubernetes
Expand Down
26 changes: 26 additions & 0 deletions examples/kubernetes/sysctl-userns.privileged.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Run `sysctl -w user.max_user_namespaces=63359` on all the nodes,
# for errors like "/proc/sys/user/max_user_namespaces needs to be set to non-zero"
# on running rootless buildkitd pods.
#
# This workaround is known to be needed on Bottlerocket OS.
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: sysctl-userns
name: sysctl-userns
spec:
selector:
matchLabels:
app: sysctl-userns
template:
metadata:
labels:
app: sysctl-userns
spec:
containers:
- name: sysctl-userns
image: busybox
command: ["sh", "-euxc", "sysctl -w user.max_user_namespaces=63359 && sleep infinity"]
securityContext:
privileged: true

0 comments on commit 58c8024

Please sign in to comment.