From 202a5792bf825685c34620c23afc097501bda285 Mon Sep 17 00:00:00 2001 From: Kaito Ii Date: Sun, 1 Sep 2024 21:23:09 +0900 Subject: [PATCH] Add fluent --- mycluster/fluent/helm-release.yaml | 70 +++++++++++++++++++ mycluster/fluent/kustomization.yaml | 6 ++ mycluster/fluent/namespace.yaml | 4 ++ .../helm-repositories/fluentbit.yaml | 9 +++ .../helm-repositories/kustomization.yaml | 1 + 5 files changed, 90 insertions(+) create mode 100644 mycluster/fluent/helm-release.yaml create mode 100644 mycluster/fluent/kustomization.yaml create mode 100644 mycluster/fluent/namespace.yaml create mode 100644 mycluster/flux-system/helm-repositories/fluentbit.yaml diff --git a/mycluster/fluent/helm-release.yaml b/mycluster/fluent/helm-release.yaml new file mode 100644 index 0000000..50d147b --- /dev/null +++ b/mycluster/fluent/helm-release.yaml @@ -0,0 +1,70 @@ +--- +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: fluentbit + namespace: fluent +spec: + interval: 1h + chart: + spec: + # renovate: registryUrl=https://fluent.github.io/helm-charts + chart: fluentbit + version: v3.1.6 + sourceRef: + kind: HelmRepository + name: fluentbit + namespace: flux-system + install: + createNamespace: true + targetNamespace: fluent + releaseName: fluent-bit + values: + kind: DaemonSet + rbac: + eventsAccess: true + flush: 1 + metricsPort: 2020 + logLevel: info + serviceMonitor: + enabled: true + dashboards: + enabled: true + config: + service: | + [SERVICE] + Daemon Off + Flush {{ .Values.flush }} + Log_Level {{ .Values.logLevel }} + Parsers_File /fluent-bit/etc/parsers.conf + Parsers_File /fluent-bit/etc/conf/custom_parsers.conf + HTTP_Server On + HTTP_Listen 0.0.0.0 + HTTP_Port {{ .Values.metricsPort }} + Health_Check On + inputs: | + [INPUT] + Name tail + Path /var/log/containers/*.log + multiline.parser docker, cri + Tag kube.* + Mem_Buf_Limit 5MB + Skip_Long_Lines On + [INPUT] + Name systemd + Tag host.* + Systemd_Filter _SYSTEMD_UNIT=kubelet.service + Read_From_Tail On + filters: | + [FILTER] + Name kubernetes + Match kube.* + Merge_Log On + Keep_Log Off + K8S-Logging.Parser On + K8S-Logging.Exclude On + outputs: | + [OUTPUT] + Name stdout + Match * + diff --git a/mycluster/fluent/kustomization.yaml b/mycluster/fluent/kustomization.yaml new file mode 100644 index 0000000..9f5597c --- /dev/null +++ b/mycluster/fluent/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- namespace.yaml +- helm-release.yaml +- servicemonitor.yaml diff --git a/mycluster/fluent/namespace.yaml b/mycluster/fluent/namespace.yaml new file mode 100644 index 0000000..243bf5a --- /dev/null +++ b/mycluster/fluent/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: fluent diff --git a/mycluster/flux-system/helm-repositories/fluentbit.yaml b/mycluster/flux-system/helm-repositories/fluentbit.yaml new file mode 100644 index 0000000..92b577c --- /dev/null +++ b/mycluster/flux-system/helm-repositories/fluentbit.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: HelmRepository +metadata: + name: fluentbit + namespace: flux-system +spec: + interval: 1h + url: https://fluent.github.io/helm-charts diff --git a/mycluster/flux-system/helm-repositories/kustomization.yaml b/mycluster/flux-system/helm-repositories/kustomization.yaml index 0a6a46d..bdb2c25 100644 --- a/mycluster/flux-system/helm-repositories/kustomization.yaml +++ b/mycluster/flux-system/helm-repositories/kustomization.yaml @@ -4,6 +4,7 @@ namespace: flux-system resources: - aqua.yaml - flagger.yaml + - fluentbit.yaml - jetstack.yaml - longhorn.yaml - metallb.yaml