> For the complete documentation index, see [llms.txt](https://dev7days.gitbook.io/dev7days/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev7days.gitbook.io/dev7days/deployment.md).

# Deployment

Describe about What is Deployment ?

It is similar to `ReplicaSet` , the different thing is we can update the new version of pod by using `Deployment`

There are 2 mechanism to update pod version:

1. **Recreate**
2. **Rolling Update**

**Recreate** = It will destroy all of the existing pod and recreate (has downtime)

**Rolling Update** (default) = It will create new pod with new version after that it will down the existing pod this process is doing 1 by 1 until remove all of existing pod (no down time)\
\
\
**CheatSheet Command**

1. &#x20;Get Deployment :  `kubectl get deployment`
2. Create Deployment: `kubectl create deployment <deployment_name> --replicas=<amount_of_replica> --image=<image_name>`
3. Check the apiVersion  of the template: `kubectl explain deployment`
4. Execute command from file `kubectl apply -f <file_name>.yaml`
5. Check status of rollout deployment: `kubectl rollout status deployment/<depoyment_name>`
6. Check history of rollout deployment: `kubectl rollout history deployment/<depoyment_name>`
7. Undo rollout deployment: `kubectl rollout undo deployment/<depoyment_name>`
