alert when pod is restarted: Prometheus on windows containers

4/22/2019

I have Prometheus setup for Windows containers which scrapes the metrics supported by the wmi_exporter. But I wanted some metrics that track the pod restarts, etc which are not part of that. I believe kube-state-metrics offers this functionality. But I could not find any way to install it on Windows containers. All the helm charts I found online have images that only work with Linux containers. So, is there any way to install it on Windows containers?

Is there any other better way to have alerts for pod/container restarts?

-- sai guru datt manchikanti
kube-state-metrics
kubernetes
prometheus
prometheus-alertmanager

1 Answer

4/23/2019

You can use kube-state-metrics like you said. From the Kubernetes control plane point of view, a pod/container restart is no different whether you are using Linux or Windows containers.

Keep in mind that the control plane is only supported on Linux so in case you only have Windows nodes on your cluster you can run the kube-state-metrics pod/container in your master(s), otherwise, you will need a Linux node. Alternatively, you can build the kube-state-metrics Windows Go binary and run it on a Windows pod/container, but that could be more troublesome.

You can use something like this with Alertmanager as an alert.

-- Rico
Source: StackOverflow