<p>I have a web app on Kubernetes that gets &quot;spun-up&quot; via user action. That user action triggers a python script that applies a deployment, service, and ingress. The frontend shows a spinner until the app is ready to make connections. I'm currently checking the status of the deployment and checking that the &quot;Available&quot; status is &quot;True&quot;, at which point I hide the spinner and load the app.</p>
<p>The problem is, every once in a while, users will experience a <code>503: Temporarily Unavailable</code> error. A quick browser refresh fixes the problem, so this appears to be some sort of race condition.</p>
<p>My question is, why am I getting a 503 error if the deployment is marked as &quot;Available&quot;? Does this mean that the ingress or the service is sometimes taking longer to initialize?</p>
<p>I currently have the following probes on my deployment's app container:</p>
<pre><code>      readinessProbe:
        httpGet:
          path: /
          port: 3000
          periodSeconds: 5
          initialDelaySeconds: 5
      livenessProbe:
        httpGet:
          path: /
          port: 3000
          periodSeconds: 5
          initialDelaySeconds: 5
</code></pre>
<p>I'm using Azure AKS and <code>ingress-nginx</code>.</p>

Ben Davis
<p><strong>For newly created deployments</strong> check these. Both should be true, order does not matter.</p>
<ul>
<li><code>kubectl get deployment &lt;name&gt; -ojson | jq &quot;.status.availableReplicas&quot;</code> equal to desired, or <code>&gt;= 1</code>, on your preference.</li>
<li><code>kubectl get ingress &lt;name&gt; -ojson | jq &quot;.status.loadBalancer&quot;</code> is not empty. It means that ingress controller initialized for your host.</li>
</ul>
<p><strong>For updated deployments</strong> (anything that required pods to be recreated). Both should be true, order does not matter.</p>
<ul>
<li><p><code>kubectl get deployment &lt;name&gt; -ojson | jq &quot;.status.availableReplicas&quot;</code> equal to desired.</p>
</li>
<li><p><code>kubectl get deployment &lt;name&gt; -ojson | jq &quot;.status.updatedReplicas&quot;</code> equal to desired.</p>
<p>Ingress will already be initialized here.</p>
</li>
</ul>
