Skip to content

Commit 4dde865

Browse files
committed
Added monitoring into the architecture
1 parent 5c3aa16 commit 4dde865

4 files changed

Lines changed: 86 additions & 0 deletions

File tree

monitoring/deployment.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: prometheus
5+
namespace: monitoring
6+
7+
spec:
8+
replicas: 1
9+
10+
selector:
11+
matchLabels:
12+
app: prometheus
13+
14+
template:
15+
metadata:
16+
labels:
17+
app: prometheus
18+
19+
spec:
20+
containers:
21+
22+
- name: prometheus
23+
image: prom/prometheus:latest
24+
args:
25+
- "--config.file=/etc/prometheus/prometheus.yml"
26+
27+
ports:
28+
- containerPort: 9090
29+
30+
volumeMounts:
31+
- name: prometheus-config
32+
mountPath: /etc/prometheus
33+
34+
volumes:
35+
- name: prometheus-config
36+
configMap:
37+
name: prometheus-config

monitoring/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: monitoring

monitoring/prometheus.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: prometheus-config
5+
namespace: monitoring
6+
7+
data:
8+
prometheus.yml: |
9+
global:
10+
scrape_interval: 15s
11+
evaluation_interval: 15s
12+
13+
scrape_configs:
14+
15+
- job_name: "prometheus"
16+
static_configs:
17+
- targets:
18+
- localhost:9090
19+
20+
- job_name: "frontend"
21+
static_configs:
22+
- targets:
23+
- frontend-service.three-tier-app.svc.cluster.local:80
24+
25+
- job_name: "backend"
26+
static_configs:
27+
- targets:
28+
- backend-service.three-tier-app.svc.cluster.local:8080

monitoring/service.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
4+
metadata:
5+
name: prometheus
6+
namespace: monitoring
7+
8+
spec:
9+
10+
selector:
11+
app: prometheus
12+
13+
ports:
14+
- port: 9090
15+
targetPort: 9090
16+
17+
type: ClusterIP

0 commit comments

Comments
 (0)