簡體   English   中英

Kubernetes 上的 Prometheus Presto-Exporter 配置

[英]Prometheus Presto-Exporter Configuration on Kubernetes

我正在嘗試使用 prometheus presto-exporter ( https://github.com/yahoojapan/presto_exporter ) 監控 Presto 指標。 我已經下載了 presto-exporter docker 映像並創建了部署和服務。 但是,我不太確定,如果我做得正確。 我在下面提供部署和服務配置。

部署配置


    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: presto-exporter

    spec:
      replicas: 1
      selector:
        matchLabels:
          app: presto-exporter
      template:
        metadata:
          labels:
            app: presto-exporter
        spec:
          containers:
          - env:
            - name: web_url
              # (login credentials are required to access presto which is (username:=<domain\username>, password=<password with special characters>))
              value: "https://<vm_url>:<nodeport>/v1/cluster"
            - name: log_level
              value: "debug"
            - name: insecure_skip_verify
              value: "true"
            image: <registry-ip>/presto-exporter:latest
            imagePullPolicy: IfNotPresent
            name: presto-exporter
            ports:
            - containerPort: 9483
              protocol: TCP
          imagePullSecrets:
          - name: <registry-secret>

服務配置


    apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: presto-exporter
      name: presto-exporter
    spec:
      ports:
      - name: metrics
        port: 8280
        protocol: TCP
        targetPort: 9483
      selector:
        app: presto-exporter
      type: ClusterIP

我懷疑環境變量的使用是否正確。 此外,導出器沒有任何用於用戶名和密碼的變量,並且我無法使用僅帶有 --web.url 標志的 presto 憑據。
正在運行的 pod 的日志給了我


    kubectl logs presto-exporter-6dfd7db784-pqv7v
    time="2020-08-05T07:42:50Z" level=info msg="Starting presto_exporter (version=0.1.0, branch=master, revision=6eb4094fcd17f7fb82a393b527e3b0536ff1b38c)" source="presto_exporter.go:121"
    time="2020-08-05T07:42:50Z" level=info msg="Build context (go=go1.12.1, user=root@9756c8050182, date=20190323-04:33:01)" source="presto_exporter.go:122"
    time="2020-08-05T07:42:50Z" level=info msg="Listening on :9483" source="presto_exporter.go:137"
    time="2020-08-05T07:42:56Z" level=error msg="Get http://localhost:8080/v1/cluster: dial tcp 127.0.0.1:8080: connect: connection refused" source="presto_exporter.go:145"
    time="2020-08-05T07:43:01Z" level=error msg="Get http://localhost:8080/v1/cluster: dial tcp 127.0.0.1:8080: connect: connection refused" source="presto_exporter.go:145"
    time="2020-08-05T07:43:01Z" level=error msg="Get http://localhost:8080/v1/cluster: dial tcp 127.0.0.1:8080: connect: connection refused" source="presto_exporter.go:145"
    time="2020-08-05T07:43:06Z" level=error msg="Get http://localhost:8080/v1/cluster: dial tcp 127.0.0.1:8080: connect: connection refused" source="presto_exporter.go:145"
    time="2020-08-05T07:43:06Z" level=error msg="Get http://localhost:8080/v1/cluster: dial tcp 127.0.0.1:8080: connect: connection refused" source="presto_exporter.go:145"

任何幫助將不勝感激。 如果您需要更多信息,請告訴我。 提前致謝...

編輯

我在 sidecar 容器中嘗試了不同的選項,並且我已經復制了迄今為止我嘗試過的所有內容。 我已經使用 envFrom 添加了其中包含證書和憑據的 configmap,並且還嘗試使用在主容器中提到的 volumeMounts。

- name: presto-exporter
          args:
          - "--web.url=https://<vm_ip>:8901"
          - "--log.level=debug"
          image: <registry_ip>/presto-exporter:latest
          imagePullPolicy: IfNotPresent
          envFrom:
          - configMapRef:
              name: presto-master-config
          ports:
            - containerPort: 9483
              protocol: TCP
          volumeMounts:
            - mountPath: /usr/lib/presto/configmap
              name: presto-master-config
            - mountPath: /usr/lib/presto/plugin/
              name: presto-plugin
            - mountPath: /usr/lib/presto/default/etc/catalog
              name: presto-catalog
            - mountPath: /certs
              name: <cert_name>

如果我注釋掉--web.url arg,我會收到與“連接被拒絕”之前相同的錯誤,使用“localhost:8901”也是如此。 如果我使用 vm IP 和主容器的端口,我只能訪問 url。

現在,如果我 curl " http://<vm_ip>:9483/metrics " 並查看日志,我遇到了認證問題。

level=error msg="Get https://<vm_ip>:8901: x509: certificate signed by unknown authority

如果我在--web-url arg 中嘗試使用 http 那么我得到

level=error msg="Get http://<vm_ip>:8901: net/http: HTTP/1.x transport connection broken: malformed HTTP response

所以,我想我必須使用 https 並找到解決認證問題的方法......

這個 Prometheus 導出器可以從 presto 集群中抓取指標,它應該安裝在 presto 集群的協調器服務器中。

這意味着導出器映像應該位於 presto 集群中協調器 pod 的 sidecar 容器中。 然后它將能夠從http://localhost:8080/v1/cluster URL 中抓取指標。

如果您真的希望它位於單獨的 pod 中,則需要提供標志-web.url而不是 env web_url

      containers:
      - args:
        - "-web.url=http://<vm_url>:<nodeport>/v1/cluster"
        image: <registry-ip>/presto-exporter:latest
        imagePullPolicy: IfNotPresent
        name: presto-exporter
        ports:
        - containerPort: 9483
          protocol: TCP

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM