Skip to content

Commit 3b9d598

Browse files
committed
Add AppArmor config for rootless
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
1 parent 5eaad7c commit 3b9d598

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

docs/advanced.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,27 @@ See https://rootlesscontaine.rs/ to learn more about Rootless Kubernetes.
297297
* Enable cgroup v2 delegation, see https://rootlesscontaine.rs/getting-started/common/cgroup2/ .
298298
This step is required; the rootless kubelet will fail to start without the proper cgroups delegated.
299299

300-
* Download `k3s-rootless.service` from [`https://github.com/k3s-io/k3s/blob/<VERSION>/k3s-rootless.service`](https://github.com/k3s-io/k3s/blob/main/k3s-rootless.service).
301-
Make sure to use the same version of `k3s-rootless.service` and `k3s`.
300+
* On Ubuntu or other distributions with AppArmor support, you must allow the K3s binary to run unconfined:
301+
```bash
302+
cat <<EOF | sudo tee "/etc/apparmor.d/usr.local.bin.k3s"
303+
abi <abi/4.0>,
304+
include <tunables/global>
305+
306+
/usr/local/bin/k3s flags=(unconfined) {
307+
userns,
308+
309+
include if exists <local/usr.local.bin.k3s>
310+
}
311+
EOF
312+
313+
sudo systemctl restart apparmor.service
314+
```
315+
316+
* Download `k3s-rootless.service` from [`https://github.com/k3s-io/k3s/blob/main/k3s-rootless.service`](https://github.com/k3s-io/k3s/blob/main/k3s-rootless.service).
302317

303318
* Install `k3s-rootless.service` to `~/.config/systemd/user/k3s-rootless.service`.
304319
Installing this file as a system-wide service (`/etc/systemd/...`) is not supported.
305-
Depending on the path of `k3s` binary, you might need to modify the `ExecStart=/usr/local/bin/k3s ...` line of the file.
320+
Depending on the path to the `k3s` binary, you might need to modify the `ExecStart=/usr/local/bin/k3s ...` line of the file.
306321

307322
* Run `systemctl --user daemon-reload`
308323

0 commit comments

Comments
 (0)