apiVersion: v1
kind: Pod
metadata:
  name: sidecar-pod
  labels:
    app: sidecar-pod
spec:
  volumes:
  - name: shared-data
    emptyDir: {}

  containers:

  - name: first
    image: nginx
    volumeMounts:
    - name: shared-data
      mountPath: /usr/share/nginx/html

  - name: second
    image: debian
    volumeMounts:
    - name: shared-data
      mountPath: /pod-data
    command: ["/bin/sh"]
    args:
      - "-c"
      - >
        while true; do
          echo "Hello from the sidecar container. My time is:" >> /pod-data/index.html;
          date >> /pod-data/index.html;
          sleep 1;
        done
