Public Repository

Last pushed: 4 months ago
Short Description
Based on fluent/fluentd and fluent/fluentd-kubernetes-daemonset with gelf output
Full Description

What is fluentd-kubernetes-gelf ?

fluentd-kubernetes-gelf is an open source data collector for kubernetes, which outputs kubernetes logs via gelf protocol.

Based on fluent/fluentd and fluent/fluentd-kubernetes-daemonset. Elasticsearch gem plugin was replaced for fluent-plugin-gelf-hs

Dockerfile

FROM fluent/fluentd:latest
MAINTAINER Pascal Bernier <xbernpa@ville.montreal.qc.ca>
USER root
WORKDIR /home/fluent
ENV PATH /home/fluent/.gem/ruby/2.3.0/bin:$PATH

RUN set -ex \
    && apk add --no-cache --virtual .build-deps \
        build-base \
        ruby-dev \
    && echo 'gem: --no-document' >> /etc/gemrc \
    && gem install fluent-plugin-secure-forward \
    && gem install fluent-plugin-record-reformer \
    && gem install fluent-plugin-gelf-hs \
    && gem install fluent-plugin-kubernetes_metadata_filter \
    && apk del .build-deps \
    && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

# Copy configuration files
COPY ./conf/fluent.conf /fluentd/etc/
COPY ./conf/kubernetes.conf /fluentd/etc/

# Copy plugins
COPY plugins /fluentd/plugins/

# Environment variables
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"

# jemalloc is memory optimization only available for td-agent
# td-agent is provided and QA'ed by treasuredata as rpm/deb/.. package
# -> td-agent (stable) vs fluentd (edge)
#ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"

# Run Fluentd
CMD exec fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT

Fluentd-kubernetes-gelf daemonset

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: kube-system
  labels:
    k8s-app: fluentd-logging
    version: v1
    kubernetes.io/cluster-service: "true"
spec:
  template:
    metadata:
      labels:
        k8s-app: fluentd-logging
        version: v1
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: fluentd
        image: xbernpa/fluentd-kubernetes-gelf
        imagePullPolicy: Always 
        env:
          - name:  GELF_HOST 
            value: "ip or host"
          - name:  GELF_PORT
            value: "port"
          - name: GELF_PROTOCOL
            value: "tcp or udp"
        resources:
          limits:
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
Docker Pull Command
Owner
xbernpa

Comments (0)