我正在尝试使用prometheus-Presto导出器监视Presto度量(https://github.com/yahoojapan/presto_exporter)。我已经下载了presto导出器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:=<domainusername>, 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
我怀疑环境变量的使用是否正确。此外,导出器没有任何用户名和密码变量,我在使用presto的凭据时遇到了问题,只有--web.url标志。
运行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的唯一方法。
现在如果我卷曲";CCD_ 2";查看日志,我收到了证书问题。
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中,则需要提供flag-web.url而不是envweb_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