Grafana shows dead kubernetes pods from influxdb

5/14/2018

I'm using grafana heapster influxdb to monitor my kubernetes cluster and when I go into the pods section in the dashboard I need to sort through many pods which are no longer running.

How can I eliminate these pods from the database or at least make my template filter out these pods?

Thanks in advance

-- Yonah Dissen
grafana
heapster
influxdb
kubernetes

1 Answer

5/17/2018

You can add on the influxdb a retention policy :

CREATE RETENTION POLICY "2hours" ON "k8s" DURATION 2h REPLICATION 1

CREATE CONTINUOUS QUERY current_pods_query ON k8s BEGIN SELECT max(value) AS value INTO k8s."2hours".current_pods FROM k8s."default".uptime WHERE type = 'pod' GROUP BY time(5m), namespace_name, nodename, pod_name END

After this update your grafana template

-- Yonah Dissen
Source: StackOverflow