-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crun, an OCI container runtime used by cri-o breaks pod association for tetragon by using placing processes in a cgroup below the cgroup specified by the OCI spec: https://github.com/containers/crun/blob/main/crun.1.md#runocisystemdsubgroupsubgroup. With the introduction of cgidmap, this commit can finally deal with this issue by scanning the cgroup directory for children directories and, if it finds one, use the cgroup id of the child. A better solution would be to allow for multiple cgroup ids for each container, but this is left as a followup. The commit includes a script for testing this issue using minikube. Becaues minikube uses an older version of crun, we need to install it. The steps for reproducing this are: minikube start --driver=kvm2 --container-runtime=crio --force-systemd=true ./scripts/minikube-install-crun.sh Running tetragon without cgidmap, we observe events without pod association: 🚀 process minikube /usr/bin/ls 💥 exit minikube /usr/bin/ls 0 By installing the runtime hooks: ./scripts/minikube-install-hook.sh And runing tetragon with cgidmap (and nri) using --enable-cri --enable-cgidmap, we observe pod association for both old and new pods: 🚀 process default/test /usr/bin/ls 💥 exit default/test /usr/bin/ls 0 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
- Loading branch information
Showing
5 changed files
with
115 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
# vim:set noet ci pi ts=4 sw=4 | ||
|
||
set -o pipefail | ||
set -e | ||
|
||
if [ "$1" != "install" ]; then | ||
SCRIPTPATH=$(dirname "$0") | ||
source ${SCRIPTPATH}/helpers | ||
|
||
runtime=$(detect_runtime) | ||
if [ "$runtime" != "crio" ]; then | ||
echo "crio not installed, bailing out" | ||
exit 1 | ||
fi | ||
|
||
name=$(basename "$0") | ||
minikube cp $0 /tmp/$name | ||
minikube ssh sudo chmod +x /tmp/$name | ||
minikube ssh sudo /tmp/$name install | ||
exit 0 | ||
fi | ||
|
||
set -x | ||
|
||
echo "Running inside minikube: $(uname -a)" | ||
crio_v=$(crio --version | sed -ne 's/^Version:[[:space:]]\+\(.\+\)/\1/p') | ||
echo "crio version: $crio_v" | ||
crun_v=$(crun --version | sed -ne 's/^crun version[[:space:]]\+\(.\+\)/\1/p') | ||
echo "old crun version: $crun_v" | ||
|
||
# cleanup everything | ||
systemctl stop kubelet | ||
crictl ps -a -q | xargs crictl stop | ||
crictl ps -a -q | xargs crictl rm | ||
crictl pods -q | xargs crictl stopp | ||
crictl pods -q | xargs crictl rmp | ||
systemctl stop crio | ||
|
||
cd /tmp | ||
tarball=cri-o.amd64.v${crio_v}.tar.gz | ||
if [ -f "${tarball}" ]; then | ||
echo "tarball ${tarball} exists, skipping download" | ||
else | ||
curl -sOL -C - https://storage.googleapis.com/cri-o/artifacts/${tarball} | ||
fi | ||
rm -rf cri-o | ||
tar zxf $tarball | ||
cd cri-o | ||
cp ./bin/crio-{conmon,conmonrs,crun} /usr/bin | ||
crio_crun_v=$(crio-crun --version | sed -ne 's/^crun version[[:space:]]\+\(.\+\)/\1/p') | ||
echo "new crun version: $crio_crun_v" | ||
|
||
fname=$(mktemp -t crio-crun-conf.XXXXX) | ||
cat >$fname <<EOF | ||
[crio.runtime] | ||
default_runtime = "crun" | ||
[crio.runtime.runtimes.crun] | ||
runtime_path = "/usr/bin/crio-crun" | ||
monitor_path = "/usr/bin/crio-conmon" | ||
allowed_annotations = [ | ||
"io.containers.trace-syscall", | ||
] | ||
EOF | ||
chmod go+r ${fname} | ||
chown root:root ${fname} | ||
cp $fname /etc/crio/crio.conf.d/10-crun.conf | ||
systemctl start crio | ||
systemctl start kubelet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters