From c7b03a2a1f57a898feb39869c65d90687da307c8 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sat, 6 May 2023 00:04:43 +0200 Subject: [PATCH] feat(monitoring): Update configuration for Kustomize Add Kustomize support, and all connectors necessary for different supportes apps --- monitoring/grafana/deployment.yaml | 4 --- monitoring/grafana/kustomization.yaml | 15 ++++++++++ monitoring/grafana/service.yaml | 3 +- monitoring/kustomization.yaml | 9 ++++++ monitoring/loki/kustomization.yaml | 12 ++++++++ monitoring/loki/statefulset.yaml | 1 - .../{clusterRole.yaml => clusterrole.yaml} | 0 .../{config-map.yaml => configmap.yaml} | 29 +++++++++++++++---- monitoring/prometheus/deployment.yaml | 1 - monitoring/prometheus/kustomization.yaml | 8 +++++ monitoring/promtail/kustomization.yaml | 9 ++++++ 11 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 monitoring/grafana/kustomization.yaml create mode 100644 monitoring/kustomization.yaml create mode 100644 monitoring/loki/kustomization.yaml rename monitoring/prometheus/{clusterRole.yaml => clusterrole.yaml} (100%) rename monitoring/prometheus/{config-map.yaml => configmap.yaml} (89%) create mode 100644 monitoring/prometheus/kustomization.yaml create mode 100644 monitoring/promtail/kustomization.yaml diff --git a/monitoring/grafana/deployment.yaml b/monitoring/grafana/deployment.yaml index d89ccb1..d148eaf 100644 --- a/monitoring/grafana/deployment.yaml +++ b/monitoring/grafana/deployment.yaml @@ -6,11 +6,9 @@ metadata: name: loki-grafana namespace: monitoring labels: - helm.sh/chart: grafana-6.24.1 app.kubernetes.io/name: grafana app.kubernetes.io/instance: loki app.kubernetes.io/version: "8.3.5" - app.kubernetes.io/managed-by: Helm spec: replicas: 1 revisionHistoryLimit: 10 @@ -31,7 +29,6 @@ spec: checksum/sc-dashboard-provider-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b checksum/secret: a8dec7c19ea590ef9d5a0075b8ed84bdf3a82ce47d9c86f5caada045396ab392 spec: - serviceAccountName: loki-grafana automountServiceAccountToken: true securityContext: @@ -39,7 +36,6 @@ spec: runAsGroup: 472 runAsUser: 472 enableServiceLinks: true - nodeName: slave-1 containers: - name: grafana-sc-datasources image: "quay.io/kiwigrid/k8s-sidecar:1.15.6" diff --git a/monitoring/grafana/kustomization.yaml b/monitoring/grafana/kustomization.yaml new file mode 100644 index 0000000..0b6912a --- /dev/null +++ b/monitoring/grafana/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - clusterrolebinding.yaml + - clusterrole.yaml + - configmap.yaml + - datasources.yaml + - deployment.yaml + - ingress.yaml + - podsecuritypolicy.yaml + - rolebinding.yaml + - role.yaml + - serviceaccount.yaml + - service.yaml diff --git a/monitoring/grafana/service.yaml b/monitoring/grafana/service.yaml index 6b36661..3cbfb13 100644 --- a/monitoring/grafana/service.yaml +++ b/monitoring/grafana/service.yaml @@ -6,7 +6,6 @@ metadata: name: loki-grafana namespace: monitoring labels: - helm.sh/chart: grafana-6.24.1 app.kubernetes.io/name: grafana app.kubernetes.io/instance: loki app.kubernetes.io/version: "8.3.5" @@ -15,7 +14,7 @@ spec: - name: service port: 80 protocol: TCP - targetPort: 3000 + targetPort: grafana selector: app.kubernetes.io/name: grafana diff --git a/monitoring/kustomization.yaml b/monitoring/kustomization.yaml new file mode 100644 index 0000000..18b32b0 --- /dev/null +++ b/monitoring/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - namespace.yaml + - ./promtail + - ./loki + - ./prometheus + - ./grafana diff --git a/monitoring/loki/kustomization.yaml b/monitoring/loki/kustomization.yaml new file mode 100644 index 0000000..7b59918 --- /dev/null +++ b/monitoring/loki/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - rolebinding.yaml + - role.yaml + - secret.yaml + - serviceaccount.yaml + - service-headless.yaml + - service-memberlist.yaml + - service.yaml + - statefulset.yaml diff --git a/monitoring/loki/statefulset.yaml b/monitoring/loki/statefulset.yaml index 7d2f5e8..c53b163 100644 --- a/monitoring/loki/statefulset.yaml +++ b/monitoring/loki/statefulset.yaml @@ -41,7 +41,6 @@ spec: runAsUser: 10001 initContainers: [] - nodeName: slave-1 containers: - name: loki image: "grafana/loki:2.6.1" diff --git a/monitoring/prometheus/clusterRole.yaml b/monitoring/prometheus/clusterrole.yaml similarity index 100% rename from monitoring/prometheus/clusterRole.yaml rename to monitoring/prometheus/clusterrole.yaml diff --git a/monitoring/prometheus/config-map.yaml b/monitoring/prometheus/configmap.yaml similarity index 89% rename from monitoring/prometheus/config-map.yaml rename to monitoring/prometheus/configmap.yaml index d705fc1..b069e38 100644 --- a/monitoring/prometheus/config-map.yaml +++ b/monitoring/prometheus/configmap.yaml @@ -65,10 +65,6 @@ data: static_configs: - targets: - gitlab-svc.gitlab.svc.cluster.local:9236 - - job_name: 'gitlab-nginx_metrics' - static_configs: - - targets: - - gitlab-svc.gitlab.svc.cluster.local:8060 - job_name: 'gitlab-rails_metrics' metrics_path: "/-/metrics" scheme: https @@ -79,7 +75,25 @@ data: scrape_interval: 15s metrics_path: "/_synapse/metrics" static_configs: - - targets: ["synapse-svc.synapse.svc.cluster.local:9000"] + - targets: + - synapse-svc.synapse.svc.cluster.local:9000 + - job_name: 'sonarr' + static_configs: + - targets: + - sonarr-svc.torrent.svc.cluster.local:9707 + - job_name: 'radarr' + static_configs: + - targets: + - radarr-svc.torrent.svc.cluster.local:9707 + - job_name: 'prowlarr' + static_configs: + - targets: + - prowlarr-svc.torrent.svc.cluster.local:9707 + - job_name: 'jellyfin' + metrics_path: "/metrics" + static_configs: + - targets: + - jellyfin-svc.streaming.svc.cluster.local:80 - job_name: 'node-exporter' kubernetes_sd_configs: - role: endpoints @@ -87,6 +101,11 @@ data: - source_labels: [__meta_kubernetes_endpoints_name] regex: 'node-exporter' action: keep + - job_name: 'argocd' + metrics_path: "/metrics" + static_configs: + - targets: + - argocd-metrics.argocd.svc.cluster.local:8082 - job_name: 'kubernetes-apiservers' diff --git a/monitoring/prometheus/deployment.yaml b/monitoring/prometheus/deployment.yaml index 2c7123b..a6dfebd 100644 --- a/monitoring/prometheus/deployment.yaml +++ b/monitoring/prometheus/deployment.yaml @@ -43,4 +43,3 @@ spec: name: prometheus-server-conf - name: prometheus-storage-volume emptyDir: {} - nodeName: slave-1 diff --git a/monitoring/prometheus/kustomization.yaml b/monitoring/prometheus/kustomization.yaml new file mode 100644 index 0000000..94d59d7 --- /dev/null +++ b/monitoring/prometheus/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - clusterrole.yaml + - configmap.yaml + - deployment.yaml + - service.yaml diff --git a/monitoring/promtail/kustomization.yaml b/monitoring/promtail/kustomization.yaml new file mode 100644 index 0000000..6eca1a1 --- /dev/null +++ b/monitoring/promtail/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - clusterrolebinding.yaml + - clusterrole.yaml + - daemonset.yaml + - secret.yaml + - serviceaccount.yaml