From 81d728bb6ca07fd043eae41e205792c49f7b7b53 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Sat, 5 Oct 2024 13:37:07 -0500 Subject: [PATCH] add vm single and vm alert --- .../cluster/kustomization.yaml | 7 ++++ .../victoria-metrics/cluster/vmalert.yaml | 32 +++++++++++++++++ .../victoria-metrics/cluster/vmsingle.yaml | 35 +++++++++++++++++++ .../observability/victoria-metrics/ks.yaml | 23 ++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 kubernetes/apps/observability/victoria-metrics/cluster/kustomization.yaml create mode 100644 kubernetes/apps/observability/victoria-metrics/cluster/vmalert.yaml create mode 100644 kubernetes/apps/observability/victoria-metrics/cluster/vmsingle.yaml diff --git a/kubernetes/apps/observability/victoria-metrics/cluster/kustomization.yaml b/kubernetes/apps/observability/victoria-metrics/cluster/kustomization.yaml new file mode 100644 index 00000000..65711d6d --- /dev/null +++ b/kubernetes/apps/observability/victoria-metrics/cluster/kustomization.yaml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - vmalert.yaml + - vmsingle.yaml diff --git a/kubernetes/apps/observability/victoria-metrics/cluster/vmalert.yaml b/kubernetes/apps/observability/victoria-metrics/cluster/vmalert.yaml new file mode 100644 index 00000000..0282a6f5 --- /dev/null +++ b/kubernetes/apps/observability/victoria-metrics/cluster/vmalert.yaml @@ -0,0 +1,32 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/operator.victoriametrics.com/vmalert_v1beta1.json +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMAlert +metadata: + name: cluster +spec: + datasource: + url: http://vmsingle-cluster.observability.svc:8429 + evaluationInterval: 1m + notifiers: + - url: http://alertmanager.observability.svc:9093 + remoteRead: + url: http://vmsingle-cluster.observability.svc:8429 + remoteWrite: + url: http://vmsingle-cluster.observability.svc:8429 + replicaCount: 1 + resources: + requests: + cpu: 3m + limits: + memory: 128Mi + selectAllByDefault: true + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/instance: cluster + app.kubernetes.io/name: vmalert + useStrictSecurity: true diff --git a/kubernetes/apps/observability/victoria-metrics/cluster/vmsingle.yaml b/kubernetes/apps/observability/victoria-metrics/cluster/vmsingle.yaml new file mode 100644 index 00000000..eda30da7 --- /dev/null +++ b/kubernetes/apps/observability/victoria-metrics/cluster/vmsingle.yaml @@ -0,0 +1,35 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/operator.victoriametrics.com/vmsingle_v1beta1.json +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMSingle +metadata: + name: cluster +spec: + extraArgs: + dedup.minScrapeInterval: 10s + maxLabelsPerTimeseries: "40" + search.minStalenessInterval: 5m + vmalert.proxyURL: http://vmalert-cluster.observability.svc:8080 + replicaCount: 1 + resources: + requests: + cpu: 5m + limits: + memory: 2Gi + # -- Data retention period. Possible units character: h(ours), d(ays), w(eeks), y(ears), if no unit character specified - month. The minimum retention period is 24h. See these [docs](https://docs.victoriametrics.com/single-server-victoriametrics/#retention) + retentionPeriod: "6" + storage: + accessModes: [ReadWriteOnce] + resources: + requests: + storage: 10Gi + storageClassName: openebs-hostpath + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/instance: cluster + app.kubernetes.io/name: vmsingle + useStrictSecurity: true diff --git a/kubernetes/apps/observability/victoria-metrics/ks.yaml b/kubernetes/apps/observability/victoria-metrics/ks.yaml index d3c041ae..ac33ad87 100644 --- a/kubernetes/apps/observability/victoria-metrics/ks.yaml +++ b/kubernetes/apps/observability/victoria-metrics/ks.yaml @@ -18,3 +18,26 @@ spec: wait: true interval: 30m retryInterval: 1m +--- +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app vm-cluster + namespace: flux-system +spec: + targetNamespace: observability + commonMetadata: + labels: + app.kubernetes.io/name: *app + dependsOn: + - name: openebs + - name: vm-operator + path: ./kubernetes/apps/observability/victoriametrics/cluster + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m