-
Notifications
You must be signed in to change notification settings - Fork 1
/
24prometheus-statefulset.yaml
100 lines (100 loc) · 3.22 KB
/
24prometheus-statefulset.yaml
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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: prometheus-server
labels: &Labels
k8s-app: prometheus
app.kubernetes.io/name: devargedor-cluster-monitoring
app.kubernetes.io/component: prometheus
spec:
serviceName: prometheus-svc
replicas: 1
podManagementPolicy: "Parallel"
updateStrategy:
type: "RollingUpdate"
selector:
matchLabels: *Labels
template:
metadata:
labels: *Labels
spec:
serviceAccountName: prometheus
# `chown` the Prometheus `/data` directory so that Prometheus can write to it
initContainers:
- name: "init-chown-data"
image: debian:9
imagePullPolicy: IfNotPresent
command: ["chown", "-R", "65534:65534", "/data"]
volumeMounts:
- name: prometheus-data
mountPath: /data
subPath: ""
containers:
- name: prometheus-server
# Use the `quay.io/prometheus/prometheus:v2.11.1` image
# Docker HUB : prom/prometheus:v2.12.0
image: quay.io/prometheus/prometheus:v2.12.0
imagePullPolicy: IfNotPresent
args:
- --config.file=/etc/config/prometheus.yaml
- --storage.tsdb.path=/data
- --storage.tsdb.retention.time=7d
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
ports:
- containerPort: 9090
# Probe the `/-/ready` and `/-/healthy` endpoints
readinessProbe:
httpGet:
path: /-/ready
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
livenessProbe:
httpGet:
path: /-/healthy
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
# Based on 10 running nodes with 30 pods each
# Resource requests of `200m` of CPU and `1000Mi` of memory
resources:
requests:
cpu: 100m
memory: 400Mi
volumeMounts:
- name: config-volume
mountPath: /etc/config
- name: prometheus-data
mountPath: /data
subPath: ""
terminationGracePeriodSeconds: 300
volumes:
# The Prometheus ConfigMap is mounted into the Pods as a volume at `/etc/config`
- name: config-volume
configMap:
name: prometheus-server-conf
# Configures Pod anti-affinity so that Prometheus Pods are assigned to different Nodes.
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: k8s-app
operator: In
values:
- prometheus
topologyKey: "kubernetes.io/hostname"
# A `volumeClaimTemplate` of `16Gi` of Block Storage is configured and used for Prometheus data storage, mounted at `/data/`
volumeClaimTemplates:
- metadata:
name: prometheus-data
labels: *Labels
spec:
storageClassName: default
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "1Gi"