I had previously created a pod with three containers namely - prometheus, blackbox-exporter and python-access-api. The blackbox-exporter runs on port 9115 and scrapes the targets generated by python-access-api container which is alerted in the prometheus for SSL Expiry certificate of the targets. Now I want to move the blackbox- exporter to a different pod. I have tried to establish this via service but I am failing to establish the communication between prometheus and blackbox-exporter now, since they are in a different pod. And as a result of this, I am unable to make probe for SSL Expiry certificate and hence, cannot see the alerts on prometheus. Below is the yaml file that I have used, can anyone please point out a way out of this problem. Please note that my configuration looks fine for prometheus and also the pods for blackbox and prometheus are running fine individually. Like I said above, I dont see they communicate with each other.
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
Yaml file for Prometheus deployment
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:
The service that I have deployed:-
apiVersion: v1
kind: Service
metadata:
name: prometheus
spec:
selector:
app: prometheus
ports:
- name: http
port: 80
targetPort: 9115
protocol: TCP
The prometheus config is as follows
- 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