[英]Prometheus on GKE to monitor Strimzi Kafka - how to get the Prometheus Pod IP
I'm trying to deploy Prometheus on GKE to monitor an existing Strimzi Kafka GKE cluster, and am facing issues.我正在尝试在 GKE 上部署 Prometheus 以监控现有的 Strimzi Kafka GKE 集群,但我正面临问题。 (ref - https://strimzi.io/docs/operators/latest/deploying.html#proc-metrics-deploying-prometheus-operator-str )
(参考 - https://strimzi.io/docs/operators/latest/deploying.html#proc-metrics-deploying-prometheus-operator-str )
Here is what is done:这是完成的:
here are the changes:以下是更改:
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: prom-graf #1
spec:
kafka:
version: 3.0.0
........
metricsConfig:
type: jmxPrometheusExporter
valueFrom:
configMapKeyRef:
name: kafka-metrics
key: kafka-metrics-config.yml
zookeeper:
......
metricsConfig:
type: jmxPrometheusExporter
valueFrom:
configMapKeyRef:
name: kafka-metrics
key: zookeeper-metrics-config.yml
entityOperator: #11
topicOperator: {}
userOperator: {}
kafkaExporter:
topicRegex: ".*"
groupRegex: ".*"
Command to apply changes to Kafka cluster:将更改应用到 Kafka 集群的命令:
kubectl apply -f kafka-deployment.yaml -n kafka
command :
curl -s https://raw.githubusercontent.com/coreos/prometheus-operator/master/bundle.yaml > bundle.yaml
changed the namespace to 'monitoring' in bundle.yaml and created the Prometheous operator在 bundle.yaml 中将命名空间更改为“监控”并创建 Prometheous 运算符
kubectl create -f bundle.yaml -n monitoring
Ran the following commands to create the Prometheus & Grafana on GKE: files are the same as in github - https://github.com/strimzi/strimzi-kafka-operator/tree/0.26.0/examples/metrics , although i've mad the namespace changes运行以下命令在 GKE 上创建 Prometheus 和 Grafana:文件与 github - https://github.com/strimzi/strimzi-kafka-operator/tree/0.26.0/examples/metrics中的文件相同,尽管 i'我对命名空间的更改感到很疯狂
kubectl apply -f strimzi-pod-monitor.yaml
(changed namespace to kafka, since kafka is deployed in namespace kafka)
kubectl apply -f prometheus-rules.yaml -n monitoring
kubectl apply -f prometheus.yaml -n monitoring
kubectl apply -f grafana.yaml - monitoring
- created secret from file - prometheus-additional.yaml
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml -n monitoring
When i inspect the object created on namespace - monitoring, here is what is listed:当我检查在命名空间 - 监控上创建的 object 时,列出的内容如下:
Karans-MacBook-Pro:prometheus-yamls karanalang$ kc get all,prometheus -n monitoring
NAME READY STATUS RESTARTS AGE
pod/grafana-5ccfb68647-55mzk 0/1 Running 0 21s
pod/prometheus-operator-85d84bb848-57lrn 1/1 Running 0 46m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/grafana ClusterIP 10.100.3.10 <none> 3000/TCP 21s
service/prometheus-operator ClusterIP None <none> 8080/TCP 46m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/grafana 0/1 1 0 24s
deployment.apps/prometheus-operator 1/1 1 1 46m
NAME DESIRED CURRENT READY AGE
replicaset.apps/grafana-5ccfb68647 1 1 0 23s
replicaset.apps/prometheus-operator-85d84bb848 1 1 1 46m
NAME VERSION REPLICAS AGE
prometheus.monitoring.coreos.com/prometheus 3 44m
Question is - how do i get the hostname for the Prometheus install (since i need this to add as source in Grafana)?问题是 - 我如何获取 Prometheus 安装的主机名(因为我需要将其添加为 Grafana 中的源)? Somehow, i don't see the prometheus pod, should that not be created?
不知何故,我没有看到 prometheus pod,不应该创建它吗?
any ideas how to debug/fix this?任何想法如何调试/修复这个? tia !
蒂亚!
Assuming that the Prometheus pods did start, their collective hostnames would be found via service discovery like prometheus.monitoring.svc.cluster.local
假设 Prometheus pod 确实启动了,它们的集体主机名将通过服务发现找到,例如
prometheus.monitoring.svc.cluster.local
https://cloud.google.com/kubernetes-engine/docs/concepts/service-discovery https://cloud.google.com/kubernetes-engine/docs/concepts/service-discovery
You might also be interesting in exposing Prometheus itself你可能对暴露普罗米修斯本身也很感兴趣
this issue is resolved, file prometheus-additional.yaml is already a secret yaml file, and the secret should be created using command此问题已解决,文件 prometheus-additional.yaml 已经是秘密 yaml 文件,应使用命令创建秘密
kubectl create -f prometheus-additional.yaml
instead of :
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml
ref - https://issueexplorer.com/issue/strimzi/strimzi-kafka-operator/5873参考 - https://issueexplorer.com/issue/strimzi/strimzi-kafka-operator/5873
seems the format of the file is changed in the recent strimzi releases似乎文件的格式在最近的 strimzi 版本中发生了变化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.