apiVersion: v1
kind: Pod
metadata:
  name: webserver
spec:
  volumes:
    - name: shared-logs
      persistentVolumeClaim:
          claimName: task-pv-claim

  containers:
    - name: nginx
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - name: shared-logs
          mountPath: /var/log/nginx

    - name: sidecar-container
      image: busybox
      command: ["sh","-c","while true; do cat /var/log/nginx/access.log /var/log/nginx/error.log; sleep 30; done"]
      volumeMounts:
        - name: shared-logs
          mountPath: /var/log/nginx
  initContainers:
  - name: init-myservice
    image: busybox:1.28
    command: ['sh', '-c', "echo hello service"]
  - name: init-mydb
    image: busybox:1.28
    command: ['sh', '-c', "echo hello db"]
 