Skip to content
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

minikube script for nested cgroups #3173

Merged
merged 3 commits into from
Dec 6, 2024
Merged

Conversation

kkourt
Copy link
Contributor

@kkourt kkourt commented Nov 29, 2024

Add a script to create a minikube instance with nested cgroups supported. See commits.

@kkourt kkourt added the release-note/misc This PR makes changes that have no direct user impact. label Nov 29, 2024
@kkourt kkourt requested a review from a team as a code owner November 29, 2024 10:33
@kkourt kkourt requested a review from kevsecurity November 29, 2024 10:33
Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 258ff8a
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/6752c24e08e68f0007cfa358
😎 Deploy Preview https://deploy-preview-3173--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kkourt kkourt force-pushed the pr/kkourt/cgroup-tracking-minikube branch 2 times, most recently from 2632151 to b60815b Compare November 29, 2024 12:33
@kkourt kkourt force-pushed the pr/kkourt/cgroup-tracking-minikube branch from b60815b to 258ff8a Compare December 6, 2024 09:22
Move applyChanges used to patch the containerd configuration file to its
own file. Useful for next commit.

Signed-off-by: Kornilios Kourtis <[email protected]>
@kkourt kkourt force-pushed the pr/kkourt/cgroup-tracking-minikube branch from 258ff8a to 3a4041f Compare December 6, 2024 09:24
Add a command to patch crio.conf to add allowed annotations.

For example:
> $ ssh cat /etc/crio/crio.conf > crio.conf
> $ ./tetragon-oci-hook-setup patch-crio-conf enable-annotations --config-file=crio.conf --output-file crio-patched.conf --annotations='io.kubernetes.cri-o.cgroup2-mount-hierarchy-rw'
> $ diff -u crio.conf crio-patched.conf
> --- crio.conf   2024-11-29 10:47:11.622015385 +0100
> +++ crio-patched.conf   2024-11-29 11:03:39.856306109 +0100
> @@ -300,6 +300,7 @@
>  runtime_path = "/usr/bin/runc"
>  runtime_type = "oci"
>  runtime_root = "/run/runc"
> +allowed_annotations = ["io.kubernetes.cri-o.cgroup2-mount-hierarchy-rw"]

Signed-off-by: Kornilios Kourtis <[email protected]>
Example:

$ minikube start --driver=kvm2 --container-runtime=crio
$ ./scripts/minikube-enable-nested-cgroups.sh

And now:
$ kubectl run --annotations='io.kubernetes.cri-o.cgroup2-mount-hierarchy-rw=true' ubuntu --image=ubuntu --rm -it -- /bin/bash
root@ubuntu:/# cat /proc/self/cgroup ## <-- inside pod
0::/
root@ubuntu:/# mkdir /sys/fs/cgroup/pizza
root@ubuntu:/# echo $$ > /sys/fs/cgroup/pizza/cgroup.procs
root@ubuntu:/# cat /proc/self/cgroup
0::/pizza

Signed-off-by: Kornilios Kourtis <[email protected]>
@kkourt kkourt force-pushed the pr/kkourt/cgroup-tracking-minikube branch from 3a4041f to 5788ee4 Compare December 6, 2024 09:31
@kkourt kkourt merged commit 525a9a8 into main Dec 6, 2024
42 checks passed
@kkourt kkourt deleted the pr/kkourt/cgroup-tracking-minikube branch December 6, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants