How to update deployment's initContainer image without down time in kubernetes?

6/3/2019

kubernetes version:1.10.4

In my project,I have an initContainer image and an common container image,I want to update the initContainer's image with zero down time.

But the kubectl set image xxx command cannot work on initContainer.

I have read the document about rolling update containers' image, but not found the information about initContainer image.

Who has encountered this situation?

-- Loving Still
kubernetes

1 Answer

6/3/2019

If you want to do manual change I'd start with

kubectl edit deployment xxx

for non-interactive operations it's probably easiest to use kubectl patch like

kubectl patch deployment/xxx -p '{"spec": {"template": {"spec": {"initContainers":[{"name":"cinit", "image":"alpine:3.6"}]}}}}'
-- Radek 'Goblin' Pieczonka
Source: StackOverflow