apiVersion: apps/v1
kind: Deployment
metadata:
  name:  rolling-nginx
  labels:
    app:  rolling-nginx
spec:
  selector:
    matchLabels:
      app: rolling-nginx
  replicas: 4
  strategy:
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      name: rolling-nginx
      labels:
        app:  rolling-nginx
    spec:
      # initContainers:
        # Init containers are exactly like regular containers, except:
          # - Init containers always run to completion.
          # - Each init container must complete successfully before the next one starts.
      containers:
      - name:  nginx
        image:  nginx:1.9
        resources:
          requests:
            cpu: 50m
            memory: 50Mi
          limits:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort:  80
          name:  rolling-nginx
      restartPolicy: Always