apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app-canary
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 100%
  selector:
    matchLabels:
      app: web-app-canary
  template:
    metadata:
      labels:
        app: web-app-canary
    spec:
      containers:
        - name: nginx-non-root
          image: 99francs/nginx-non-root:1.19.5
          volumeMounts:
            - mountPath: /app
              name: app
          readinessProbe:
            httpGet:
              path: /index.html
              port: 8000
          livenessProbe:
            tcpSocket:
              port: 8000
      initContainers:
        - name: init-web-app-canary
          image: busybox:1.31.0
          command: ['sh', '-c', 'wget -O- https://tinyurl.com/otus-k8s-intro | sh']
          volumeMounts:
            - mountPath: /app
              name: app
      volumes:
        - name: app
          emptyDir: {}
