Kubernetes Deployments are a higher level Object in Kubernetes. If we were to draw a diagram of the Objects we learnt so far, here is how it looks like.

The Deployment provides us with capability such as updating instances seamlessly using rolling updates, pause, undo & resume changes as required.
How to we create a deployment ?
We create a Yaml file. The contents of the Deployment file are very similar to that of a Replica set except for the kind which is going to be deployment.
apiVersion: v1
kind: deployment
metadata:
name: my-rc
labels:
app: mytestapp
type: front-end
spec:
template:
metadata
name: nginx
labels:
app: nginx
type: frontend
spec:
containers:
- name: nginx-container
image: nginx
replicas: 3
selector:
matchLabels:
type: front-end
Once the file is ready, use the kubectl create -f {filename.yml}
& use the kubectl get deployments
to get the status.
kubectl get all
command can be used to view all types of objects.

Update & Rollbacks:
When we first deploy our application, it creates a rollout. A new rollout creates revisioning named revision 1, in future, when the application is upgraded, it creates a new rollout & creates a new revisioning named revision 2.
This helps us keep track of the deployment & rollback to a previous version of the deployment if needed.
You can see the revisions & status of the deployment using the command
kubectl rollout status deployment/{deployment-name}
to view the history of deployments and revisions use the command
kubectl rollout history deployment/{deployment-name}
The default deployment strategy is a rolling update with Kubernetes.
kubectl apply -f {file-name.yml}
is used to update the deployments
kubectl rollout status deployment/{deployment-name}
is used to see the status of rollout
kubectl rollout undo deployment/{deployment-name}
is used to rollout a deployment.