Skip to content

Commit 21a42fc

Browse files
author
Claudia
committed
prometheus setup
1 parent e247d08 commit 21a42fc

File tree

1 file changed

+103
-1
lines changed

1 file changed

+103
-1
lines changed

setup.KubeConEU25/README.md

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,109 @@ nfs-client-simplenfs k8s-sigs.io/simplenfs-nfs-subdir-external-provisioner D
9494

9595
### Prometheus Setup
9696

97-
TODO
97+
We follow the setup provided by the `prometheus-community/kube-prometheus-stack` Helm chart.
98+
99+
```bash
100+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts && helm repo update
101+
```
102+
103+
The charts will install: Prometheus, Grafana, Alert Manager, Prometheus Node Exporter and Kube State Metrics. We set up the chart with the following:
104+
105+
- Persistent storage for Prometheus, Grafana and Alert Manager;
106+
- Override the Prometheus Node Exporter port;
107+
- Disable CRDs creation as they are already present.
108+
109+
You may leave the CRDs creation on, along with the default Node Exporter pod. These changes are needed when deploying a separate Prometheus instance in OpenShift.
110+
111+
```bash
112+
cat << EOF >> config.yaml
113+
crds:
114+
enabled: false
115+
116+
prometheus-node-exporter:
117+
service:
118+
port: 9110
119+
120+
alertmanager:
121+
alertmanagerSpec:
122+
persistentVolumeClaimRetentionPolicy:
123+
whenDeleted: Retain
124+
whenScaled: Retain
125+
storage:
126+
volumeClaimTemplate:
127+
spec:
128+
storageClassName: nfs-client-pokprod
129+
accessModes: ["ReadWriteOnce"]
130+
resources:
131+
requests:
132+
storage: 50Gi
133+
134+
prometheus:
135+
prometheusSpec:
136+
persistentVolumeClaimRetentionPolicy:
137+
whenDeleted: Retain
138+
whenScaled: Retain
139+
storageSpec:
140+
volumeClaimTemplate:
141+
spec:
142+
storageClassName: nfs-client-pokprod
143+
accessModes: ["ReadWriteOnce"]
144+
resources:
145+
requests:
146+
storage: 50Gi
147+
emptyDir:
148+
medium: Memory
149+
150+
grafana:
151+
persistence:
152+
enabled: true
153+
type: sts
154+
storageClassName: "nfs-client-pokprod"
155+
accessModes:
156+
- ReadWriteOnce
157+
size: 20Gi
158+
finalizers:
159+
- kubernetes.io/pvc-protection
160+
EOF
161+
162+
helm upgrade -i kube-prometheus-stack -n prometheus prometheus-community/kube-prometheus-stack --create-namespace -f config.yaml
163+
```
164+
165+
If deploying on OpenShift based systems, you need to assign the privileged security context to the service accounts that are created by the helm chart.
166+
167+
```bash
168+
oc adm policy add-scc-to-user privileged system:serviceaccount:prometheus:kube-prometheus-stack-admission system:serviceaccount:prometheus:kube-prometheus-stack-alertmanager system:serviceaccount:prometheus:kube-prometheus-stack-grafana system:serviceaccount:prometheus:kube-prometheus-stack-kube-state-metrics system:serviceaccount:prometheus:kube-prometheus-stack-operator system:serviceaccount:prometheus:kube-prometheus-stack-prometheus system:serviceaccount:prometheus:kube-prometheus-stack-prometheus-node-exporter
169+
```
170+
171+
You should expect the following pods:
172+
173+
```bash
174+
kubectl get pods
175+
```
176+
```bash
177+
NAME READY STATUS RESTARTS AGE
178+
alertmanager-kube-prometheus-stack-alertmanager-0 2/2 Running 0 16m
179+
kube-prometheus-stack-grafana-0 3/3 Running 0 16m
180+
kube-prometheus-stack-kube-state-metrics-6f76b98d89-pxs69 1/1 Running 0 16m
181+
kube-prometheus-stack-operator-7fbfc985bb-mm9bk 1/1 Running 0 16m
182+
kube-prometheus-stack-prometheus-node-exporter-44llp 1/1 Running 0 16m
183+
kube-prometheus-stack-prometheus-node-exporter-95gp8 1/1 Running 0 16m
184+
kube-prometheus-stack-prometheus-node-exporter-dxf5f 1/1 Running 0 16m
185+
kube-prometheus-stack-prometheus-node-exporter-f45dx 1/1 Running 0 16m
186+
kube-prometheus-stack-prometheus-node-exporter-pfrzk 1/1 Running 0 16m
187+
kube-prometheus-stack-prometheus-node-exporter-zpfzb 1/1 Running 0 16m
188+
prometheus-kube-prometheus-stack-prometheus-0 2/2 Running 0 16m
189+
```
190+
191+
To access the Grafana dashboard on `localhost:3000`:
192+
193+
```bash
194+
kubectl --namespace prometheus get secrets kube-prometheus-stack-grafana -o jsonpath="{.data.admin-password}" | base64 -d ; echo
195+
```
196+
```bash
197+
export POD_NAME=$(kubectl --namespace prometheus get pod -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=kube-prometheus-stack" -oname)
198+
kubectl --namespace prometheus port-forward $POD_NAME 3000
199+
```
98200

99201
### MLBatch Cluster Setup
100202

0 commit comments

Comments
 (0)