diff --git a/kubernetes/apps/observability/kustomization.yaml b/kubernetes/apps/observability/kustomization.yaml index ecd0dfa2..92f677bd 100644 --- a/kubernetes/apps/observability/kustomization.yaml +++ b/kubernetes/apps/observability/kustomization.yaml @@ -9,5 +9,6 @@ resources: - ./alertmanager/ks.yaml - ./gatus/ks.yaml - ./prometheus-operator-crds/ks.yaml + - ./vector-agent/ks.yaml - ./vector-aggregator/ks.yaml - ./victoria-metrics/ks.yaml diff --git a/kubernetes/apps/observability/vector-agent/app/helmrelease.yaml b/kubernetes/apps/observability/vector-agent/app/helmrelease.yaml new file mode 100644 index 00000000..0cd7491a --- /dev/null +++ b/kubernetes/apps/observability/vector-agent/app/helmrelease.yaml @@ -0,0 +1,47 @@ +--- +# 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-agent +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: "Agent" + workloadResourceAnnotations: + reloader.stakater.com/auto: "true" + containerPorts: + - name: prom-exporter + containerPort: 9090 + resources: + requests: + memory: "64Mi" + cpu: "500m" + limits: + memory: 1Gi + cpu: "6000m" + service: + ports: + - name: prom-exporter + port: 9090 + existingConfigMaps: ["vector-agent-configmap"] + dataDir: /vector-data-dir + podMonitor: + enabled: true diff --git a/kubernetes/apps/observability/vector-agent/app/kustomization.yaml b/kubernetes/apps/observability/vector-agent/app/kustomization.yaml new file mode 100644 index 00000000..725ea4a1 --- /dev/null +++ b/kubernetes/apps/observability/vector-agent/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-agent-configmap + files: + - vector.yaml=./resources/vector.yml +generatorOptions: + disableNameSuffixHash: true diff --git a/kubernetes/apps/observability/vector-agent/app/resources/vector.yml b/kubernetes/apps/observability/vector-agent/app/resources/vector.yml new file mode 100644 index 00000000..17e33605 --- /dev/null +++ b/kubernetes/apps/observability/vector-agent/app/resources/vector.yml @@ -0,0 +1,35 @@ +--- +data_dir: /vector-data-dir + +sources: + internal_metrics: + type: internal_metrics + kubernetes_logs: + type: kubernetes_logs + use_apiserver_cache: true + pod_annotation_fields: + container_image: container_image + container_name: container_name + pod_labels: pod_labels + pod_name: pod_name + pod_annotations: "" + namespace_annotation_fields: + namespace_labels: "" + node_annotation_fields: + node_labels: "" + # https://github.com/vectordotdev/vector/issues/12014 + # https://github.com/vectordotdev/vector/issues/13467 + max_line_bytes: 131072 # 128 KiB + max_read_bytes: 131072 # 128 KiB + +sinks: + prom_exporter: + type: prometheus_exporter + inputs: [internal_metrics] + address: 0.0.0.0:9090 + vector: + type: vector + compression: true + version: "2" + address: vector-aggregator.observability:6000 + inputs: ["kubernetes_logs"] diff --git a/kubernetes/apps/observability/vector-agent/ks.yaml b/kubernetes/apps/observability/vector-agent/ks.yaml new file mode 100644 index 00000000..24723efc --- /dev/null +++ b/kubernetes/apps/observability/vector-agent/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-agent + namespace: flux-system +spec: + targetNamespace: observability + commonMetadata: + labels: + app.kubernetes.io/name: *app + path: ./kubernetes/apps/observability/vector-agent/app + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m