<p>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?</p>
<p>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?)</p>
<p>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</p>

xakepp35
<p>You may use <code>docker</code> inspect:</p>
<pre><code>docker inspect &lt;container-id&gt; --format='{{index .Config.Labels &quot;io.kubernetes.pod.name&quot;}

docker inspect &lt;container-id&gt; --format='{{index .Config.Labels &quot;io.kubernetes.pod.namespace&quot;}}'
</code></pre>
<p>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.</p>
<pre><code>find /var/lib/docker -name config.v2.json -exec perl -lnpe 's/.*pod\.name&quot;*\s*:\s*&quot;*([^&quot;]+).*pod\.namespace&quot;*\s*:\s*&quot;*([^&quot;]+).*/pod-name=$1 pod-namespace=$2/g' {} + |awk '!a[$0]++'|column -t
</code></pre>
<p>Exmaple:</p>
<pre><code>find /var/lib/docker -name config.v2.json -exec perl -lnpe 's/.*pod\.name&quot;*\s*:\s*&quot;*([^&quot;]+).*pod\.namespace&quot;*\s*:\s*&quot;*([^&quot;]+).*/pod-name=$1 pod-namespace=$2/g' {} + |awk '!a[$0]++'|column -t
pod-name=huha              pod-namespace=foo
pod-name=zoobar1           pod-namespace=default
pod-name=kube-proxy-l2hsb  pod-namespace=kube-system
pod-name=weave-net-rbbwf   pod-namespace=kube-system
pod-name=zoobar2           pod-namespace=default
</code></pre>
<p>IMO, the parsing could be done with <code>jq</code>, I have used <code>regex</code> here to show
the possibility of getting these values using docker data dir.</p>
<p>Note: for <code>crio</code> a similar json is placed under overlay directory. see OP comment below.</p>
