【发布时间】:2017-07-04 23:49:32
【问题描述】:
我之前创建了一个包含三个容器的 pod,即 prometheus、blackbox-exporter 和 python-access-api。 blackbox-exporter 在端口 9115 上运行并抓取由 python-access-api 容器生成的目标,该容器会在 prometheus 中发出 SSL 到期警报目标证书。现在我想将 blackbox-exporter 移动到不同的 pod。我试图通过 service 建立它,但我现在无法建立 prometheus 和 blackbox-exporter 之间的通信,因为它们位于不同的吊舱。因此,我无法对 SSL 到期证书进行探测,因此无法在 prometheus 上看到警报。下面是我用过的yaml文件,有没有人能指出解决这个问题的方法。请注意,我的配置对于 prometheus 看起来不错,并且 blackbox 和 prometheus 的 pod 单独运行良好。就像我上面说的,我没有看到他们相互交流。
apiVersion: v1
kind: ReplicationController
metadata:
name: blackbox-deployment
labels:
app: prometheus
spec:
replicas: 1
selector:
app: blackbox
template:
metadata:
name: blackbox
labels:
app: blackbox
spec:
containers:
- name: blackbox
Prometheus 部署的 Yaml 文件
apiVersion: v1
kind: ReplicationController
metadata:
name: python-daemon
labels:
app: prometheus-python
spec:
replicas: 1
selector:
app: python
template:
metadata:
name: python
labels:
app: python
spec:
containers:
我已经部署的服务:-
apiVersion: v1
kind: Service
metadata:
name: prometheus
spec:
selector:
app: prometheus
ports:
- name: http
port: 80
targetPort: 9115
protocol: TCP
prometheus 配置如下
- job_name: blackbox
params:
module:
- http_2xx
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /probe
scheme: http
file_sd_configs:
- files:
- /var/suhas/targets.yml
refresh_interval: 5m
relabel_configs:
- source_labels: [__address__]
separator: ;
regex: (.*)
target_label: __param_target
replacement: $1
action: replace
- source_labels: [__param_target]
separator: ;
regex: (.*)
target_label: instance
replacement: $1
action: replace
- source_labels: []
separator: ;
regex: (.*)
target_label: __address__
replacement: prometheus:9115
action: replace
【问题讨论】:
标签: kubernetes microservices prometheus