How can I save my changes on pod to do a URL redirect on nginx ingress?

12/6/2021

I'm new working with docker and kubernetes, and I have some problems on my company environment to save somethings.

I have my environment running on a EKS and I need to do a redirect URL on my NGINX ingress-controller, but I couldn't save my changes on environment. I've tried to update rules on my nginx.conf and push a new docker image to deploy on my pod with kubectl set image. The new image was applied when I ran kubectl describe pod on my deployment and my pod, but changes didn't work, nothing was changed.

Is there another way to update pods image on kubernetes?

-- leo1rln
docker
kubernetes
kubernetes-pod
nginx
nginx-ingress

1 Answer

12/6/2021
  • If your pod defintion is embedded inside Deployment resource, you can run the kubectl set image at the level of Deployment, then "Deployment" resource will take care of rolling update the new revision.
  • If you are using pod without Deployment, you need to recreate your pod:

    ns=my-namepsace # change it as per your namespace
    pd=my-pod-name # change it as per your pod name, .. then:
    kubectl -n $ns get pod $pd -o yaml | kubectl -n $ns replace -f-
-- Abdennour TOUMI
Source: StackOverflow