Search code examples
kubernetesgrafanagrafana-variable

How to fetch the pod status, container ready status in grafana dashboard for kubernetes cluster in a namespace


I am trying to use the following query: kube_pod_container_status_ready{namespace="$namespace",pod="$pod",container="$container"}

but not sure of how to set the container variable in grafana. Need help in this one.


Solution

  • Go to explore -> metric browser

    In Select labels to search in select containter and then select any value.

    After that, metrics on the left should be updated to include only metrics that have container label.

    In my case it will be for example: kube_pod_container_info

    It your case, if kube_pod_container_status_ready has container label, you could use it.

    Then, add variable with query: label_values(kube_pod_container_info, container) / label_values(kube_pod_container_status_ready, container) enter image description here