Example to create FluentBit setup on Kubernetes Cluster in order to connect FluentBit to ElasticSearch to generate logs for the whole Kubernetes Cluster
-
Clone repo and move inside that directory
https://github.com/Shatabdi2621/kube-logging-with-fluentbit.git
-
Create a namespace (logging here in case)
kubectl create ns <insert-namespace-name-here>
eg
kubectl create ns logging
-
Switch to namespace logging
kubectl config set-context --current --namespace=<insert-namespace-name-here>
eg
kubectl config set-context --current --namespace=logging
-
Start with deployment of files
a. Deployment of Service Account on Kubernetes Cluster
kubectl apply -f .\service-account.yaml
b. Deployment of Cluster Role on Kubernetes Cluster
kubectl apply -f .\cluster-role.yaml
c. Deployment to Bind the Cluster Role to the Kubernetes Cluster
kubectl apply -f .\cluster-role-bind.yaml
d. Deploy Config Map on the Kubernetes Cluster
kubectl apply -f .\config-map.yaml
In file config-map.yaml the configuration to connect FluentBit to ElasticSearch may vary based on the requirement, you can visit the following link for more information on the configuration file "https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/configuration-file"
e. Deploy the Daemon Set to Kubernetes Cluster
kubectl apply -f .\daemon-set.yaml
Replace
- ${FLUENT_ELASTICSEARCH_HOST}
- ${FLUENT_ELASTICSEARCH_PORT}
- ${FLUENT_ELASTICSEARCH_HTTP_User}
- ${FLUENT_ELASTICSEARCH_HTTP_Passwd} with your information from your cluster
For more detailed information on the above operation please follow the link given below : "https://medium.com/kubernetes-tutorials/exporting-kubernetes-logs-to-elasticsearch-using-fluent-bit-758e8de606af"