prometheus学习系列(一)

安装prometheus报错解决方法

prometheus学习系列(一)

安装prometheus报错解决方法

下载源代码安装prometheus-operator的时候报错

git clone https://github.com/coreos/kube-prometheus.git

执行

kubectl apply -f manifests/

报错

unable to recognize “manifests/0prometheus-operator-serviceMonitor.yaml”: no matches for kind “ServiceMonitor” in version “monitoring.coreos.com/v1”
unable to recognize “manifests/alertmanager-alertmanager.yaml”: no matches for kind “Alertmanager” in version “monitoring.coreos.com/v1”
unable to recognize "manifests/alertmanager-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/kube-state-metrics-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize “manifests/node-exporter-serviceMonitor.yaml”: no matches for kind “ServiceMonitor” in version “monitoring.coreos.com/v1”
unable to recognize “manifests/prometheus-prometheus.yaml”: no matches for kind “Prometheus” in version “monitoring.coreos.com/v1”
unable to recognize "manifests/prometheus-rules.yaml": no matches for kind "PrometheusRule" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitorApiserver.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitorCoreDNS.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitorKubeControllerManager.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitorKubeScheduler.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
unable to recognize "manifests/prometheus-serviceMonitorKubelet.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"

解决办法,再执行一次

kubectl apply -f manifests/

参考资料

GitHub - coreos/kube-prometheus: Use Prometheus to monitor Kubernetes and applications running on Kubernetes

Apply the kube-prometheus stack
The previous steps (compilation) has created a bunch of manifest files in the manifest/ folder. Now simply use kubectl to install Prometheus and Grafana as per your configuration:
# Update the namespace and CRDs, and then wait for them to be availble before creating the remaining resources
$ kubectl apply -f manifests/setup
$ kubectl apply -f manifests/
Alternatively, the resources in both folders can be applied with a single command kubectl apply -Rf manifests, but it may be necessary to run the command multiple times for all components to be created successfullly.
Check the monitoring namespace (or the namespace you have specific in namespace: ) and make sure the pods are running. Prometheus and Grafana should be up and running soon.

See also