Sandeep Panchal:
Hello - I am new to this and working on a lab. I started a pod with image redis123 and after that I updated pod with image redis , How can i restart pod with new config changes ?
Deepak Ladwa:
delete and re-create the pod with correct image
Sandeep Panchal:
OK, Thanks, Let me try
Deepak Ladwa:
Tej_Singh_Rana:
Hello, @Sandeep Panchal
If you have updated in the definition yaml file then please delete the existing pod then recreate again otherwise run the command kubectl replace
. This command will delete the pod and will recreate again from updated definition file.
$ kubectl replace -f file-name.yaml --force
Sandeep Panchal:
I did not use a yaml file to create pod. I created pod with command kubectl run pod redis --image:redis123
Sandeep Panchal:
After that I did edit pod and replaced redis123 by redid - How can I run pod with correct image ? @Tej_Singh_Rana
Tej_Singh_Rana:
That’s enough, it will automatically recreate again with new image.
Sandeep Panchal:
OK, Thanks.
Sandeep Panchal:
What filename i use ?
Tej_Singh_Rana:
filename?
Sandeep Panchal:
kubectl replace -f file-name.yaml --force
Sandeep Panchal:
I am not using a yaml file.
Tej_Singh_Rana:
It could be anything, I gave an example.
Sandeep Panchal:
OK, Thanks
Sandeep Panchal:
will try in few mins
Tej_Singh_Rana:
I thought you stored in a file and trying to update.
Sandeep Panchal:
This is what i did
Sandeep Panchal:
controlplane $ kubectl run redis --image=redis123
pod/redis created
Sandeep Panchal:
after that i did “kubectl edit pod redis” and updated image to redis from redis123