title: Kubernetes: how can I mount container log files to host
body: <p>I've an applicaion running inside pod which is created by deployment specification in k8s. As I've NFS clients in all nodes, I can mount volume from host to pod. Here is the mount-vol portion of yml file</p>
  
  <pre><code>spec:
    containers:
      volumeMounts:
      - mountPath: /app/config
        name: config-volume
      - mountPath: /var/log
        name: logs
  
    volumes:
    - name: config-volume
      hostPath:
        path: /nfs/config
    - name: logs
      hostPath:
        path: /nfs/logs/containerlogs
  </code></pre>
  
  <p><strong>config-volume</strong>: it mounts the config files from host to pod container.</p>
  
  <p><strong>logs</strong>: it is <strong>not working</strong>. I want to mount the log folder from pod container to host folder. </p>