In the rare case you need to update the Container Images Manually instead of managing the Deployment the GitOps Way via FluxCD or ArgoCD. Then see the commands bellow.
With FluxCD you can do the following:
Ask FluxCD to stop managing the Deployment/ Statefulset.
flux suspend kustomization <kustomization-name>
Update the image with the following commands.
kubectl set image statefulsets.apps/<statefulset-name> <container-name>=<image-name>
OR
kubectl patch statefulsets.apps/<statefulset-name> -p '{"spec":{"containers":[{"name":"<container-name>","image":"<image-name>"}]}}'
Ensure the Image has been updated.
kubectl get statefulsets.apps/<statefulset-name>-o=jsonpath='{$.spec.template.spec.containers[:1].image}'
I hope you like the tutorial, if you do give a thumps up! and follow me in Twitter, also you can subscribe to my Newsletter in order to avoid missing any of the upcoming tutorials.
Media Attribution
I would like to thank Clark Tibbs for designing the awesome photo I am using in my posts.