10 Commits

Author SHA1 Message Date
Raffael H
a747f04036 Update thanos sidecar and store config 2023-10-16 13:51:48 +02:00
Thomas Philipona
1afef4726f don't pull always 2023-10-15 18:35:36 +02:00
Thomas Philipona
b52f889da1 Reorder values 2023-10-15 12:48:36 +02:00
Thomas Philipona
e47ae75947 Fix blackbox svc name 2023-10-15 12:24:00 +02:00
Thomas Philipona
753c3dd95f Add Grafana service monitor and simplify datasource 2023-10-14 13:00:47 +02:00
Thomas Philipona
628f64b1e8 Remove Grafana Datasource 2023-10-14 11:59:06 +02:00
Thomas Philipona
a88b2af56d Initial values.yaml default 2023-10-14 11:56:47 +02:00
Thomas Philipona
faecd0aa8d Add Prometheus Service Monitor 2023-10-14 11:44:56 +02:00
Raffael H
905d5a2d09 Add blackboxexporter 2023-10-12 18:21:37 +02:00
Raffael H
0ad1aae355 Fix thanos version and store 2023-10-12 18:09:34 +02:00
16 changed files with 83 additions and 149 deletions

View File

@@ -16,6 +16,6 @@ spec:
spec:
containers:
- image: quay.io/acend/example-web-python
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
name: example-web-python
restartPolicy: Always

View File

@@ -1,23 +0,0 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -1,6 +0,0 @@
dependencies:
- name: kube-prometheus-stack
repository: https://prometheus-community.github.io/helm-charts
version: 51.5.3
digest: sha256:8e25b83cde5acfd903c3e45f30b9ae28201f9dd68daab1aeca709f1185608916
generated: "2023-10-12T13:25:38.219319684+02:00"

View File

@@ -1,29 +0,0 @@
apiVersion: v2
name: user-monitoring-stack
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
dependencies:
- name: kube-prometheus-stack
condition: promstack.enabled
version: "51.5.3"
repository: "https://prometheus-community.github.io/helm-charts"

View File

@@ -1,73 +0,0 @@
promstack:
enabled: true
kube-prometheus-stack:
prometheus:
enabled: true
prometheusSpec:
resources:
requests:
cpu: 100m
memory: 400Mi
scrapeInterval: 60s
serviceMonitorNamespaceSelector:
matchLabels:
user: <user>
serviceMonitorSelector: {}
podMonitorNamespaceSelector:
matchLabels:
user: <user>
podMonitorSelector: {}
probeNamespaceSelector:
matchLabels:
user: <user>
ruleSelectorNilUsesHelmValues: false
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
probeSelectorNilUsesHelmValues: false
serviceAccount:
create: true
name: "prometheus-<user>"
grafana:
enabled: false
alertmanager:
enabled: false
kubernetesServiceMonitors:
enabled: false
# not relevant for the lab
crds:
enabled: false
kubeProxy:
enabled: false
kubeScheduler:
enabled: false
kubeControllerManager:
enabled: false
kubeEtcd:
enabled: false
kubeApiServer:
enabled: false
kubelet:
enabled: false
coreDns:
enabled: false
kubeStateMetrics:
enabled: false
nodeExporter:
enabled: false
prometheusOperator:
enabled: false
kubeletService:
enabled: false
defaultRules:
create: false
global:
rbac:
create: false
createAggregateClusterRoles: false

View File

@@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.5
version: 0.2.6
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@@ -0,0 +1,18 @@
{{- define "blackboxexporter.svc" }}
---
apiVersion: v1
kind: Service
metadata:
name: blackbox
labels:
app.kubernetes.io/name: blackbox-exporter
spec:
ports:
- name: http
port: 9115
protocol: TCP
targetPort: 9115
selector:
app.kubernetes.io/name: blackbox-exporter
type: ClusterIP
{{- end }}

View File

@@ -16,7 +16,7 @@ stringData:
access: proxy
editable: false
type: prometheus
url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902
url: http://thanos-query:10902
version: 1
{{- if .Values.grafana.datasources }}
{{- toYaml .Values.grafana.datasources | nindent 6 }}

View File

@@ -0,0 +1,23 @@
{{- define "grafana.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: grafana-monitor
spec:
endpoints:
- basicAuth:
password:
name: basic-auth
key: {{ .Values.user }}
username:
name: basic-auth
key: grafana_user
interval: 60s
port: http
scheme: http
path: /metrics
selector:
matchLabels:
app.kubernetes.io/name: grafana
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- define "prometheus.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: prometheus
user: {{ .Values.user }}
name: {{ .Values.user }}-prometheus-servicemonitor
spec:
endpoints:
- path: /metrics
port: web
namespaceSelector:
matchNames:
- {{ .Values.user }}-monitoring
selector:
matchLabels:
operated-prometheus: 'true'
{{- end }}

View File

@@ -7,6 +7,10 @@ metadata:
app.kubernetes.io/name: prometheus
name: prometheus
spec:
{{- if .Values.query.enabled }}
thanos:
image: quay.io/thanos/thanos:v0.32.3
{{- end }}
scrapeInterval: 60s
serviceAccountName: prometheus-{{ .Values.user }}
serviceMonitorNamespaceSelector:

View File

@@ -25,10 +25,11 @@ spec:
- --query.replica-label=thanos_ruler_replica
- --endpoint=prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901
- --endpoint=thanos-ruler-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901
- --endpoint=prometheus-operated.monitoring.svc.cluster.local:10901
- --store=dnssrv+prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local
- --store=dnssrv+_web._tcp.prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local
- --store=dnssrv+_grpc._tcp.kube-prometheus-stack-thanos-discovery.monitoring.svc.cluster.local
- --store.unhealthy-timeout=3d
image: quay.io/thanos/thanos:v0.25.1
image: quay.io/thanos/thanos:v0.32.3
name: thanos-query
ports:
- containerPort: 10902

View File

@@ -4,6 +4,13 @@
{{- template "alertmanager.alertmanager" . }}
{{- end }}
# blackboxexporter
{{- if .Values.blackboxexporter.enabled }}
{{- template "blackboxexporter.cm" . }}
{{- template "blackboxexporter.deploy" . }}
{{- template "blackboxexporter.svc" . }}
{{- end }}
# grafana
{{- if .Values.grafana.enabled }}
{{- template "grafana.datasource" . }}
@@ -12,6 +19,7 @@
{{- template "grafana.svc" . }}
{{- template "grafana.sa" . }}
{{- template "grafana.deploy" . }}
{{- template "grafana.servicemonitor" . }}
{{- template "grafana.ingress" . }}
{{- end }}
@@ -19,6 +27,7 @@
{{- if .Values.prometheus.enabled }}
{{- template "prometheus.ingress" . }}
{{- template "prometheus.prometheus" . }}
{{- template "prometheus.servicemonitor" . }}
{{- template "prometheus.role" . }}
{{- template "prometheus.rolebinding" . }}
{{- template "prometheus.sa" . }}

View File

@@ -1,32 +1,22 @@
user: <user> # Replace me
# prometheus
prometheus:
enabled: false
# thanos-query
query:
enabled: false
# grafana
grafana:
datasources:
- name: prometheus
access: proxy
editable: false
type: prometheus
url: http://prometheus-operated.<user>-monitoring.svc.cluster.local:9090
enabled: false
# blackboxexporter
blackboxexporter:
enabled: false
# pushgateway
pushgateway:
enabled: false
# alertmanager
alertmanager:
enabled: false
# thanos-ruler
ruler:
enabled: false