/
prometheus-deployment.yml
117 lines (116 loc) · 3.48 KB
/
prometheus-deployment.yml
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
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
namespace: monitoring
labels:
app: prometheus-server
spec:
replicas: 1
selector:
matchLabels:
app: prometheus-server
template:
metadata:
labels:
app: prometheus-server
spec:
# Deployment has PodAntiAffinity configured to ensure that
# the scheduler does not co-locate replicas on a single node.
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- prometheus-server
topologyKey: "kubernetes.io/hostname"
securityContext:
fsGroup: 65534
runAsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
containers:
- name: prometheus-server-configmap-reload
image: jimmidyson/configmap-reload:v0.8.0
imagePullPolicy: IfNotPresent
args:
- '--volume-dir=/etc/config'
- '--webhook-url=http://127.0.0.1:9090/-/reload'
volumeMounts:
- name: prometheus-config-volume
readOnly: true
mountPath: /etc/config
- name: prometheus
image: prom/prometheus:v2.34.0
imagePullPolicy: IfNotPresent
args:
- "--storage.tsdb.retention.time=28d"
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus/"
- "--enable-feature=expand-external-labels"
- "--web.enable-lifecycle"
envFrom:
- secretRef:
name: prometheus-cluster-name
ports:
- containerPort: 9090
protocol: TCP
resources:
limits:
memory: 3Gi
cpu: 1000m
requests:
memory: 1536Mi
cpu: 150m
volumeMounts:
- name: prometheus-config-volume
mountPath: /etc/prometheus/
readOnly: true
- name: prometheus-storage-volume
mountPath: /prometheus/
livenessProbe:
httpGet:
path: /-/healthy
port: 9090
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /-/ready
port: 9090
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
# See https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
#initContainers:
# - name: fix-nfs-permissions
# image: busybox
# command: ["sh", "-c", "chown -R 65534:65534 /prometheus"]
# securityContext:
# runAsUser: 0
# runAsNonRoot: false
# volumeMounts:
# - name: prometheus-storage-volume
# mountPath: /prometheus
restartPolicy: Always
terminationGracePeriodSeconds: 60
volumes:
- name: prometheus-config-volume
configMap:
defaultMode: 420
name: prometheus-server-conf
- name: prometheus-storage-volume
persistentVolumeClaim:
claimName: nfs-pvc-prometheus
strategy:
type: Recreate