apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-io
  labels:
    app: k8s-io
    version: v1
spec:
  replicas: 2
  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.10-alpine  # = :stable-alpine as of 8/23/2016
        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: [ "/bin/sleep", "30" ]
        volumeMounts:
        - name: nginx
          mountPath: /etc/nginx
          readOnly: true
        - name: www-get
          mountPath: /www/get
          readOnly: true
