Hello all , Suppose I create a rs controlling 2 pods with v1 image. Then updat . . .

I M:
Hello all ,
Suppose I create a rs controlling 2 pods with v1 image.
Then updated the rs yaml file’s image to v2.
Doing kubectl apply -f will not update the running Poe’s image.
Also,
Now I increased the count to 3.
Therefore , now there is 2 v1 pod and 1 new v2 pod

is this ok or I am not understanding ?

Fernando Jimenez:

You description is accurate. ReplicaSet is concerned only with the labels matching. If you have a pod running previously and that pod's labels match, the replicaset is going to take it as part of the desired count. As you see, it is not concerned with the image, but with running pods that match the given labels.

Fernando Jimenez:
A Deployment object, will be concerned with images and versions of it. It will manage the desired replicas count via a ReplicaSet.

Karim Meslem:
:thumbsup:

I M:
Thanks @Fernando Jimenez so why is the rs needed… As stateftulset controls stateful pod directly ; deployment could also do it without need of rs ?

Fernando Jimenez:
Actually, both StatefulSet and Deployment objects employ behind the scene ReplicaSet to keep the desired count. That’s what the first spec is all about in either one of them.

spec:
  selector:
    matchLabels:
      app: my-app
  replicas: 3

I M:
Oh ok thanks got it … Really appreciate that you help me get clarity