M monitoring/prometheus/configmap.yaml => monitoring/prometheus/configmap.yaml +3 -0
@@ 4,6 4,9 @@ metadata:
name: configs
data:
prometheus.yml: |
+ global:
+ external_labels:
+ prometheus_instance: kubernetes
scrape_configs:
- job_name: kubelet-cadvisor
metrics_path: /metrics/cadvisor
M monitoring/prometheus/deployment.yaml => monitoring/prometheus/deployment.yaml +32 -0
@@ 20,6 20,7 @@ spec:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=1w
+ - --web.enable-lifecycle
# leave compaction to thanos
- --storage.tsdb.min-block-duration=2h
- --storage.tsdb.max-block-duration=2h
@@ 31,10 32,41 @@ spec:
port: metrics
path: /-/healthy
volumeMounts:
+ - name: data
+ mountPath: /prometheus
- name: configs
mountPath: /etc/prometheus
+ - name: thanos-sidecar
+ image: quay.io/thanos/thanos:THANOS_VERSION
+ args:
+ - sidecar
+ - --tsdb.path=/prometheus
+ - --objstore.config-file=/etc/thanos/objstore.yml
+ - --reloader.config-file=/etc/prometheus/prometheus.yml
+ securityContext: # match prometheus
+ runAsUser: 65534
+ runAsGroup: 65534
+ ports:
+ - name: sidecar-metrics
+ containerPort: 10902
+ readinessProbe:
+ httpGet:
+ port: sidecar-metrics
+ path: /-/healthy
+ volumeMounts:
+ - name: data
+ mountPath: /prometheus
+ - name: configs
+ mountPath: /etc/prometheus
+ - name: thanos
+ mountPath: /etc/thanos
serviceAccountName: prometheus
volumes:
- name: configs
configMap:
name: configs
+ - name: thanos
+ secret:
+ secretName: thanos
+ - name: data # TODO persist
+ emptyDir: {}
M monitoring/prometheus/kustomization.yaml => monitoring/prometheus/kustomization.yaml +3 -0
@@ 6,6 6,9 @@ labels:
app: prometheus
includeTemplates: true
includeSelectors: true
+images:
+ - name: quay.io/thanos/thanos
+ newTag: v0.37.2
resources:
- namespace.yaml
- deployment.yaml