<p>I need to clear some stuff please :</p>
<p>1- Do you create a totally new Deployment ?</p>
<p><strong>Ex:</strong></p>
<p>The old deployment has name <strong>Deployment_1</strong></p>
<p>The new deployment has name <strong>Deployment_2</strong></p>
<p>2- If yes. Do you created a totally new deployment just  because the old one is not updating the pods for the blocker that you mentioned above ?</p>
<p>3- If yes and you update the image name for that deployment. then you need set the replicas to zero using this command.</p>
<pre><code>kubectl -n NAMESPACE scale deploy DEPLOYMENT_NAME --replicas=0
</code></pre>
<p>And make sure that the replicas is zero by this command.</p>
<pre><code>kubectl -n NAMESPACE get deploy/DEPLOYMENT_NAME
</code></pre>
<p>Then scale it up again.</p>
<pre><code>kubectl -n NAMESPACE scale deploy DEPLOYMENT_NAME --replicas=1
</code></pre>
<p>Note: You can set the count of replicas that you need I just write 1 for example.</p>

CC BY-SA 4.0
2022-04-28T08:04:17.990Z
2022-04-28T08:04:17.990Z
MSherby
<p>A new deployment has been created and the release was successfully deployed on our AKS cluster.</p>
<p>We have noticed in logs that pods, for old ReplicaSet(which still exists on the cluster), are regularly executed. This is actually happening only for one specific ReplicaSet. The reason we have noticed it - it tries to perform a database update for an old db version.</p>
<p>Any idea why this may happen?</p>
<p>UPDATE: it turned out that we run &quot;old&quot; pod on a system test cluster (unfortunately connection string was set incorrectly :( ). The misleading thing was that ReplicaSet have the same name... because</p>
<pre><code>Notice that the name of the ReplicaSet is always 
formatted as [DEPLOYMENT-NAME]-[RANDOM-STRING]. 
The random string is randomly generated and uses the 
pod-template-hash as a seed. 
</code></pre>

<kubernetes>
Why pods are started for old ReplicaSet
L. Sokolovsky
# Why pods are started for old ReplicaSet

(Asked by: username_0 on 2022-04-21)

A new deployment has been created and the release was successfully deployed on our AKS cluster.
We have noticed in logs that pods, for old ReplicaSet(which still exists on the cluster), are regularly executed. This is actually happening only for one specific ReplicaSet. The reason we have noticed it - it tries to perform a database update for an old db version.
Any idea why this may happen?
UPDATE: it turned out that we run "old" pod on a system test cluster (unfortunately connection string was set incorrectly :( ). The misleading thing was that ReplicaSet have the same name... because
Notice that the name of the ReplicaSet is always 
formatted as [DEPLOYMENT-NAME]-[RANDOM-STRING]. 
The random string is randomly generated and uses the 
pod-template-hash as a seed.

**Tags:** kubernetes


---

## 1 answers

### Answer by username_1 on 2022-04-28. Score: 0

I need to clear some stuff please :
1- Do you create a totally new Deployment ?
Ex:
The old deployment has name Deployment_1
The new deployment has name Deployment_2
2- If yes. Do you created a totally new deployment just  because the old one is not updating the pods for the blocker that you mentioned above ?
3- If yes and you update the image name for that deployment. then you need set the replicas to zero using this command.
kubectl -n NAMESPACE scale deploy DEPLOYMENT_NAME --replicas=0

And make sure that the replicas is zero by this command.
kubectl -n NAMESPACE get deploy/DEPLOYMENT_NAME

Then scale it up again.
kubectl -n NAMESPACE scale deploy DEPLOYMENT_NAME --replicas=1

Note: You can set the count of replicas that you need I just write 1 for example.


---

