<p>I have two kubernetes deployments say backend and frontend. frontend deployment depends on the backend deployments. Means after backend deployment pods are ready then the pods for frontend should be created. How can I specify this in the deployment yaml?</p>

<p>The solution you are looking for is <strong>Init container</strong>. Pod can have one or more Init containers and they run one after another before main Pod containers are started. Please be aware that each Init container runs until completion.</p>

<p>So you can use Init containers to check availability of your back-end applications. Here is an example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: front-end
  labels:
    app: front-end
spec:
  containers:
  - name: front-end
    image: node:boron
  initContainers:
  - name: init-backend
    image: busybox
    command: ['sh', '-c', 'until &lt;put check condition for your back-end&gt;; do echo waiting for back-end; sleep 2; done;']
</code></pre>

<p>For more information you can go through <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="noreferrer">documentation</a>.</p>
