[Imperative]
$ kubectl create deployment DEPLOYMENT_NAME --image=IMAGE_NAME
  kubectl create deployment mywebsite --image=nginx
$ kubectl get deployment mywebsite
$ kubectl delete deployment/mywebsite

[Declarative]
It can define a Deployment in a YAML file
$ kubectl apply -f Deployment.yaml
To update a Deployment from nginx version 1.22.0 to 1.22.1
$ kubectl set image deployment mywebsite nginx=nginx:1.22.1
$ kubectl rollout status deployment mywebsite
$ kubectl rollout pause deployment mywebsite
$ kubectl rollout resume deployment mywebsite
$ kubectl rollout history deployment mywebsite
$ kubectl rollout history deployment mywebsite --revision 1
$ kubectl rollout undo deployment mywebsite
$ kubectl rollout undo deployment mywebsite --to-revision 1
$ kubectl scale deployment mywebsite --replicas=3
To deleting all Pods in the Deployment without deleting the Deployment, we can scale the replicas to 0.
This trick for keeping the deployment available while effectively deleting all Pods.
$ kubectl scale deployment mywebsite --replicas=0
$ kubectl get deployment mywebsite
NAME        READY   UP-TO-DATE   AVAILABLE   AGE
mywebsite   0/0     0            0           7m48s
then enable the horizontal pod autoscaler
The --cpu-percentage flag is used to define the CPU percentage based upon which the autoscaling happens.
If the mywebsite Pods exceed 50% CPU the autoscaler will create a new Pod.
The --min and --max flags are used to define the minimum and maximum number of Pods that the autoscaler can scale to.
$ kubectl autoscale deployment mywebsite --cpu-percent=50 --min=1 --max=10
$ kubectl get hpa
NAME         REFERENCE                    TARGET   CURRENT   MINPODS   MAXPODS   AGE
mywebsite    Deployment/mywebsite/scale   50%      310%      1         10        2m


[LINKS]
https://kodekloud.com/blog/kubernetes-deployments/
