<p>I have several deployments that consist on my application. I would like to perform an custom action on the end of successful deployment of my app, this equal all deployments went well. How can I determine all my kubernetes deployments finished successfully?</p>

sobi3ch
<p>It's not exactly clear what do You mean.</p>

<p>As pointed by <a href="https://stackoverflow.com/users/11506391/marc-abouchacra">@Marc ABOUCHACRA</a>, you can use <code>watch</code>. This can be done in more k8s way by using <code>-w</code> flag like so <code>kubectl get deployments -w</code>.</p>

<p>But this only provides the information about the state Desired/Current/Up-to-date/Available.</p>

<pre><code>$ kubectl get deployments
NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
nginx-1   1         1         1            1           27h
</code></pre>

<p>You might <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes" rel="nofollow noreferrer">Define Readiness probe</a>.</p>

<blockquote>
  <p>Sometimes, applications are temporarily unable to serve traffic. For example, an application might need to load large data or configuration files during startup, or depend on external services after startup. In such cases, you don’t want to kill the application, but you don’t want to send it requests either. Kubernetes provides readiness probes to detect and mitigate these situations. A pod with containers reporting that they are not ready does not receive traffic through Kubernetes Services.</p>
  
  <p><strong>Note:</strong>  Readiness probes runs on the container during its whole lifecycle.</p>
</blockquote>

<pre><code>readinessProbe:
  exec:
    command:
    - cat
    - /tmp/healthy
  initialDelaySeconds: 5
  periodSeconds: 5
</code></pre>

<p>Or just use <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#deployment-status" rel="nofollow noreferrer">Deployment status</a>,</p>

<blockquote>
  <p>A Deployment enters various states during its lifecycle. It can be  <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progressing-deployment" rel="nofollow noreferrer">progressing</a>  while rolling out a new ReplicaSet, it can be  <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#complete-deployment" rel="nofollow noreferrer">complete</a>, or it can  <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#failed-deployment" rel="nofollow noreferrer">fail to progress</a>.</p>
</blockquote>

<pre><code>$ kubectl rollout status deployment nginx-1
deployment "nginx-1" successfully rolled out
</code></pre>
