From a7cbcbba620a572e4ee6e07e50883e1ffdd3a054 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 19 Sep 2024 23:45:39 -0400 Subject: [PATCH] feat(thin): add victoria-metrics for monitoring --- kubernetes/thin/apps/helm-repositories.yaml | 11 +++- kubernetes/thin/apps/kustomization.yaml | 1 + .../thin/apps/monitoring/kustomization.yaml | 4 ++ .../apps/monitoring/victoria-metrics/ks.yaml | 56 +++++++++++++++++++ .../operator/helm-release.yaml | 16 ++++++ .../operator/kustomization.yaml | 4 ++ .../monitoring/victoria-metrics/vm/agent.yaml | 17 ++++++ .../victoria-metrics/vm/kustomization.yaml | 5 ++ .../victoria-metrics/vm/single.yaml | 28 ++++++++++ 9 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 kubernetes/thin/apps/monitoring/kustomization.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/ks.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/operator/helm-release.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/operator/kustomization.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/vm/agent.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/vm/kustomization.yaml create mode 100644 kubernetes/thin/apps/monitoring/victoria-metrics/vm/single.yaml diff --git a/kubernetes/thin/apps/helm-repositories.yaml b/kubernetes/thin/apps/helm-repositories.yaml index fc2b583..8e238d8 100644 --- a/kubernetes/thin/apps/helm-repositories.yaml +++ b/kubernetes/thin/apps/helm-repositories.yaml @@ -23,4 +23,13 @@ metadata: namespace: flux-system spec: interval: 1m - url: https://kubernetes.github.io/ingress-nginx \ No newline at end of file + url: https://kubernetes.github.io/ingress-nginx +--- +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: victoria-metrics-charts + namespace: flux-system +spec: + interval: 1m + url: https://victoriametrics.github.io/helm-charts \ No newline at end of file diff --git a/kubernetes/thin/apps/kustomization.yaml b/kubernetes/thin/apps/kustomization.yaml index 339bda0..3c87cf2 100644 --- a/kubernetes/thin/apps/kustomization.yaml +++ b/kubernetes/thin/apps/kustomization.yaml @@ -17,4 +17,5 @@ resources: - ./kubevirt-cdi/ks.yaml - ../../common/apps/database +- ./monitoring - ./default \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/kustomization.yaml b/kubernetes/thin/apps/monitoring/kustomization.yaml new file mode 100644 index 0000000..016c50a --- /dev/null +++ b/kubernetes/thin/apps/monitoring/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./victoria-metrics/ks.yaml \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/ks.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/ks.yaml new file mode 100644 index 0000000..2d0a520 --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/ks.yaml @@ -0,0 +1,56 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: victoria-metrics-operator + namespace: flux-system +spec: + targetNamespace: monitoring + timeout: 5m + interval: 10m + path: ./kubernetes/thin/apps/monitoring/victoria-metrics/operator + prune: true + sourceRef: + kind: GitRepository + name: home-cluster + decryption: + provider: sops + secretRef: + name: sops-gpg + postBuild: + substitute: {} + substituteFrom: + - kind: ConfigMap + name: cluster-settings + - kind: Secret + name: cluster-secrets +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: victoria-metrics-deploys + namespace: flux-system +spec: + targetNamespace: monitoring + timeout: 5m + interval: 10m + path: ./kubernetes/thin/apps/monitoring/victoria-metrics/vm + prune: true + sourceRef: + kind: GitRepository + name: home-cluster + decryption: + provider: sops + secretRef: + name: sops-gpg + dependsOn: + - name: victoria-metrics-operator + postBuild: + substitute: {} + substituteFrom: + - kind: ConfigMap + name: cluster-settings + - kind: Secret + name: cluster-secrets \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/operator/helm-release.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/operator/helm-release.yaml new file mode 100644 index 0000000..d28f17a --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/operator/helm-release.yaml @@ -0,0 +1,16 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: victoria-metrics-operator + namespace: monitoring +spec: + interval: 5m + chart: + spec: + chart: victoria-metrics-operator + version: 0.34.8 + sourceRef: + kind: HelmRepository + name: victoria-metrics-charts + namespace: flux-system + values: {} \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/operator/kustomization.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/operator/kustomization.yaml new file mode 100644 index 0000000..ea3145d --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/operator/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./helm-release.yaml \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/vm/agent.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/agent.yaml new file mode 100644 index 0000000..e07e32f --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/agent.yaml @@ -0,0 +1,17 @@ +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMAgent +metadata: + name: vmagent-select-all + namespace: monitoring +spec: + image: + repository: victoriametrics/vmagent + tag: v1.103.0 + pullPolicy: IfNotPresent + + selectAllByDefault: true + vmAgentExternalLabelName: vmagent + remoteWrite: + - url: http://vmsingle-vmsingle:8429/api/v1/write + minScrapeInterval: 30s + maxScrapeInterval: 24h diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/vm/kustomization.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/kustomization.yaml new file mode 100644 index 0000000..ac0fdc5 --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./single.yaml +- ./agent.yaml \ No newline at end of file diff --git a/kubernetes/thin/apps/monitoring/victoria-metrics/vm/single.yaml b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/single.yaml new file mode 100644 index 0000000..72f2463 --- /dev/null +++ b/kubernetes/thin/apps/monitoring/victoria-metrics/vm/single.yaml @@ -0,0 +1,28 @@ +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMSingle +metadata: + name: vmsingle + namespace: monitoring +spec: + image: + repository: victoriametrics/victoria-metrics + tag: v1.103.0 + + retentionPeriod: "6" # in months + replicaCount: 1 + + storage: + storageClassName: openebs-dual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 32Gi + + resources: + requests: + memory: "64Mi" + cpu: "250m" + limits: + memory: "1Gi" + cpu: "500m" \ No newline at end of file