From 16998a524379ca46b5db791b17771e2578ae1e95 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Sun, 7 Mar 2021 12:38:53 +0100 Subject: [PATCH] Switch fluent-bit to use kubelet rather than kube-api --- .../charts/fluent-bit/Chart.yaml | 2 +- .../charts/fluent-bit/templates/_pod.tpl | 2 + .../fluent-bit/templates/clusterrole.yaml | 2 + charts/kubezero-logging/fluent-bit.patch | 43 +++++++++++++++---- charts/kubezero-logging/values.yaml | 2 + 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/charts/kubezero-logging/charts/fluent-bit/Chart.yaml b/charts/kubezero-logging/charts/fluent-bit/Chart.yaml index f83e759..544d1a7 100644 --- a/charts/kubezero-logging/charts/fluent-bit/Chart.yaml +++ b/charts/kubezero-logging/charts/fluent-bit/Chart.yaml @@ -2,7 +2,7 @@ annotations: artifacthub.io/changes: | - add custom annotations on dashboards configmap apiVersion: v2 -appVersion: 1.7.1 +appVersion: 1.7.2 description: Fast and lightweight log processor and forwarder or Linux, OSX and BSD family operating systems. home: https://fluentbit.io/ icon: https://fluentbit.io/assets/img/logo1-default.png diff --git a/charts/kubezero-logging/charts/fluent-bit/templates/_pod.tpl b/charts/kubezero-logging/charts/fluent-bit/templates/_pod.tpl index 7acb111..8f98a85 100644 --- a/charts/kubezero-logging/charts/fluent-bit/templates/_pod.tpl +++ b/charts/kubezero-logging/charts/fluent-bit/templates/_pod.tpl @@ -13,6 +13,8 @@ securityContext: dnsConfig: {{- toYaml . | nindent 2 }} {{- end }} +hostNetwork: true +dnsPolicy: ClusterFirstWithHostNet containers: - name: {{ .Chart.Name }} securityContext: diff --git a/charts/kubezero-logging/charts/fluent-bit/templates/clusterrole.yaml b/charts/kubezero-logging/charts/fluent-bit/templates/clusterrole.yaml index 2ef2248..818c5ee 100644 --- a/charts/kubezero-logging/charts/fluent-bit/templates/clusterrole.yaml +++ b/charts/kubezero-logging/charts/fluent-bit/templates/clusterrole.yaml @@ -11,6 +11,8 @@ rules: resources: - pods - namespaces + - nodes + - nodes/proxy verbs: - get - list diff --git a/charts/kubezero-logging/fluent-bit.patch b/charts/kubezero-logging/fluent-bit.patch index a008045..61aa791 100644 --- a/charts/kubezero-logging/fluent-bit.patch +++ b/charts/kubezero-logging/fluent-bit.patch @@ -1,19 +1,44 @@ -Binary files charts/fluent-bit/.values.yaml.swp and charts/fluent-bit.zdt/.values.yaml.swp differ -diff -rtubN charts/fluent-bit/Chart.yaml charts/fluent-bit.zdt/Chart.yaml +diff -tubNr charts/fluent-bit/Chart.yaml charts/fluent-bit.zdt/Chart.yaml --- charts/fluent-bit/Chart.yaml 2021-02-23 14:58:39.000000000 +0100 -+++ charts/fluent-bit.zdt/Chart.yaml 2021-03-05 14:48:07.082648075 +0100 -@@ -1,7 +1,7 @@ ++++ charts/fluent-bit.zdt/Chart.yaml 2021-03-07 12:31:23.633414382 +0100 +@@ -1,8 +1,8 @@ annotations: artifacthub.io/changes: | - add custom annotations on dashboards configmap -apiVersion: v1 +-appVersion: 1.7.1 +apiVersion: v2 - appVersion: 1.7.1 ++appVersion: 1.7.2 description: Fast and lightweight log processor and forwarder or Linux, OSX and BSD family operating systems. home: https://fluentbit.io/ -diff -rtubN charts/fluent-bit/templates/tests/test-connection.yaml charts/fluent-bit.zdt/templates/tests/test-connection.yaml + icon: https://fluentbit.io/assets/img/logo1-default.png +diff -tubNr charts/fluent-bit/templates/_pod.tpl charts/fluent-bit.zdt/templates/_pod.tpl +--- charts/fluent-bit/templates/_pod.tpl 2021-02-23 14:58:39.000000000 +0100 ++++ charts/fluent-bit.zdt/templates/_pod.tpl 2021-03-07 12:29:53.300076962 +0100 +@@ -13,6 +13,8 @@ + dnsConfig: + {{- toYaml . | nindent 2 }} + {{- end }} ++hostNetwork: true ++dnsPolicy: ClusterFirstWithHostNet + containers: + - name: {{ .Chart.Name }} + securityContext: +diff -tubNr charts/fluent-bit/templates/clusterrole.yaml charts/fluent-bit.zdt/templates/clusterrole.yaml +--- charts/fluent-bit/templates/clusterrole.yaml 2021-02-23 14:58:39.000000000 +0100 ++++ charts/fluent-bit.zdt/templates/clusterrole.yaml 2021-03-07 12:22:43.336724185 +0100 +@@ -11,6 +11,8 @@ + resources: + - pods + - namespaces ++ - nodes ++ - nodes/proxy + verbs: + - get + - list +diff -tubNr charts/fluent-bit/templates/tests/test-connection.yaml charts/fluent-bit.zdt/templates/tests/test-connection.yaml --- charts/fluent-bit/templates/tests/test-connection.yaml 2021-02-23 14:58:39.000000000 +0100 -+++ charts/fluent-bit.zdt/templates/tests/test-connection.yaml 2021-03-05 14:51:34.749324131 +0100 ++++ charts/fluent-bit.zdt/templates/tests/test-connection.yaml 2021-03-05 18:52:29.723311108 +0100 @@ -1,3 +1,4 @@ +{{- if .Values.testFramework.enabled }} apiVersion: v1 @@ -24,9 +49,9 @@ diff -rtubN charts/fluent-bit/templates/tests/test-connection.yaml charts/fluent {{- end }} restartPolicy: Never +{{- end }} -diff -rtubN charts/fluent-bit/values.yaml charts/fluent-bit.zdt/values.yaml +diff -tubNr charts/fluent-bit/values.yaml charts/fluent-bit.zdt/values.yaml --- charts/fluent-bit/values.yaml 2021-02-23 14:58:39.000000000 +0100 -+++ charts/fluent-bit.zdt/values.yaml 2021-03-05 14:50:40.652655018 +0100 ++++ charts/fluent-bit.zdt/values.yaml 2021-03-05 18:52:29.723311108 +0100 @@ -12,6 +12,7 @@ # tag: diff --git a/charts/kubezero-logging/values.yaml b/charts/kubezero-logging/values.yaml index 5fbee4d..3499cfc 100644 --- a/charts/kubezero-logging/values.yaml +++ b/charts/kubezero-logging/values.yaml @@ -258,6 +258,8 @@ fluent-bit: Keep_Log Off K8S-Logging.Parser Off K8S-Logging.Exclude Off + Use_Kubelet true + Kubelet_Port 10250 {{- if index .Values "config" "extraRecords" }}