DEV Community

Fluentd - Use case and setup

tonybui1812 on October 30, 2023

Filebeat do the same as fluentd, right? Yes, Filebeat and Fluentd are both log shippers or agents that serve similar purposes in log collection an...
Collapse
 
easytony profile image
tonybui1812

Where to get fluentd images. Is it includes in Kubernetes?

Collapse
 
easytony profile image
tonybui1812

Fluentd images are not included in Kubernetes itself, but you can easily find Fluentd images on popular container image registries like Docker Hub. These images are maintained by the Fluentd community and various organizations. To get a Fluentd image, follow these steps:

  1. Docker Hub:

    • The official Fluentd Docker images are hosted on Docker Hub. You can search for Fluentd images by visiting the Fluentd organization on Docker Hub: hub.docker.com/r/fluent/fluentd
  2. Select an Image:

    • Choose the Fluentd image that suits your needs. You'll typically want one with the necessary plugins for your log collection and forwarding requirements. The official Fluentd images are tagged with different versions and configurations.
  3. Pull the Image:

    • Use the docker pull command to download the Fluentd image to your local machine. Replace fluent/fluentd:<tag> with the image name and tag you want to use. For example, to pull Fluentd version 4.7.5, use:
     docker pull fluent/fluentd:4.7.5
    
  4. Use the Image in Kubernetes:

    • When setting up Fluentd in a Kubernetes cluster, you can reference the Fluentd image you pulled in your DaemonSet or other deployment YAML manifests.

Here's an example of a Fluentd DaemonSet configuration that uses the Fluentd image:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: your-namespace
spec:
  selector:
    matchLabels:
      app: fluentd-logging
  template:
    metadata:
      labels:
        app: fluentd-logging
    spec:
      containers:
      - name: fluentd
        image: fluent/fluentd:4.7.5
        env:
          - name: FLUENTD_CONF
            value: "fluent.conf"
        volumeMounts:
          - name: config-volume
            mountPath: /fluentd/etc/
      volumes:
      - name: config-volume
        configMap:
          name: fluentd-config
        defaultMode: 420
Enter fullscreen mode Exit fullscreen mode

In this example, we reference the Fluentd image fluent/fluentd:4.7.5. Replace it with the version and image you intend to use.

Remember that Fluentd's image tags correspond to different versions and configurations. Choose the one that best fits your requirements, and make sure it includes any necessary plugins for log collection from your specific environment or sources.