Kubectl edit pod redis

Hi,

I am doing on question : Now change the image on this pod to redis.
Once done, the pod should be in a running state.

While running this below command and doing required changes from redis123 to redis in the file. what is the procedure to save the file?

Use the kubectl edit command to update the image of the pod to redis.

kubectl edit pod redis

Regards
Rajan Verma

Most changes to a pod you need to make by outputting the pod’s YAML to file, editing the file, then deleting the pod and doing create or apply on the edited file, like this:

kubectl get pod redis-pod -o yaml > redis-file.yaml
vi redis-file.yaml # edit the file
kubectl delete po redis-pod; kubectl apply -f redis-file.yaml

Since you’re changing the image – one of the few things you can change on a live pod – there are quicker ways to do this, but this approach will work fine for you.

thanks a lot Rob now it is working.