# Sidecar

```
apiVersion: v1
kind: Pod
metadata:
  name: multi
  namespace: baz
spec:
  restartPolicy: Never
  containers:
  - name: nginx-container
    image: nginx
  - name: redis-container
    image: debian

---
apiVersion: v1
kind: Pod
metadata:
  name: logging-sidecar
  namespace: baz
spec:
  volumes:
  - name: sharedvol
    emptyDir: {}
  containers:
  - name: busybox1
    image: busybox
    volumeMounts:
    - name: sharedvol
      mountPath: /output
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo Logging data > /output/output.log; sleep 5; done"]
  - name: sidecar
    image: busybox
    volumeMounts:
    - name: sharedvol
      mountPath: /input
    command: ["/bin/sh"]
    args: ["-c", "tail -f /input/output.log"]


---
apiVersion: v1
kind: Pod
metadata:
  name: logging-sidecar
  namespace: baz
spec:
  containers:
  - name: busybox1
    image: busybox
    command: ['sh', '-c', 'while true; do echo Logging data > /output/output.log; sleep 5; done']
    volumeMounts:
    - name: sharedvol
      mountPath: /output
  - name: sidecar
    image: busybox
    command: ['sh', '-c', 'tail -f /input/output.log']
    volumeMounts:
    - name: sharedvol
      mountPath: /input
  volumes:
  - name: sharedvol
    emptyDir: {}
```
