diff --git a/monitoring/README.md b/monitoring/README.md index 47cf963..5413b64 100644 --- a/monitoring/README.md +++ b/monitoring/README.md @@ -1,11 +1,10 @@ # monitoring -## namespace - -``` bash -kubectl create namespace monitoring -``` +## prometheus-stack +- +- + ## promtail ## Setup @@ -16,7 +15,7 @@ Using flux for reconciliation. ./ops-scripts/apply-flux.sh ``` -**Encrypt secrets:** +**promtail Encrypt secrets:** ``` bash sops -e deploy/promtail/helm-values.private.dec.yaml > deploy/promtail/helm-values.private.yaml diff --git a/monitoring/deploy/flux/prometheus-app-sync.yaml b/monitoring/deploy/flux/prometheus-app-sync.yaml new file mode 100644 index 0000000..c1a570d --- /dev/null +++ b/monitoring/deploy/flux/prometheus-app-sync.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: prometheus +spec: + interval: 1m + sourceRef: + kind: GitRepository + name: casa + namespace: casa-limbosolutions-com + path: services/monitoring/deploy/prometheus + prune: true + decryption: + provider: sops + secretRef: + name: flux-sops-age diff --git a/monitoring/deploy/flux/promtail-app-sync.yaml b/monitoring/deploy/flux/promtail-app-sync.yaml index 89692d7..05bcd5c 100644 --- a/monitoring/deploy/flux/promtail-app-sync.yaml +++ b/monitoring/deploy/flux/promtail-app-sync.yaml @@ -8,7 +8,7 @@ spec: kind: GitRepository name: casa namespace: casa-limbosolutions-com - path: services/monitoring/promtail + path: services/monitoring/deploy/promtail prune: true decryption: provider: sops diff --git a/monitoring/prometheus/deploy/helm/01-only-crd-and-operator.yaml b/monitoring/deploy/prometheus/helm/01-only-crd-and-operator.yaml similarity index 100% rename from monitoring/prometheus/deploy/helm/01-only-crd-and-operator.yaml rename to monitoring/deploy/prometheus/helm/01-only-crd-and-operator.yaml diff --git a/monitoring/prometheus/deploy/helm/02-kube-metrics.yaml b/monitoring/deploy/prometheus/helm/02-kube-metrics.yaml similarity index 100% rename from monitoring/prometheus/deploy/helm/02-kube-metrics.yaml rename to monitoring/deploy/prometheus/helm/02-kube-metrics.yaml diff --git a/monitoring/prometheus/deploy/helm/03-node-exporter.yaml b/monitoring/deploy/prometheus/helm/03-node-exporter.yaml similarity index 100% rename from monitoring/prometheus/deploy/helm/03-node-exporter.yaml rename to monitoring/deploy/prometheus/helm/03-node-exporter.yaml diff --git a/monitoring/prometheus/deploy/helm/04-kubelet.yaml b/monitoring/deploy/prometheus/helm/04-kubelet.yaml similarity index 100% rename from monitoring/prometheus/deploy/helm/04-kubelet.yaml rename to monitoring/deploy/prometheus/helm/04-kubelet.yaml diff --git a/monitoring/deploy/prometheus/helm/helm-release.yaml b/monitoring/deploy/prometheus/helm/helm-release.yaml new file mode 100644 index 0000000..e7384b4 --- /dev/null +++ b/monitoring/deploy/prometheus/helm/helm-release.yaml @@ -0,0 +1,28 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: monitoring +spec: + releaseName: prometheus-stack + interval: 40h + chart: + spec: + chart: prometheus-stack + version: 86.x.x + sourceRef: + kind: HelmRepository + name: prometheus-stack + interval: 40h + valuesFrom: + - kind: Secret + name: prometheus-stack-helm-values + valuesKey: 01-only-crd-and-operator.yaml + - kind: Secret + name: prometheus-stack-helm-values + valuesKey: 02-kube-metrics.yaml + - kind: Secret + name: prometheus-stack-helm-values + valuesKey: 03-node-exporter.yaml + - kind: Secret + name: prometheus-stack-helm-values + valuesKey: 04-kubelet.yaml \ No newline at end of file diff --git a/monitoring/deploy/prometheus/helm/helm-repo.yaml b/monitoring/deploy/prometheus/helm/helm-repo.yaml new file mode 100644 index 0000000..720e4be --- /dev/null +++ b/monitoring/deploy/prometheus/helm/helm-repo.yaml @@ -0,0 +1,7 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: prometheus-stack +spec: + interval: 40h + url: https://prometheus-community.github.io/helm-charts \ No newline at end of file diff --git a/monitoring/prometheus/deploy/helm/original-values.yaml b/monitoring/deploy/prometheus/helm/original-values.yaml similarity index 100% rename from monitoring/prometheus/deploy/helm/original-values.yaml rename to monitoring/deploy/prometheus/helm/original-values.yaml diff --git a/monitoring/deploy/prometheus/kustomization.yaml b/monitoring/deploy/prometheus/kustomization.yaml new file mode 100644 index 0000000..37ba29c --- /dev/null +++ b/monitoring/deploy/prometheus/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: monitoring +resources: + - helm/helm-repo.yaml + - helm/helm-release.yaml + - prometheus-agent.yaml +secretGenerator: + - name: prometheus-stack-helm-values + files: + - 01-only-crd-and-operator.yaml=helm/01-only-crd-and-operator.yaml + - 02-kube-metrics.yaml=helm/02-kube-metrics.yaml + - 03-node-exporter.yaml=helm/03-node-exporter.yaml + - 04-kubelet.yaml=helm/helm/04-kubelet.yaml diff --git a/monitoring/prometheus/deploy/prometheus-agent.yaml b/monitoring/deploy/prometheus/prometheus-agent.yaml similarity index 98% rename from monitoring/prometheus/deploy/prometheus-agent.yaml rename to monitoring/deploy/prometheus/prometheus-agent.yaml index fb6f8e0..22fb8a1 100644 --- a/monitoring/prometheus/deploy/prometheus-agent.yaml +++ b/monitoring/deploy/prometheus/prometheus-agent.yaml @@ -3,7 +3,6 @@ apiVersion: monitoring.coreos.com/v1alpha1 kind: PrometheusAgent metadata: name: prometheus-agent - namespace: monitoring spec: podMonitorSelector: null diff --git a/monitoring/prometheus/deploy/README.md b/monitoring/prometheus/deploy/README.md index b5d67e4..ea8e352 100644 --- a/monitoring/prometheus/deploy/README.md +++ b/monitoring/prometheus/deploy/README.md @@ -1,8 +1,6 @@ # Prometheus Setup -- -- - + ## helm chart ```bash diff --git a/monitoring/prometheus/deploy/helm/10-testing-values.yaml b/monitoring/prometheus/deploy/helm/10-testing-values.yaml deleted file mode 100644 index effbc1c..0000000 --- a/monitoring/prometheus/deploy/helm/10-testing-values.yaml +++ /dev/null @@ -1 +0,0 @@ -# use for testing \ No newline at end of file