A node have a plenty of info for metrics collection, under cgroups kubepods.slice for example. but to complete the metric you have to relate a pod metric to a pod name. a name and namespace itself are kind of static metric of a pod, so they are first things alongside with pod uuid that it should have to describe a pod. How can i get this info from a node not using kubectl and not accessing remote kubernetes database of pods?
i can find only container ids/ pod uuids as the parts of cgroup structure.. where is name and namespace? (ideally a whole yaml manifest, its not that hard to store it on a node that is running pod, right?)
If its not having this info - why? that violates collection practices, you cannot do instrumentation as a single program that will collect pod metrics - you will require external process that will post-process such metrics, corresponding uuids to pods names and namespaces, and that is definetely not right approach, when you can have 1 small program running on the node itself
You may use
docker
inspect:Following command will list all the pod and their namespace running on the node. you can use the docker's data directory where it maintains the pod info.
Exmaple:
IMO, the parsing could be done with
jq
, I have usedregex
here to show the possibility of getting these values using docker data dir.Note: for
crio
a similar json is placed under overlay directory. see OP comment below.