<p>I am using Fluentd as a sidecar to ship nginx logs to stdout so they show up in the Pod's logs. I have a strange problem that Fluentd is not picking up the configuration when the container starts.</p>

<p>Upon examining the Fluentd startup logs it appears that the configuration is not being loaded. The config is supposed to be loaded from /etc/fluentd-config/fluentd.conf when the container starts. I have connected to the container and the config file is correct, and the pv mounts are also correct. The environment variable also exists.</p>

<p>The full deployment spec is below - and is self contained if you feel like playing with it.</p>

<pre><code>apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: weblog-pv
    labels:
      type: local
  spec:
    storageClassName: manual
    accessModes: 
    - ReadWriteOnce
    hostPath:
      path: /tmp/weblog
      type: DirectoryOrCreate
    capacity: 
      storage: 500Mi

- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: weblog-pvc
  spec:
    storageClassName: manual
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 200Mi

- apiVersion: v1
  kind: ConfigMap
  metadata:
    name: fluentd-config
  data:
    fluentd.conf: |
      &lt;source&gt;
        @type tail
        format none
        path /var/log/nginx/access.log
        tag count.format1
      &lt;/source&gt;
      &lt;match *.**&gt;
        @type forward
        &lt;server&gt;
          name localhost
          host 127.0.0.1
        &lt;/server&gt;
      &lt;/match&gt;

- apiVersion: v1
  kind: Pod
  metadata:
    name: sidecar-example
    labels:
      app: webserver
  spec:
    containers:
    - name: nginx
      image: nginx:latest
      ports: 
      - containerPort: 80
      volumeMounts:
      - name: logging-vol
        mountPath: /var/log/nginx
    - name: fdlogger
      env:
        - name: FLUENTD_ARGS
          value: -c /etc/fluentd-config/fluentd.conf
      image: fluent/fluentd
      volumeMounts:
      - name: logging-vol
        mountPath: /var/log/nginx
      - name: log-config
        mountPath: /etc/fluentd-config
    volumes:
      - name: logging-vol
        persistentVolumeClaim: 
          claimName: weblog-pvc
      - name: log-config
        configMap:
          name: fluentd-config

- apiVersion: v1
  kind: Service
  metadata:
    name: sidecar-svc
  spec:
    selector:
      app:  webserver
    type: NodePort
    ports:
    - name:  sidecar-port
      port:  80
      nodePort:  32000
</code></pre>

<p>I got it to work by using stdout instead of redirecting to localhost.</p>

<pre><code>- apiVersion: v1
  kind: ConfigMap
  metadata:
    name: fluentd-config
  data:
    fluent.conf: |
      &lt;source&gt;
        @type tail
        format none
        path /var/log/nginx/access.log
        tag count.format1
      &lt;/source&gt;
      &lt;match *.**&gt;
        @type stdout
      &lt;/match&gt;
</code></pre>
