15 Commits

Author SHA1 Message Date
Raffael H
3d4d467e28 Fix thanos store setup 2023-10-12 17:39:46 +02:00
Thomas Philipona
28b1c17e13 Adds kube-prom-stack variant inital version 2023-10-12 14:12:47 +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 234 additions and 44 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 # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # 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 # 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 # 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

@@ -1 +1 @@
user: user1 user: userX # Replace me

View File

@@ -0,0 +1,23 @@
# 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

@@ -0,0 +1,6 @@
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

@@ -0,0 +1,29 @@
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

@@ -0,0 +1,73 @@
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 # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0 version: 0.2.5
# This is the version number of the application being deployed. This version number should be # 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 # incremented each time you make changes to the application. Versions are not expected to

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
{{- define "grafana.datasource" }} {{- define "grafana.datasource" }}
---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
type: Opaque type: Opaque
@@ -17,4 +18,7 @@ stringData:
type: prometheus type: prometheus
url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902 url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902
version: 1 version: 1
{{- if .Values.grafana.datasources }}
{{- toYaml .Values.grafana.datasources | nindent 6 }}
{{- end }}
{{- end }} {{- end }}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
{{- define "prometheus.prometheus" }} {{- define "prometheus.prometheus" }}
---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: Prometheus kind: Prometheus
metadata: metadata:
@@ -6,7 +7,7 @@ metadata:
app.kubernetes.io/name: prometheus app.kubernetes.io/name: prometheus
name: prometheus name: prometheus
spec: spec:
scrapeInterval: 10s scrapeInterval: 60s
serviceAccountName: prometheus-{{ .Values.user }} serviceAccountName: prometheus-{{ .Values.user }}
serviceMonitorNamespaceSelector: serviceMonitorNamespaceSelector:
matchLabels: matchLabels:

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
{{- define "query.deploy" }} {{- define "query.deploy" }}
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -25,6 +26,7 @@ spec:
- --endpoint=prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901 - --endpoint=prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901
- --endpoint=thanos-ruler-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 - --endpoint=prometheus-operated.monitoring.svc.cluster.local:10901
- --store=dnssrv+_grpc._tcp.kube-prometheus-stack-thanos-discovery.monitoring.svc.cluster.local
- --store.unhealthy-timeout=3d - --store.unhealthy-timeout=3d
image: quay.io/thanos/thanos:v0.25.1 image: quay.io/thanos/thanos:v0.25.1
name: thanos-query name: thanos-query

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,25 +1,32 @@
user: user1 user: <user> # Replace me
# alertmanager
alertmanager:
enabled: true
# grafana
grafana:
enabled: true
# prometheus # prometheus
prometheus: prometheus:
enabled: true enabled: false
# pushgeitwey
pushgateway:
enabled: true
# thanos-ruler
ruler:
enabled: true
# thanos-query # thanos-query
query: query:
enabled: true 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
# 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.