3
  1. I have a 2 replicas of statefulsets with image name : ABC:1.1
  2. No I want to Upgrade the statefulset to newer Version : ABC:1.2

ImagePullPolicy is set to always

Also suppose once i already deployed the my statefulset with version ABC:1.2, then went back to ABC:1.1 and now I'm trying to upgrade it to version ABC:1.2.

1.2(once deployed) ==> went back to version(1.1) ==> Now would want to upgrade again to (1.2)

Q1) My Question is, will my whole Image be pulled again from Docker repo ? Or Only Missing layers will be pulled ?

Q2) Does ImagePullPolicy forces a whole image pull or just missing layers?

Please help me understand this.

himanshu
  • 175
  • 3
  • 12

2 Answers2

3

Answer to your both question is that the whole image will be pulled again. and it will say layer already exists after pulling if any layers exist. Just hint you always pull images not the specfic layers.

Dashrath Mundkar
  • 7,956
  • 2
  • 28
  • 42
  • thanks for the answer. Can i also conclude that if my newer image is smaller in size so upgrade will also take lesser time as image pull time will reduce? – himanshu Sep 04 '20 at 08:04
  • just one more thing. Apart from upgrade if my Pod is deleted/restarted, then what happens? – himanshu Sep 04 '20 at 09:24
  • @himanshusingh the image you defined in the deployment file will get pulled. – Dashrath Mundkar Sep 04 '20 at 09:26
  • Okay got it.Do you have any reference for the same, it would be helpful. – himanshu Sep 04 '20 at 10:01
  • you can search for rolling strategy in kubernetes. you will get it – Dashrath Mundkar Sep 04 '20 at 10:05
  • I'm a bit confused reading this : https://kubernetes.io/docs/concepts/configuration/overview/#container-images talks about cached images – himanshu Sep 04 '20 at 10:25
  • @what confusion you have? Docker image is made of layers and each layer exist some kind of data. When you pull the image it check if image already present or not then it pull the image while pulling it also checks if so,e layers already present or not. if present it say layer already exist. and just add new layers on top of it. – Dashrath Mundkar Sep 06 '20 at 07:43
  • @himanshusingh in kubernetes when you pull the image. the image is stays on worker node. so whenever you pulls new image it check if any layer exists or not. – Dashrath Mundkar Sep 06 '20 at 07:55
1

You can check the details of what is happening in deployment usin the following commands:

kubectl rollout status deploy/ABC

kubectl rollout history deploy/ABC

kubectl describe deploy ABC
KayV
  • 12,987
  • 11
  • 98
  • 148