Strategies for using rolling updates on multi-container replication controllers?

8/30/2015

Is there any way to do a rolling-update with a replication controller that has 2 or more containers?

For example, I have Jenkins setup to automatically do a rolling update on a rep controller in our dev environment once a successful build takes place using the --image flag specifying the new container's image stored in GCR. This method doesn't work when there are two containers in the same pod and there is no "-c" flag to specify the container you wish to update on the rolling-update command as there is on other commands such as "exec" or "logs".

The reason I'm looking to have multiple pods is to implement a logging sidecar as in: https://github.com/kubernetes/contrib/tree/master/logging/fluentd-sidecar-es

The only alternative I can think of is to bake the fluentd config into each container, which feels decidedly 'un-kubernetes' to me.

-- coleca
kubernetes

1 Answer

8/30/2015

You are right in saying that kubectl rolling-update frontend --image=image:v2 does not give you a way to provide more details about a container when updating a pod that has more than one container. It gives you an error Image update is not supported for multi-container pods

But, it certainly gives you 2 variants

  1. kubectl rolling-update frontend-v1 -f frontend-v2.json
  2. cat frontend-v2.json | kubectl rolling-update frontend-v1 -f -

where v1 and v2 can be your build versions. This way, you would also have the advantage of your pod names adhering to your build versions too.

-- Uday
Source: StackOverflow