ServiceMonitor not found in monitoring.coreos.com/v1

Steve picture Steve · Jun 29, 2018 · Viewed 7.8k times · Source

I am using kubeadm to deploy single node kubernetes 1.11 cluster. I am unable to find servicemonitor resources.

➜  kube-prometheus git:(master) ✗ kubectl get servicemonitor
error: the server doesn't have a resource type "servicemonitor"

➜  kube-prometheus git:(master) ✗ kubectl create -f manifests/prometheus-serviceMonitor.yaml
error: unable to recognize "manifests/prometheus-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"

How do I enable servicemonitor with kubeadm?

Answer

Andreas Jägle picture Andreas Jägle · Jun 30, 2018

The ServiceMonitor resource not part of Kubernetes itself. It is a custom resource which is part of the Prometheus operator as described here.

Make sure that you have installed the Prometheus operator (including the custom resources) beforehand to enable creating a ServiceMonitor object.