We're launching a new cybersecurity venture! Learn more about Snowbit >

Kubernetes with Fluentd (Without Helm) Kubernetes with Fluentd (Without Helm)

Last Updated: May. 10, 2022

The following manual will help you integrate Coralogix logging into your Kubernetes cluster using Fluentd.

Prerequisites

Before you begin, make sure you have:

  • Enabled RBAC authorization mode in your Kubernetes Cluster
  • Private key – you can find it in your Coralogix account at:
    Data Flow(located in the upper menu) –> API Keys –> Send your Data

Installation

First We need to create a namespace for this setup:

kubectl create namespace fluentd-coralogix

Then we create a Kubernetes secret:

kubectl create secret generic fluentd-coralogix-account-secrets \
    -n fluentd-coralogix \
    --from-literal=PRIVATE_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX \
    --from-literal=ENDPOINT=<Coralogix_API_URL>
Account URLCoralogix API URL
coralogix.comapi.coralogix.com
coralogix.usapi.coralogix.us
eu2.coralogix.comapi.eu2.coralogix.com
app.coralogix.inapi.app.coralogix.in
coralogixsg.comapi.coralogixsg.com

The result should be this:

secret "fluentd-coralogix-account-secrets" created

Then you will need to apply our fluentd-coralogix-logger to your Kubernetes cluster:

kubectl create -f https://raw.githubusercontent.com/coralogix/fluentd-coralogix-image/master/examples/kubernetes/fluentd-coralogix-rbac.yaml &&
kubectl create -f https://raw.githubusercontent.com/coralogix/fluentd-coralogix-image/master/examples/kubernetes/fluentd-http-coralogix-cm.yaml &&
kubectl create -f https://raw.githubusercontent.com/coralogix/fluentd-coralogix-image/master/examples/kubernetes/fluentd-coralogix-ds.yaml &&
kubectl create -f https://raw.githubusercontent.com/coralogix/fluentd-coralogix-image/master/examples/kubernetes/fluentd-coralogix-svc.yaml

The result should be this:

serviceaccount "fluentd-coralogix-service-account" created
clusterrole "fluentd-coralogix-service-account-role" created
clusterrolebinding "fluentd-coralogix-service-account" created
configmap "fluentd-coralogix-configs" created
daemonset "fluentd-coralogix-daemonset" created
service "fluentd-coralogix-service" created

Now, fluentd-coralogix-logger is collecting logs from your Kubernetes cluster.

Update

Once installed, the deployment will not automatically update. In order to update it, you need to delete the deployment’s pods and wait for it to be recreated. After recreation, it should use the latest image.

Delete all fluentd-coralogix-logger pods:

kubectl -n fluentd-coralogix delete $(kubectl -n fluentd-coralogix get pod -o name | grep "fluentd-coralogix-daemonset")

Note that if you would like to send all of the log content with Kubernetes metadata like labels, tags, pod name, etc. you should remove log_key_name log from Fluentd.conf.

Uninstall

If you want to remove fluentd-coralogix-logger from your cluster, execute this:

kubectl -n fluentd-coralogix delete secret fluentd-coralogix-account-secrets &&
kubectl -n fluentd-coralogix delete svc,ds,cm,clusterrolebinding,clusterrole,sa -l k8s-app=fluentd-coralogix-logger

On this page