提问者:小点点

GKE上的普罗米修斯监控StrimziKafka-如何获得普罗米修斯吊舱IP


我正在尝试在GKE上部署Prometheus来监控现有的Strimzi Kafka GKE集群,并且遇到了问题。(参考https://strimzi.io/docs/operators/latest/deploying.html#proc-metrics-deploying-prometheus-operator-str)

以下是所做的:

  • 创建了一个命名空间-监控,而Kafka部署在命名空间-kafka
  • 修改了kafka-部署. yaml,以包含metricsConfig和KafkaExter,如文件https://github.com/strimzi/strimzi-kafka-operator/tree/0.26.0/examples/metrics/kafka-metrics.yaml中指定的那样

以下是变化:

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: ".*" 
 

将更改应用于Kafka集群的命令:

kubectl apply -f kafka-deployment.yaml -n kafka
command :
curl -s https://raw.githubusercontent.com/coreos/prometheus-operator/master/bundle.yaml > bundle.yaml

在bundle. yaml中将命名空间更改为“监控”并创建了Prometheous运算符

kubectl create -f bundle.yaml -n monitoring 

运行以下命令来创建Prometheus

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 

当我检查在命名空间监控上创建的对象时,以下是列出的内容:

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

问题是-我如何获得Prometheus安装的主机名(因为我需要将其添加为Grafana中的源代码)?不知何故,我没有看到prometheus pod,应该不创建吗?

有什么想法如何调试/修复这个?蒂亚!


共2个答案

匿名用户

假设Prometheus pod确实启动了,它们的集体主机名将通过服务发现找到,例如prometheus.监控. svc.club.local

https://cloud.google.com/kubernetes-engine/docs/concepts/service-discovery

你也可能对揭露普罗米修斯本身很感兴趣

匿名用户

此问题已解决,文件prometheus-add. yaml已经是一个秘密yaml文件,应该使用命令创建秘密

kubectl create -f prometheus-additional.yaml

instead of :

kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml

裁判-https://issueexplorer.com/issue/strimzi/strimzi-kafka-operator/5873

在最近的strimzi版本中,文件的格式似乎发生了变化