ConfigMap
yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config-ems
data:
prometheus.yml: |-
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "emsservice"
static_configs:
- targets:
- "192.165.25.160:9182"
- "192.165.25.161:9182"
- "192.165.25.162:9182"
- "192.165.25.163:9182"
- "192.165.25.164:9182"
- "192.165.25.165:9182"
- "192.165.25.166:9182"
- "192.165.25.167:9182"
Deployment
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: promems-deployment
spec:
replicas: 1
selector:
matchLabels:
app: promems
template:
metadata:
labels:
app: promems
spec:
containers:
- name: promems
image: prom/prometheus
command:
- "/bin/prometheus"
args:
- "--config.file=/etc/prometheus/prometheus.yml"
ports:
- containerPort: 9090
protocol: TCP
volumeMounts:
- name: promems
mountPath: /etc/prometheus
volumes:
- name: promems
configMap:
name: prometheus-config-ems
Service
yaml
kind: Service
apiVersion: v1
metadata:
labels:
app:
name: ems-service
namespace: default
spec:
type: NodePort
ports:
- name: http
port: 9090
targetPort: 9090
protocol: TCP
nodePort: 31004
selector:
app: promems