kubernetesprometheusgrafana

Grafana k8s pods overview table


I'm trying to construct a grafana dashboard that simply shows me exactly what kubectl get pods -A would show me. I cant seem to find any existing dashboards on the marketplace mimicking what i'm trying to achieve.

Specifically i'd love a table that could look like this, maybe also with restarts and age:

NAMESPACE              NAME                                                    READY   STATUS             RESTARTS      AGE
authentik              authentik-postgresql-0                                  0/1     Running            1 (17s ago)   53d
authentik              authentik-redis-master-0                                0/1     Running            1 (17s ago)   53d
cert-manager           cert-manager-b6fd485d9-vm569                            1/1     Running            1 (17s ago)   53d
cert-manager           cert-manager-cainjector-dcc5966bc-5g2cn                 1/1     Running            1 (17s ago)   53d
cert-manager           cert-manager-webhook-dfb76c7bd-f88md                    0/1     Running            1 (17s ago)   53d

For the data source i'm using prometheus with all the standard metrics such as:

Can anyone more experienced that me give me a query or a dashboard i could import? :)


Solution

  • kube_pod_info → namespace, pod name

    kube_pod_status_phase → status

    kube_pod_container_status_ready → ready containers

    kube_pod_container_status_restarts_total → restarts

    kube_pod_created → age (use transformation: now() - created)

    Use Table panel with outer joins in transformations to merge by pod and namespace. This will give you a table with:

    NAMESPACE | NAME | READY | STATUS | RESTARTS | AGE

    Also you can use json from readymade dashboard available at market place.