# This example shows how volume (emptyDir) can be used.
# emptyDir is a temporary directory located in a pod which can be shared by containers inside the pod.
# In this example, wwo containers app and sidecar are defined in a single pod.
# emptyDir of the pod is mounted on the specified path of both containers.
apiVersion: v1
kind: Pod
metadata:
  name: sidecar
spec:
  containers:
    - name: app
      image: busybox
      args:
        - /bin/sh
        - -c
        - >
          while true;
          do
            echo "$(date)\n" >> /var/log/example.log;
            sleep 1;
          done
      volumeMounts:
        - name: varlog
          mountPath: /var/log
    - name: sidecar
      image: busybox
      args: [/bin/sh, -c, "tail -f /var/log/example.log"]
      volumeMounts:
        - name: varlog
          mountPath: /var/log
  volumes:
    - name: varlog
      emptyDir: {}