kube-state-metrics: How can I get a deployment's pods?

501 views
Skip to first unread message

Nate Rook

unread,
Aug 10, 2018, 2:26:58 PM8/10/18
to Kubernetes user discussion and Q&A
Hi,

I wanted to get from a Deployment to its running Pods using some sort of label join. Getting from Pods to ReplicaSets is easy: the metric kube_pod_owner connects Pods to their ReplicaSets if they have them. But I can't find a metric with labels which let me connect ReplicaSets to Deployments: that is, there's no kube_replicaset_owner.

Has anyone had any success finding this?

Nate


Devdatta Kulkarni

unread,
Aug 10, 2018, 3:09:10 PM8/10/18
to Kubernetes user discussion and Q&A

Hi Nate,


We have been working on a tool named 'kubediscovery' to help with

discovering dynamic composition tree of Kubernetes Objects.

You might find it useful for your use-case.


You can find it here:

https://github.com/cloud-ark/kubediscovery


Regards,
Devdatta



From: kubernet...@googlegroups.com <kubernet...@googlegroups.com> on behalf of Nate Rook <na...@askspoke.com>
Sent: Friday, August 10, 2018 1:26:58 PM
To: Kubernetes user discussion and Q&A
Subject: [kubernetes-users] kube-state-metrics: How can I get a deployment's pods?
 
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Nate Rook

unread,
Aug 10, 2018, 4:16:29 PM8/10/18
to Kubernetes user discussion and Q&A
Ah, sorry, this is on me. I am specifically concerned with this problem in data which is shipped to the monitoring software Prometheus. I should have been clearer about kube-state-metrics's remit.

kubediscovery looks quite interesting!

On Friday, August 10, 2018 at 12:09:10 PM UTC-7, devd...@cloudark.io wrote:

Hi Nate,


We have been working on a tool named 'kubediscovery' to help with

discovering dynamic composition tree of Kubernetes Objects.

You might find it useful for your use-case.


You can find it here:

https://github.com/cloud-ark/kubediscovery


Regards,
Devdatta



From: kubernet...@googlegroups.com <kubernet...@googlegroups.com> on behalf of Nate Rook <na...@askspoke.com>
Sent: Friday, August 10, 2018 1:26:58 PM
To: Kubernetes user discussion and Q&A
Subject: [kubernetes-users] kube-state-metrics: How can I get a deployment's pods?
 
Hi,

I wanted to get from a Deployment to its running Pods using some sort of label join. Getting from Pods to ReplicaSets is easy: the metric kube_pod_owner connects Pods to their ReplicaSets if they have them. But I can't find a metric with labels which let me connect ReplicaSets to Deployments: that is, there's no kube_replicaset_owner.

Has anyone had any success finding this?

Nate


--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.

Agrawal, Punit

unread,
Aug 10, 2018, 5:27:58 PM8/10/18
to kubernet...@googlegroups.com

We usually use regex to get to the pods. You can use it like so

kube_pod_info{pod=~"go-svc.*"}

 

In the above case, go-svc is the deployment name.

 

Punit Agrawal

Site Reliability Engineer, Lead

New Product Development

To post to this group, send email to kubernet...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages