From 55e608505ae38897f744d41330d679877afcbb44 Mon Sep 17 00:00:00 2001 From: Thomas Burton Date: Mon, 6 Jul 2020 14:25:57 -0400 Subject: [PATCH 1/2] initial private fluentbit repo --- README.md | 44 +++++++++++++++++- config-map.yaml | 106 +++++++++++++++++++++++++++++++++++++++++++ daemon-set.yaml | 52 +++++++++++++++++++++ kustomization.yml | 11 +++++ role-binding.yaml | 12 +++++ role.yaml | 10 ++++ service-account.yaml | 5 ++ 7 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 config-map.yaml create mode 100644 daemon-set.yaml create mode 100644 kustomization.yml create mode 100644 role-binding.yaml create mode 100644 role.yaml create mode 100644 service-account.yaml diff --git a/README.md b/README.md index d8a4f15..190cfd2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ -# fluentbit +# Fluentbit +Manifests pulled from official Fluentbit docs [here](https://docs.fluentbit.io/manual/installation/kubernetes). + +Most of the time, you will have to use kustomize to patch elasticsearch usernames and passwords. We don't include it here cause nothing in this repo will be responsible for creating the secrets in kubernetes. + +Check this out: + +kustomization.yaml +``` +namespace: elastic + +bases: + - fluentbit-pkg/ + +patchesStrategicMerge: +- patch.yaml + +``` + + +patch.yaml +``` +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: fluent-bit +spec: + template: + spec: + containers: + - name: fluent-bit + env: + - name: FLUENT_ELASTICSEARCH_HOST + value: elasticsearch-es-http + - name: FLUENT_ELASTICSEARCH_USER + value: elastic + - name: FLUENT_ELASTICSEARCH_PASS + valueFrom: + secretKeyRef: + name: elasticsearch-es-elastic-user + key: elastic + +``` \ No newline at end of file diff --git a/config-map.yaml b/config-map.yaml new file mode 100644 index 0000000..e723323 --- /dev/null +++ b/config-map.yaml @@ -0,0 +1,106 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: fluent-bit-config + labels: + k8s-app: fluent-bit +data: + # Configuration files: server, input, filters and output + # ====================================================== + fluent-bit.conf: | + [SERVICE] + Flush 1 + Log_Level info + Daemon off + Parsers_File parsers.conf + HTTP_Server On + HTTP_Listen 0.0.0.0 + HTTP_Port 2020 + + @INCLUDE input-kubernetes.conf + @INCLUDE filter-kubernetes.conf + @INCLUDE output-elasticsearch.conf + + input-kubernetes.conf: | + [INPUT] + Name tail + Tag kube.* + Path /var/log/containers/*.log + Parser docker + DB /var/log/flb_kube.db + Mem_Buf_Limit 5MB + Skip_Long_Lines On + Refresh_Interval 10 + + filter-kubernetes.conf: | + [FILTER] + Name kubernetes + Match kube.* + Kube_URL https://kubernetes.default.svc:443 + Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token + Kube_Tag_Prefix kube.var.log.containers. + Merge_Log On + Merge_Log_Key log_processed + K8S-Logging.Parser On + K8S-Logging.Exclude On + + output-elasticsearch.conf: | + [OUTPUT] + Name es + Match * + Host ${FLUENT_ELASTICSEARCH_HOST} + Port 9200 + HTTP_User ${FLUENT_ELASTICSEARCH_USER} + HTTP_Passwd ${FLUENT_ELASTICSEARCH_PASS} + Logstash_Format On + Replace_Dots On + Retry_Limit False + Logstash_Prefix kubernetes + + parsers.conf: | + [PARSER] + Name apache + Format regex + Regex ^(?[^ ]*) [^ ]* (?[^ ]*) \[(?