Kubernetes update container image

7/15/2019

i am trying to update container image using:

kubectl set image deployment/deployment name container name=
newimage:39

but facing this error

error: all resources must be specified before image changes:

-- bilal_khan
azure-devops
kubernetes

1 Answer

7/15/2019
   kubectl set image deployment/<deployment-name> <container-name>=$IMAGE

You can also try patch the deployment

kubectl patch deployment/deployment_name --patch "{\"spec\": {\"template\": {\"spec\": {\"initContainers\": [{\"name\": \"container_name\",\"image\": \"url_to_container\"}]}}}}"
-- Harsh Manvar
Source: StackOverflow