apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-init-container
spec:
  replicas: 1
  selector:
    matchLabels:
      id: test-init-container
  template:
    metadata:
      labels:
        id: test-init-container
    spec:
      volumes:
      - name: web-content
        emptyDir: {}
      initContainers:
      - name: myapp-container
        image: busybox:1.31.0
        command: ['sh', '-c', 'echo "check this out!" > /usr/share/nginx/index.html']
        volumeMounts:
        - name: web-content
          mountPath: /usr/share/nginx
      containers:
      - image: nginx:1.17.3-alpine
        name: nginx
        volumeMounts:
        - name: web-content
          mountPath: /usr/share/nginx/html
        ports:
        - containerPort: 80

