23 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
Thomas Philipona
dbb0cc23da Fix layout 2023-10-12 12:20:48 +02:00
Thomas Philipona
73c8c6435f Update Scrape interval 2023-10-12 11:36:53 +02:00
Thomas Philipona
7385c2af41 Remove User Value from Argo App 2023-10-12 10:04:05 +02:00
Thomas Philipona
4482493d5f Fixes Argo App Setup 2023-10-12 09:26:43 +02:00
Raffael H
00ba693670 Change structure of argo applications 2023-10-11 15:26:13 +02:00
Raffael H
3fc8e332ea Bump Chart version 2023-10-11 12:30:58 +02:00
Raffael H
c58fbd2334 Add username to basic auth secret 2023-10-11 12:28:49 +02:00
Raffael H
4df31ddaf6 Add argo applications 2023-10-11 12:00:19 +02:00
Raffael H
9b00f330b3 Update grafana datasource to be dynamically added 2023-10-10 14:14:10 +02:00
Raffael H
7bf01de75f Bump Chart version 2023-10-05 13:51:08 +02:00
Raffael H
9687f504e1 Update charts with placeholders 2023-10-05 13:47:03 +02:00
Raffael H
8e43add4da Add basic auth secret to setup 2023-08-10 16:07:42 +02:00
Raffael H
7a01cc94b6 Add separators to named templates 2023-08-10 15:29:04 +02:00
37 changed files with 174 additions and 50 deletions

21
apps/user-demo.yaml Normal file
View File

@@ -0,0 +1,21 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: <user>-demo
namespace: argocd
spec:
destination:
namespace: <user>
server: https://kubernetes.default.svc
project: default
source:
repoURL: 'https://gitea.training.cluster.acend.ch/<user>/prometheus-training-lab-setup'
path: user-demo/
targetRevision: main
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- Replace=true

21
apps/user-prom-stack.yaml Normal file
View File

@@ -0,0 +1,21 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: <user>-prom-stack
namespace: argocd
spec:
destination:
namespace: <user>-monitoring
server: https://kubernetes.default.svc
project: default
source:
repoURL: 'https://gitea.training.cluster.acend.ch/<user>/prometheus-training-lab-setup'
path: charts/user-monitoring/
targetRevision: main
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- Replace=true

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.1.0
version: 0.1.1
# 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

@@ -1,20 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-{{ .Values.user }}
rules:
- apiGroups: [""]
resources:
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources:
- configmaps
verbs: ["get"]
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs: ["get", "list", "watch"]

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 +1 @@
user: user1
user: userX # Replace me

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.0
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

@@ -1,5 +1,5 @@
{{- define "alertmanager.alertmanager" }}
---
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "blackboxexporter.cm" }}
---
apiVersion: v1
kind: ConfigMap
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "blackboxexporter.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:

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

@@ -1,4 +1,5 @@
{{- define "grafana.dashboardprovider" }}
---
kind: ConfigMap
apiVersion: v1
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "grafana.datasource" }}
---
apiVersion: v1
kind: Secret
type: Opaque
@@ -15,6 +16,9 @@ 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 }}
{{- end }}
{{- end }}

View File

@@ -1,4 +1,5 @@
{{- define "grafana.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "grafana.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "grafana.rolebinding" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "grafana.sa" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:

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

@@ -1,4 +1,5 @@
{{- define "grafana.svc" }}
---
apiVersion: v1
kind: Service
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "prometheus.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "prometheus.role" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "prometheus.rolebinding" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "prometheus.sa" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:

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

@@ -1,4 +1,5 @@
{{- define "prometheus.prometheus" }}
---
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
@@ -6,7 +7,11 @@ metadata:
app.kubernetes.io/name: prometheus
name: prometheus
spec:
scrapeInterval: 10s
{{- if .Values.query.enabled }}
thanos:
image: quay.io/thanos/thanos:v0.32.3
{{- end }}
scrapeInterval: 60s
serviceAccountName: prometheus-{{ .Values.user }}
serviceMonitorNamespaceSelector:
matchLabels:

View File

@@ -1,4 +1,5 @@
{{- define "pushgateway.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "pushgateway.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "pushgateway.svc" }}
---
apiVersion: v1
kind: Service
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "query.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -24,9 +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

@@ -1,4 +1,5 @@
{{- define "query.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "query.svc" }}
---
apiVersion: v1
kind: Service
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "ruler.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:

View File

@@ -1,4 +1,5 @@
{{- define "ruler.ruler" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ThanosRuler
metadata:

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

@@ -2,6 +2,7 @@ apiVersion: v1
data:
admin: JDEkSzNRZUlsOHAkZVZZb1h2RERNWk40b3RJT2tBc3AwLw== # $(openssl passwd -1 admin)
{{ .Values.user }}: JDEkSzNRZUlsOHAkZVZZb1h2RERNWk40b3RJT2tBc3AwLw== # $(openssl passwd -1 admin)
grafana_user: {{ .Values.user | b64enc }}
kind: Secret
metadata:
labels:

View File

@@ -1,25 +1,22 @@
user: user1
# alertmanager
alertmanager:
enabled: true
# grafana
grafana:
enabled: true
user: <user> # Replace me
# prometheus
prometheus:
enabled: true
# pushgeitwey
pushgateway:
enabled: true
# thanos-ruler
ruler:
enabled: true
enabled: false
# thanos-query
query:
enabled: true
enabled: false
# grafana
grafana:
enabled: false
# blackboxexporter
blackboxexporter:
enabled: false
# pushgateway
pushgateway:
enabled: false
# alertmanager
alertmanager:
enabled: false
# thanos-ruler
ruler:
enabled: false

3
user-demo/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Readme
This is the location for the user demo app.