Sudeepthi Kakarla Naga:
Hi, Can any one help me with this lab excercise? how to change the deployment
strategy from rollingupdate
to recreate
with out deleting and recreating the deployment ? below is the question from Deployments
lab: Change the deployment strategy to
Recreate • Do not delete and re-create the deployment. Only update the strategy type for the existing deployment.
• Deployment Name: frontend • Deployment Image: kodekloud/webapp-color:v2 • Strategy: Recreate
minakshi bose:
can’t we edit the deployment to update the strategy
Sudeepthi Kakarla Naga:
@minakshi bose: editing will creating a new tmp file. that eventually leads to deleting and recreating the deployment object.
Phani M:
@Sudeepthi Kakarla Naga I edited the deployment and changed the strategy type to Recreate. While in edit mode, please make sure to delete these 3 lines related to rollingUpdate specs of 25%… and change the "type"
to Recreate
This has updated the deployment but didn’t result in deletion/recreation of the deployment object.
vagrant@kubemaster:~$ kdp
NAME READY UP-TO-DATE AVAILABLE AGE
dep1 1/1 1 1 49s
vagrant@kubemaster:~$ k get deploy dep1 -o jsonpath='{.spec.strategy.type}{"\n"}'
RollingUpdate
vagrant@kubemaster:~$
vagrant@kubemaster:~$ k edit deploy/dep1
deployment.apps/dep1 edited
vagrant@kubemaster:~$
vagrant@kubemaster:~$
vagrant@kubemaster:~$ kdp
NAME READY UP-TO-DATE AVAILABLE AGE
dep1 1/1 1 1 118s
There is a pod created and unchanged for this deploy even after updating the type:
dep1-555947d676-jsnp5 1/1 Running 0 2m19s
vagrant@kubemaster:~$ k get deploy dep1 -o jsonpath='{.spec.strategy.type}{"\n"}'
Recreate
Can you please try?