apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 100%
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: otus-k8s-web
          image: sergeykudelin/otus-k8s-web:wtstatus
          readinessProbe:
            httpGet:
              path: /index.html
              port: 8000
          livenessProbe:
            tcpSocket:
              port: 8000
          ports:
            - containerPort: 8000
          volumeMounts:
            - name: otus-k8s-web-volume
              mountPath: /app
          resources:
            limits:
              cpu: "0.1"
              memory: "100Mi"
        - name: web-nodeexporter
          image: nginx/nginx-prometheus-exporter:0.8.0
          args: ['-nginx.scrape-uri', 'http://localhost:8000/basic_status']
          ports:
            - name: nodeexporter
              containerPort: 9113
          resources:
            limits:
              cpu: "0.1"
              memory: "100Mi"
      initContainers:
        - name: init
          image: busybox:1.32.0
          command: ['sh', '-c', 'wget -O- https://tinyurl.com/otus-k8s-intro | sh']
          volumeMounts:
            - name: otus-k8s-web-volume
              mountPath: /app
      volumes:
        - name: otus-k8s-web-volume
          emptyDir: {}