(1) why do we need to update the Deployment?
There are mainly two reasons for that,
General upgrades, labels, replicas, metadata etc.
Changing Deployment container image.
Reference: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
(2) previously created Deployment.
- Create Deployment
kubectl create -f nginx-deployment.yaml
(3) Different ways to update the deployment.
using
kubectl set image
option.updating
deployment YAML
file and applyingkubect apply -f
.using edit deployment.
(1) Using kubectl
set image deployment/deployment-name
kubectl set image deployment/nginx-deployment nginx=nginx:1.15.0 --record=true
# Verify Rollout Status
kubectl rollout status deployment/nginx-deployment
(2) Making changes in (*deployment).yaml file.
- you can change metadata in YAML like replicas, image names etc and apply changes by running
kubectl apply -f nginx-deployment.yaml
(3) Using edit deployment
# get deployment
kubectl get deployment
#edit deployment
kubectl edit deployment/nginx-deployment
# edit open in vi editor you can change value in here and save it.
# Verify the same using `kubectl get pods` command.
Made with :heart: by Pratikkumar Panchal