Trying to identify PODs with NO LIMITS

6 views
Skip to first unread message

Carlos Mercado

unread,
Apr 11, 2020, 10:06:12 PM4/11/20
to Prometheus Users
Hi

Sorry if this is a repeated topic, but I am trying to identify all the pods with NO limits, I know there is a query to get all the pods with resources limits but this query does not return pods where limits were not set. 

What I was trying is first to get all the pods running in the cluster with query: 

sum  by (pod) (kube_pod_info)

Then I am getting the list of pods with limits set:

sum by (pod)(kube_pod_container_resource_limits{resource="cpu"})

Is there a way to compare these two results and get the list of pods with no limits?


Thanks in advance, Regards.
Carlos Mercado

Christian Hoffmann

unread,
Apr 12, 2020, 2:51:03 AM4/12/20
to Carlos Mercado, Prometheus Users
Hi Carlos,

On 4/12/20 4:06 AM, Carlos Mercado wrote:
> What I was trying is first to get all the pods running in the cluster
> with query: 
>
> sum  by (pod) (kube_pod_info)
>
> Then I am getting the list of pods with limits set:
>
> sum by (pod)(kube_pod_container_resource_limits{resource="cpu"})
>
> Is there a way to compare these two results and get the list of pods
> with no limits?
This should be possible with the "unless" operator:

sum by (pod) (kube_pod_info) unless sum by (pod)
(kube_pod_container_resource_limits{resource="cpu"})

Note: If you add more labels to one of the sides, you will need an
additional on(pod) clause after "unless".

Kind regards,
Christian
Reply all
Reply to author
Forward
0 new messages