<p>I am building deploy pipeline. I Need a "kubectl" command that would tell me that rollout is completed to all the pods then I can deploy to next stage. </p>

Rohith
<p>The <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#deployment-status" rel="nofollow noreferrer">Deployment documentation</a> suggests <code>kubectl rollout status</code>, which among other things will return a non-zero exit code if the deployment isn't complete.  <code>kubectl get deployment</code> will print out similar information (how many replicas are expected, available, and up-to-date), and you can add a <code>-w</code> option to watch it.</p>

<p>For this purpose you can also consider using one of the <a href="https://kubernetes.io/docs/reference/#api-client-libraries" rel="nofollow noreferrer">Kubernetes APIs</a>.  You can "get" or "watch" the deployment object, and get back something matching the structure of a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#deployment-v1-apps" rel="nofollow noreferrer">Deployment object</a>.  Using that you can again monitor the replica count, or the embedded condition list, and decide if it's ready or not.  If you're using the "watch" API you'll continue to get updates as the object status changes.</p>

<p>The one trick here is detecting failed deployments.  Say you're deploying a pod that depends on a database; usual practice is to configure the pod with the hostname you expect the database to have, and just crash (and get restarted) if it's not there yet.  You can briefly wind up in CrashLoopBackOff state when this happens.  If your application or deployment is totally wrong, of course, you'll also wind up in CrashLoopBackOff state, and your deployment will stop progressing.  There's not an easy way to tell these two cases apart; consider an absolute timeout.</p>
