kubernetes possible different image running at same time which cause issue?

9/19/2018

Let's say I have a pod using an image myImage:latest (in docker.hub) which its imagePullPolicy is Always, and it is running in worker node 1. The image id is myImage:latest@sha-1111.

Let's say if I push a new image to docker.hub with myImage:latest@sha-2222. After that I scale my pod up, the pod is scheduled in worker node 2 which will pull the new image to start the pod. In this case, I suppose the new pod will be using image sha-2222? Would this be an issue? How could we solve this?

PS:

Note that you should avoid using :latest tag, see Best Practices for Configuration for more information.

Understand using latest tag is bad practice. But I believe this will happen too if we tag to specific number.

-- GMsoF
kubernetes

1 Answer

9/19/2018

If you tag to a specific number, then that specific number will get pulled onto node2 -> no issue.

If you don't tag a specific number, but use latest (as you noted, not recommended) -> outcome is determined by whether the container's behavior is backwards compatible. E.g., if the first container is v1.1.0 and the second container is v1.2.0 and your versioning is based on semantic versioning, you still should have no practical issue.

To solve, use specific image versions and perform an upgrade at the time of doing the scaling. Existing instances will be updated to the new version, and new instances (to match scaling needs) will be pulled from the new version.

-- TinaC
Source: StackOverflow