Answer a question

Currently, to update a k8s deployment image, we use the kubectl set image command like this:

kubectl set image deployment/deployment_name container=url_to_container

While this command updates the URL used for the main container in the deployment, it does not update the URL for the initContainer also set within the deployment.

Is there a similar kubectl command I can use to update the initContainer to the same URL?

Answers

The documentation seems to suggests that only containers are concerned.

Maybe you could switch to kubectl patch ?

(I know it's more tedious...)

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

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐