apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-io
  labels:
    app: k8s-io
    version: v1
spec:
  replicas: 3
  selector:
    matchLabels:
      app: k8s-io
      version: v1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: k8s-io
        version: v1
    spec:
      terminationGracePeriodSeconds: 30
      volumes:
      - name: nginx
        configMap:
          name: nginx
          # Map all keys to files.
      - name: www-get
        configMap:
          name: www-get
          # Map all keys to files.
      containers:
      - name: nginx
        image: nginx:1.26-alpine@sha256:5b44a5ab8ab467854f2bf7b835a32f850f32eb414b749fbf7ed506b139cd8d6b
        resources:
          limits:
            cpu: 1
            memory: 512Mi
        ports:
        - name: http
          containerPort: 80
        - name: https
          containerPort: 443
        livenessProbe:
          httpGet:
            path: /_healthz
            port: 80
          initialDelaySeconds: 3
          timeoutSeconds: 2
          failureThreshold: 2
        readinessProbe:
          httpGet:
            path: /_healthz
            port: 80
          initialDelaySeconds: 3
          timeoutSeconds: 2
          failureThreshold: 2
        lifecycle:
          preStop:
            exec: # nginx likes to terminate ASAP
              command:
                - /usr/sbin/nginx
                - -s
                - quit
        volumeMounts:
        - name: nginx
          mountPath: /etc/nginx
          readOnly: true
        - name: www-get
          mountPath: /www/get
          readOnly: true
