<p>I am having a small shell script .  it has the following snippet of code</p>
<pre><code>kubectl scale deployment sample1 --replicas=0 -n sb1

kubectl scale deployment sample1 --replicas-3 -n sb1
</code></pre>
<p>The first command is scale down my deployment and the second command is to scale up .
is there any flags /conditions (wait --for=condition=complete)  that I can use to ensure the deployment is scaled down and scaled up ?</p>

prasanth
<p>There is no wait for completion flag in <code>kubectl scale --help.</code> You
may run the following to check if the replica rollout is completed:</p>
<pre><code>kubectl scale deployment sample1 --replicas 5 &amp;&amp; kubectl rollout status deployment/sample1
</code></pre>
<p>Example:</p>
<pre><code>kubectl scale deployment sample1 --replicas 5
deployment.apps/sample1 scaled
</code></pre>
<p>After scaling check the rollout status, the rollout status will block until the rollout to desired replica count is available:</p>
<pre><code>kubectl rollout status deployment/sample1
Waiting for deployment &quot;sample1&quot; rollout to finish: 0 of 5 updated replicas are available...
Waiting for deployment &quot;sample1&quot; rollout to finish: 1 of 5 updated replicas are available...
Waiting for deployment &quot;sample1&quot; rollout to finish: 3 of 5 updated replicas are available...
Waiting for deployment &quot;sample1&quot; rollout to finish: 4 of 5 updated replicas are available...
deployment &quot;sample1&quot; successfully rolled out

kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
sample1   5/5     5            5           2m40s
</code></pre>
