From a31f1dafd42b8c57a98867ee01ef5508b0bc66e1 Mon Sep 17 00:00:00 2001 From: Daniel Shown Date: Fri, 1 May 2020 10:21:51 -0500 Subject: [PATCH 1/2] removed duplicate text in README Signed-off-by: Daniel Shown --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index ca2986b..adc7db2 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,6 @@ Fluent Bit DaemonSet ready to be used with Kafka on a normal Kubernetes Cluster: $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/kafka/fluent-bit-ds.yaml ``` -#### Fluent Bit to Elasticsearch on Minikube - -If you are using Minikube for testing purposes, use the following alternative DaemonSet manifest: - -``` -$ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/elasticsearch/fluent-bit-ds-minikube.yaml -``` - ## Details The default configuration of Fluent Bit makes sure of the following: From 33b4e4e4b73962c20c1c2c3ba0c9976604e0585a Mon Sep 17 00:00:00 2001 From: Daniel Shown Date: Fri, 1 May 2020 10:21:51 -0500 Subject: [PATCH 2/2] added ability to use kustomize directly from the repo Signed-off-by: Daniel Shown --- README.md | 24 +++++++++++++++++++ .../fluent-bit-ds-minikube.yaml | 0 .../elasticsearch-minikube/kustomization.yaml | 10 ++++++++ output/elasticsearch/kustomization.yaml | 11 +++++++++ output/kafka/kustomization.yaml | 11 +++++++++ output/kustomize/fluent-bit-role-binding.yaml | 12 ++++++++++ output/kustomize/fluent-bit-role.yaml | 10 ++++++++ .../kustomize/fluent-bit-service-account.yaml | 5 ++++ output/kustomize/kustomization.yaml | 9 +++++++ 9 files changed, 92 insertions(+) rename output/{elasticsearch => elasticsearch-minikube}/fluent-bit-ds-minikube.yaml (100%) create mode 100644 output/elasticsearch-minikube/kustomization.yaml create mode 100644 output/elasticsearch/kustomization.yaml create mode 100644 output/kafka/kustomization.yaml create mode 100644 output/kustomize/fluent-bit-role-binding.yaml create mode 100644 output/kustomize/fluent-bit-role.yaml create mode 100644 output/kustomize/fluent-bit-service-account.yaml create mode 100644 output/kustomize/kustomization.yaml diff --git a/README.md b/README.md index adc7db2..3d38376 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernet $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/fluent-bit-role-binding.yaml ``` +Alternatively, you can use [Kustomize](https://kustomize.io/), which is also built into newer versions of kubectl. + +``` +$ kustomize build github.com/fluent/fluent-bit-kubernetes-logging/output/kustomize | kubectl create -f - +``` + #### Fluent Bit to Elasticsearch The next step is to create a ConfigMap that will be used by our Fluent Bit DaemonSet: @@ -35,6 +41,12 @@ Fluent Bit DaemonSet ready to be used with Elasticsearch on a normal Kubernetes $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/elasticsearch/fluent-bit-ds.yaml ``` +Or, if you are using kustomize: + +``` +$ kustomize build github.com/fluent/fluent-bit-kubernetes-logging/output/elasticsearch/ | kubectl create -f - +``` + #### Fluent Bit to Elasticsearch on Minikube If you are using Minikube for testing purposes, use the following alternative DaemonSet manifest: @@ -43,6 +55,12 @@ If you are using Minikube for testing purposes, use the following alternative Da $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/elasticsearch/fluent-bit-ds-minikube.yaml ``` +Or, if you are using kustomize: + +``` +$ kustomize build github.com/fluent/fluent-bit-kubernetes-logging/output/elasticsearch-minikube | kubectl create -f - +``` + #### Fluent Bit to Kafka Create a ConfigMap that will be used by our Fluent Bit DaemonSet: @@ -57,6 +75,12 @@ Fluent Bit DaemonSet ready to be used with Kafka on a normal Kubernetes Cluster: $ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/kafka/fluent-bit-ds.yaml ``` +Or, if you are using kustomize: + +``` +$ kustomize build github.com/fluent/fluent-bit-kubernetes-logging/output/kafka | kubectl create -f - +``` + ## Details The default configuration of Fluent Bit makes sure of the following: diff --git a/output/elasticsearch/fluent-bit-ds-minikube.yaml b/output/elasticsearch-minikube/fluent-bit-ds-minikube.yaml similarity index 100% rename from output/elasticsearch/fluent-bit-ds-minikube.yaml rename to output/elasticsearch-minikube/fluent-bit-ds-minikube.yaml diff --git a/output/elasticsearch-minikube/kustomization.yaml b/output/elasticsearch-minikube/kustomization.yaml new file mode 100644 index 0000000..3abfeee --- /dev/null +++ b/output/elasticsearch-minikube/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: logging + +bases: + - ../elasticsearch/ + +patchesStrategicMerge: + - fluent-bit-ds-minikube.yaml diff --git a/output/elasticsearch/kustomization.yaml b/output/elasticsearch/kustomization.yaml new file mode 100644 index 0000000..41e8fac --- /dev/null +++ b/output/elasticsearch/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: logging + +bases: + - ../kustomize + +resources: + - fluent-bit-configmap.yaml + - fluent-bit-ds.yaml \ No newline at end of file diff --git a/output/kafka/kustomization.yaml b/output/kafka/kustomization.yaml new file mode 100644 index 0000000..41e8fac --- /dev/null +++ b/output/kafka/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: logging + +bases: + - ../kustomize + +resources: + - fluent-bit-configmap.yaml + - fluent-bit-ds.yaml \ No newline at end of file diff --git a/output/kustomize/fluent-bit-role-binding.yaml b/output/kustomize/fluent-bit-role-binding.yaml new file mode 100644 index 0000000..ff6f258 --- /dev/null +++ b/output/kustomize/fluent-bit-role-binding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: fluent-bit-read +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: fluent-bit-read +subjects: +- kind: ServiceAccount + name: fluent-bit + namespace: logging diff --git a/output/kustomize/fluent-bit-role.yaml b/output/kustomize/fluent-bit-role.yaml new file mode 100644 index 0000000..e55463a --- /dev/null +++ b/output/kustomize/fluent-bit-role.yaml @@ -0,0 +1,10 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: fluent-bit-read +rules: +- apiGroups: [""] + resources: + - namespaces + - pods + verbs: ["get", "list", "watch"] diff --git a/output/kustomize/fluent-bit-service-account.yaml b/output/kustomize/fluent-bit-service-account.yaml new file mode 100644 index 0000000..c541d81 --- /dev/null +++ b/output/kustomize/fluent-bit-service-account.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: fluent-bit + namespace: logging diff --git a/output/kustomize/kustomization.yaml b/output/kustomize/kustomization.yaml new file mode 100644 index 0000000..105a559 --- /dev/null +++ b/output/kustomize/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: logging + +resources: + - fluent-bit-service-account.yaml + - fluent-bit-role.yaml + - fluent-bit-role-binding.yaml \ No newline at end of file