apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

# kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1 # Updating a deployment.
# kubectl get deployment -l app=nginx -o wide # List deployment
# kubectl rollout status deployment/nginx-deployment # check rollout status
# kubectl set image deployment/nginx-deployment nginx=nginx:1.91
# kubectl rollout undo deployment nginx-deployment
# kubectl rollout undo deployment nginx-deployment --to-revision=2
# kubectl scale deployment nginx-deployment --replicas=4 # scaling a deployment
# kubectl autoscale deployment nginx-deployment --min=4 --max=8 --cpu-percent=70 # Horizontal pod autoscaling
# kubectl rollout pause deployment/nginx-deployment # pause deployment rollout
# kubectl set resources deployment nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi # update the resources
# kubectl rollout resume deployment nginx-deployment # resume deployment
