-
Notifications
You must be signed in to change notification settings - Fork 412
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
Unknown container runtime on some kubernetes clusters #3003
Comments
Currently my best idea is to try detecting on startup if tracee is running on a kubernetes node. If anyone has a simpler idea please comment here otherwise I will go for this solution as a start. |
Waiting for the process tree to be added. |
Well, things seem to have changed in GKE since this issue was opened. Following are analyzes in two environments (cos_containerd and ubuntu_containerd). cos_containerdenv
Event Output
For the following commands:
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 11031
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod5f2261e2_c7c4_4d8c_b264_25fc19151247.slice/cri-containerd-d238fcfd99d54dc7fbb14b5b9b183d05d68a41f9ac460c886aba30c41a0466d5.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "containerd"
},
{
"name": "container_id",
"type": "const char*",
"value": "d238fcfd99d54dc7fbb14b5b9b183d05d68a41f9ac460c886aba30c41a0466d5"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697667965255697000
},
{
"name": "container_image",
"type": "const char*",
"value": "docker.io/library/nginx:latest"
},
{
"name": "container_image_digest",
"type": "const char*",
"value": "docker.io/library/nginx:latest"
},
{
"name": "container_name",
"type": "const char*",
"value": "my-container"
},
{
"name": "pod_name",
"type": "const char*",
"value": "my-pod"
},
{
"name": "pod_namespace",
"type": "const char*",
"value": "default"
},
{
"name": "pod_uid",
"type": "const char*",
"value": "5f2261e2-c7c4-4d8c-b264-25fc19151247"
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
}
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 11670
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/system.slice/docker-ee6fc54ba2af7eb3978948a22b843fb35e8644001da43f483c465e6fd28e9fe2.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "docker"
},
{
"name": "container_id",
"type": "const char*",
"value": "ee6fc54ba2af7eb3978948a22b843fb35e8644001da43f483c465e6fd28e9fe2"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697664457594386200
},
{
"name": "container_image",
"type": "const char*",
"value": "hello-world:latest"
},
{
"name": "container_image_digest",
"type": "const char*",
"value": "hello-world@sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d"
},
{
"name": "container_name",
"type": "const char*",
"value": "gallant_wing"
},
{
"name": "pod_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_namespace",
"type": "const char*",
"value": ""
},
{
"name": "pod_uid",
"type": "const char*",
"value": ""
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
}
// container_create isn't triggered
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 11550
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/default/hello-container"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
} ubuntu_containerdenv
Event Output
For the following commands:
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 10778
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-podd38e8673_9c07_45d5_afc9_00c4b231298d.slice/cri-containerd-cc8dfcf4431e1b1485e2cd1f59c4a36a27a3d2e4bb53d0fef558adb87bb26cd4.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "containerd"
},
{
"name": "container_id",
"type": "const char*",
"value": "cc8dfcf4431e1b1485e2cd1f59c4a36a27a3d2e4bb53d0fef558adb87bb26cd4"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697667647556392200
},
{
"name": "container_image",
"type": "const char*",
"value": ""
},
{
"name": "container_image_digest",
"type": "const char*",
"value": ""
},
{
"name": "container_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_namespace",
"type": "const char*",
"value": ""
},
{
"name": "pod_uid",
"type": "const char*",
"value": ""
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
}
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 8915
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/system.slice/docker-7a9fc4c6d3676d57ecf74a72dff1d6b06231bef6d23997a0eb1eb28b22524a70.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "docker"
},
{
"name": "container_id",
"type": "const char*",
"value": "7a9fc4c6d3676d57ecf74a72dff1d6b06231bef6d23997a0eb1eb28b22524a70"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697665168308888800
},
{
"name": "container_image",
"type": "const char*",
"value": "hello-world:latest"
},
{
"name": "container_image_digest",
"type": "const char*",
"value": "hello-world@sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d"
},
{
"name": "container_name",
"type": "const char*",
"value": "priceless_feistel"
},
{
"name": "pod_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_namespace",
"type": "const char*",
"value": ""
},
{
"name": "pod_uid",
"type": "const char*",
"value": ""
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
}
// container_create isn't triggered
{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 9785
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/default/hello-container"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
} |
Summary, for both cos_containerd and ubuntu_containerd, the runtime is correctly detected when the container is created by kubernetes and docker, but not when by ctr. So I consider that there is no obvious problem at the moment. If another GKE environment is not compliant, please reopen this issue specifying which environment it is and how to reproduce it. Closing as non-reproducible on GKE. |
Considering other environments/platforms besides GKE, follow the results: aksenv
RESULT
Event Output{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 9540
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod9b9d24d5_38a0_4800_870e_18471c07e8f8.slice/cri-containerd-b69314304aa728ab173865dfef6e15a7500a7c373c865d4f8461dd8038b96bbe.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "containerd"
},
{
"name": "container_id",
"type": "const char*",
"value": "b69314304aa728ab173865dfef6e15a7500a7c373c865d4f8461dd8038b96bbe"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697741372622129400
},
{
"name": "container_image",
"type": "const char*",
"value": "mcr.microsoft.com/oss/kubernetes/pause:3.6"
},
{
"name": "container_image_digest",
"type": "const char*",
"value": "mcr.microsoft.com/oss/kubernetes/pause:3.6"
},
{
"name": "container_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_name",
"type": "const char*",
"value": "my-pod"
},
{
"name": "pod_namespace",
"type": "const char*",
"value": "tracee-system"
},
{
"name": "pod_uid",
"type": "const char*",
"value": "9b9d24d5-38a0-4800-870e-18471c07e8f8"
},
{
"name": "pod_sandbox",
"type": "bool",
"value": true
}
]
} kindenv
RESULT
Event Output{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 20922
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/system.slice/docker-832aa69574e4b66dfe297fa8960e68843dddcb5673d9dad0cc996722aa2540dd.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-besteffort.slice/kubelet-kubepods-besteffort-poda7b57a44_a1df_463c_be01_d6f4a3312eef.slice/cri-containerd-6ac9b7af1d5b7453529baa5efdd3e44c8a0eda2407ff36be675e853264ac8f04.scope"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 0
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "containerd"
},
{
"name": "container_id",
"type": "const char*",
"value": "6ac9b7af1d5b7453529baa5efdd3e44c8a0eda2407ff36be675e853264ac8f04"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697735931618706475
},
{
"name": "container_image",
"type": "const char*",
"value": ""
},
{
"name": "container_image_digest",
"type": "const char*",
"value": ""
},
{
"name": "container_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_namespace",
"type": "const char*",
"value": ""
},
{
"name": "pod_uid",
"type": "const char*",
"value": ""
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
} minikubeenv
RESULT
Event Output{
"eventName": "cgroup_mkdir",
"args": [
{
"name": "cgroup_id",
"type": "u64",
"value": 778
},
{
"name": "cgroup_path",
"type": "const char*",
"value": "/kubepods/besteffort/pod19e4fb1e-cc64-4935-b592-b24b6d1ab689/d1e16407868a862baa8f72ad841ad8e27cd1a61433adfc5ae6b5c5acc7b05750"
},
{
"name": "hierarchy_id",
"type": "u32",
"value": 2
}
]
}
{
"eventName": "container_create",
"args": [
{
"name": "runtime",
"type": "const char*",
"value": "unknown"
},
{
"name": "container_id",
"type": "const char*",
"value": "d1e16407868a862baa8f72ad841ad8e27cd1a61433adfc5ae6b5c5acc7b05750"
},
{
"name": "ctime",
"type": "unsigned long",
"value": 1697731959307002554
},
{
"name": "container_image",
"type": "const char*",
"value": ""
},
{
"name": "container_image_digest",
"type": "const char*",
"value": ""
},
{
"name": "container_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_name",
"type": "const char*",
"value": ""
},
{
"name": "pod_namespace",
"type": "const char*",
"value": ""
},
{
"name": "pod_uid",
"type": "const char*",
"value": ""
},
{
"name": "pod_sandbox",
"type": "bool",
"value": false
}
]
} |
If there isn't an issue for mapping the supported runtimes (I believe there was one at sometime) then I would recommend creating an issue for it with a more consumable table (since these comments are too long and makes it hard to summarize final picture). Up to you! |
Here's a tabled summary of the above analysis.
|
I was using jq for all tests and it has a bad reputation for messing up output, so I need to redo them all just grepping the output. Reopening and moving it to v0.20.0. |
Using
For microk8s, I can register the default location for the socket: /snap/microk8s/current/bin/ctr -a /var/snap/microk8s/common/run/containerd.sock -n k8s.io containers ls And I believe microk8s container enrichment would start working. |
Kind - looks like Kind creates an overlay mount which includes the original containerd socket, but for some reason using ctr inside the container and outside ( Overall we have two issues here:
|
This bugs also happens on microk8s -> #3003 |
Decision: we will consider this path as a containerd path. TBD if its found in further environments. |
Description
-f e=cgroup_mkdir,container_create
kubepods/<besteffort|burstable>/podXXXX/<container_id>
runtime
argument set tounknown
Output of
tracee -v
:Tracee version "v0.13.1"
Output of
uname -a
:Linux gke-enforcer-overhea-prometheus-node--49423563-kggk 5.15.0-1027-gke #32-Ubuntu SMP Tue Jan 24 11:53:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Additional details
The text was updated successfully, but these errors were encountered: