-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmonitoring-prometheus.yaml
More file actions
132 lines (132 loc) · 3.81 KB
/
Copy pathmonitoring-prometheus.yaml
File metadata and controls
132 lines (132 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{{- if .Values.monitoring.enabled }}
# In-namespace Prometheus. Scrapes the services over stable in-cluster Service
# DNS via static_configs — no kubernetes_sd, so no RBAC/CRDs are required. Stays
# ClusterIP (internal-only); Grafana is the public face.
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
labels:
{{- include "calorieasy.labels" . | nindent 4 }}
data:
prometheus.yml: |
global:
scrape_interval: {{ .Values.monitoring.prometheus.scrapeInterval }}
rule_files:
- /etc/prometheus/alerts.yml
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: auth-service
metrics_path: /actuator/prometheus
static_configs:
- targets: ['auth-service:8081']
- job_name: meals-service
metrics_path: /actuator/prometheus
static_configs:
- targets: ['meals-service:8082']
- job_name: analytics-service
metrics_path: /actuator/prometheus
static_configs:
- targets: ['analytics-service:8083']
- job_name: genai-service
metrics_path: /metrics
static_configs:
- targets: ['genai-service:8084']
{{- if .Values.weaviate.enabled }}
- job_name: weaviate
static_configs:
- targets: ['weaviate:2112']
{{- end }}
# Alerting rules, mounted alongside prometheus.yml at /etc/prometheus. Canonical
# source is the chart's alerts.yml (also mounted into docker-compose prometheus).
alerts.yml: |
{{ .Files.Get "alerts.yml" | indent 4 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
labels:
app: prometheus
{{- include "calorieasy.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
securityContext:
runAsNonRoot: true
runAsUser: 65534
fsGroup: 65534
containers:
- name: prometheus
image: {{ .Values.monitoring.prometheus.image }}
args:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time={{ .Values.monitoring.prometheus.retention }}
ports:
- containerPort: 9090
volumeMounts:
- name: config
mountPath: /etc/prometheus
- name: data
mountPath: /prometheus
readinessProbe:
httpGet: { path: /-/ready, port: 9090 }
periodSeconds: 10
livenessProbe:
httpGet: { path: /-/healthy, port: 9090 }
periodSeconds: 15
resources:
{{- toYaml .Values.monitoring.prometheus.resources | nindent 12 }}
volumes:
- name: config
configMap:
name: prometheus-config
- name: data
{{- if .Values.monitoring.prometheus.persistence.enabled }}
persistentVolumeClaim:
claimName: prometheus-data
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.monitoring.prometheus.persistence.enabled }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prometheus-data
labels:
{{- include "calorieasy.labels" . | nindent 4 }}
spec:
accessModes: ["ReadWriteOnce"]
{{- if .Values.monitoring.prometheus.persistence.storageClass }}
storageClassName: {{ .Values.monitoring.prometheus.persistence.storageClass | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.monitoring.prometheus.persistence.size }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: prometheus
labels:
app: prometheus
{{- include "calorieasy.labels" . | nindent 4 }}
spec:
selector:
app: prometheus
ports:
- port: 9090
targetPort: 9090
{{- end }}