Does K8s pulls image from registry while creating a pod in replicaset scaling

Just wanted to ask-

Does K8s pulls image from container registry every time whenever any POD terminates (dies) in DEPLOYMENT/REPLICASET to create its replacement.

Also does it goes to container registry to pull an image while scaling up any deployment to increase the number of PODs or K8s store image reference with the cluster itself to get the new POD replica create.

Please suggest.

Each container in a pod has a value imagePullPolicy. Here is a direct link to the default rules for this and the same page has more details.

Sorry but it doesn’t answer my question and it remains same. I will try to rephrase my query as-

What if out of 4 replica any one dies, then how K8s will create replacement for dead pod?

Does it pull image from registry again or it keeps any image reference with in the cluster and creates a copy out of it with out pulling image from registry

Could you clarify why you don’t think understanding the imagePullPolicy setting doesn’t answer the question?

Sohail, I think your question is ill-formed. You said “keeps any image reference with in the cluster”. The cluster doesn’t keep references, nodes do. Given that, the docs for imagePullPolicy say:

Always means that kubelet always attempts to pull the latest image. Container will fail If the pull fails.

Never means that kubelet never pulls an image, but only uses a local image. Container will fail if the image isn’t present.

IfNotPresent means that kubelet pulls if the image isn’t present on disk. Container will fail if the image isn’t present and the pull fails.