kubernetesprometheusgrafanaprometheus-alertmanagergrafana-templating

Grafana Dashboards list pods within namespace not working


I have grafana Dashboards, Pods drop down coming None within namespace, however we have pods running in namespace and pulling data prometheus.

Screenshot:

enter image description here

Query:

          "datasource": "Prometheus",
          "definition": "",
          "description": null,
          "error": null,
          "hide": 0,
          "includeAll": false,
          "label": "Pod",
          "multi": false,
          "name": "pod",
          "options": [],
          "query": {
            "query": "query_result(sum(container_memory_working_set_bytes{namespace=\"$namespace\"}) by (pod_name))",
            "refId": "Prometheus-pod-Variable-Query"
          },
          "refresh": 1,
          "regex": "/pod_name=\\\"(.*?)(\\\")/",
          "skipUrlSync": false,
          "sort": 0,
          "tagValuesQuery": "",
          "tags": [],
          "tagsQuery": "",
          "type": "query",
          "useTags": false

I am imported json code: https://grafana.com/grafana/dashboards/6879


Solution

  • Edit your dashboard's JSON:
    Rename "pod_name" to "pod" in the 2 places (and save)

    Looks like this grafana dashboard was created with older kubernetes version,
    and metrics internals since changed.

    Probably will also need similar edits for "container_name" changing to "container" in these older dashboards