普罗米修斯与Kubernetes v1.16不兼容



我安装了stable/prometheus helm chart,并在helm/charts#17268中提出了一些小的更改,使其与Kubernetes v1.16 兼容

安装后,没有一个Kubernetes grafana面板显示正确的值。我正在使用8769(https://grafana.com/grafana/dashboards/8769)仪表板,它提供了许多关于cpu、内存、网络等的信息。这个仪表板在旧的k8s版本上工作正常,但在v1.16上没有显示任何结果。我还随机尝试了一些其他面板(8588、6879、10551(,但它们要么只显示每个pod的请求资源,而不显示实时使用情况,要么什么都不显示。

这些仪表板所做的是向prometheus发送promql查询并获得结果。例如,这是来自8769仪表板的cpu使用情况的promql查询:

sum (rate (container_cpu_usage_seconds_total{id!="/",namespace=~"$Namespace",pod_name=~"^$Deployment.*$"}[1m])) by (pod_name)

我不知道是必须更改promql,还是问题出在其他地方。

Kubernetes 1.16从cAdvisor度量,pod和容器的副本。

您需要更改Grafana面板JSON模型中的pod_name->pod、container_name->container。

尝试这样安装,因为新的CRD有一些问题,所以我使用了旧的CRD-

kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.32/example/prometheus-operator-crd/alertmanager.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.32/example/prometheus-operator-crd/prometheus.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.32/example/prometheus-operator-crd/prometheusrule.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.32/example/prometheus-operator-crd/servicemonitor.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.32/example/prometheus-operator-crd/podmonitor.crd.yaml
helm install --name prometheus --namespace monitoring  stable/prometheus-operator --set prometheusOperator.createCustomResource=false

确保CRD不存在,您可以通过删除它们

kubectl delete crd --all

最新更新