diff --git a/kubernetes/apps/observability/kustomization.yaml b/kubernetes/apps/observability/kustomization.yaml index ba427dae..ecd0dfa2 100644 --- a/kubernetes/apps/observability/kustomization.yaml +++ b/kubernetes/apps/observability/kustomization.yaml @@ -9,4 +9,5 @@ resources: - ./alertmanager/ks.yaml - ./gatus/ks.yaml - ./prometheus-operator-crds/ks.yaml + - ./vector-aggregator/ks.yaml - ./victoria-metrics/ks.yaml diff --git a/kubernetes/apps/observability/vector-aggregator/app/helmrelease.yaml b/kubernetes/apps/observability/vector-aggregator/app/helmrelease.yaml new file mode 100644 index 00000000..1e5ab93b --- /dev/null +++ b/kubernetes/apps/observability/vector-aggregator/app/helmrelease.yaml @@ -0,0 +1,50 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2.json +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: vector-aggregator +spec: + interval: 30m + chart: + spec: + chart: vector + version: 0.36.1 + sourceRef: + kind: HelmRepository + name: vector + namespace: flux-system + driftDetection: + mode: enabled + install: + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + retries: 3 + values: + role: "Stateless-Aggregator" + replicas: 1 + workloadResourceAnnotations: + reloader.stakater.com/auto: "true" + containerPorts: + - name: vector + containerPort: 6000 + - name: prom-exporter + containerPort: 9090 + resources: + requests: + cpu: 3m + limits: + memory: 512Mi + service: + ports: + - name: vector + port: 6000 + - name: prom-exporter + port: 9090 + existingConfigMaps: ["vector-aggregator-configmap"] + dataDir: /vector-data-dir + podMonitor: + enabled: true diff --git a/kubernetes/apps/observability/vector-aggregator/app/kustomization.yaml b/kubernetes/apps/observability/vector-aggregator/app/kustomization.yaml new file mode 100644 index 00000000..a1322387 --- /dev/null +++ b/kubernetes/apps/observability/vector-aggregator/app/kustomization.yaml @@ -0,0 +1,12 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml +configMapGenerator: + - name: vector-aggregator-configmap + files: + - vector.yaml=./resources/vector.yaml +generatorOptions: + disableNameSuffixHash: true diff --git a/kubernetes/apps/observability/vector-aggregator/app/resources/vector.yml b/kubernetes/apps/observability/vector-aggregator/app/resources/vector.yml new file mode 100644 index 00000000..5498fc83 --- /dev/null +++ b/kubernetes/apps/observability/vector-aggregator/app/resources/vector.yml @@ -0,0 +1,41 @@ +--- +data_dir: /vector-data-dir +api: + enabled: true + address: 0.0.0.0:8686 + +sources: + internal_metrics: + type: internal_metrics + vector: + type: vector + version: "2" + address: 0.0.0.0:6000 + +transforms: + kubernetes_remap: + type: remap + inputs: ["vector"] + source: | + # Standardize 'app' index + .custom_app_name = .pod_labels."app.kubernetes.io/name" || .pod_labels.app || .pod_labels."k8s-app" || "unknown" + # Drop pod_labels + del(.pod_labels) + +sinks: + prom_exporter: + type: prometheus_exporter + inputs: [internal_metrics] + address: 0.0.0.0:9090 + victorialogs: + type: elasticsearch + inputs: [kubernetes_remap] + endpoints: [http://victoria-logs.observability:9428/insert/elasticsearch/] + mode: bulk + api_version: v8 + healthcheck: + enabled: false + query: + _msg_field: message + _stream_fields: host,container_name + _time_field: timestamp diff --git a/kubernetes/apps/observability/vector-aggregator/ks.yaml b/kubernetes/apps/observability/vector-aggregator/ks.yaml new file mode 100644 index 00000000..c62a327c --- /dev/null +++ b/kubernetes/apps/observability/vector-aggregator/ks.yaml @@ -0,0 +1,20 @@ +--- +# 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 vector-aggregator + namespace: flux-system +spec: + targetNamespace: observability + commonMetadata: + labels: + app.kubernetes.io/name: *app + path: ./kubernetes/apps/observability/vector-aggregator/app + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m