When running from within a k8s pod, use the k8s API to get the cgroup name #5576
When running from within a k8s pod, use the k8s API to get the cgroup name #5576cakrit merged 12 commits intonetdata:masterfrom cakrit:k8s-1
Conversation
| fi | ||
| done | ||
|
|
||
| if [ -z "${NAME}" ] && [ -n "${KUBERNETES_SERVICE_HOST}" ] && [ -n "${KUBERNETES_PORT_443_TCP_PORT}" ]; then |
There was a problem hiding this comment.
KUBERNETES_PORT_443_TCP_PORT -> KUBERNETES_API_PORT
No need to copy-paste from k8s docs when it doesn't improve UX.
There was a problem hiding this comment.
I haven't seen KUBERNETES_API_PORT in any official docs, or even mentioned in issues. How can I trust it to be the https port?
There was a problem hiding this comment.
It worked on all tests with this, so leaving it as is.
There was a problem hiding this comment.
It worked on all tests with this, so leaving it as is.
|
This won't be considered complete until #3520 is implemented (at least to the point of correctly showing only the relevant cgroups, with appropriate names). |
…ed registry, for use in k8s
ktsaou
left a comment
There was a problem hiding this comment.
We should probably do something about the jq command to make sure it is installed with netdata.
I mean, to be installed by kickstart.sh and netdata.spec.
|
is this change just for netdata running in a k8s Pod? what about the situation when netdata is running directly on the VM with kubernetes running? I have this situation so now the cgroup names are not mapped to the human readable docker container name. |
|
|
… name (netdata#5576) * When running from within a k8s pod, use the k8s API to get the pod name * Check the last part of an underscore-delimited or slash-delimited container id * Add a docker image builder that adds a single image to a user-specified registry, for use in k8s * When running in k8s, disable cgroups that the pod API does not return * Use longer name for k8s containers * Add reference to build-test.sh to packaging/docker/README.md * Anonymous statistics should not break when /proc/1/sched is not available
Summary
Fixes #5387 (just the pod/container monitoring part, presentation will be a different issue)
Fixes #3520 (again, just wrt naming, presentation will be a new issue).
k8s don't necessarily have a docker executable available. Use the k8s pod API to get the pod name.
Used for cgroup naming.
Disable cgroups that are not returned by the k8s API (e.g. pause containers).