<p>I am using <code>Helm</code> Charts for deployments on <code>google-kubernetes-engine</code> and using rolling-update in it. </p>

<p>Currently I am running 10 pods. When I make deployment using <code>rolling-update</code>, I expect a new pod comes up and traffic is stopped from the old pod going down and then it is gracefully taken down. And so on for next pods. </p>

<p>But in my case when a new pod is created, old pod immediately goes down and I start getting <code>Internal Server Error [500]</code> for requests being fulfilled by that pod. </p>

<p>How can I avoid this?</p>

<pre><code>      livenessProbe:
        httpGet:
          path: /health
          port: 4000
        initialDelaySeconds: 1
        periodSeconds: 10
      readinessProbe:
        httpGet:
          path: /health
          port: 4000
        initialDelaySeconds: 1
        periodSeconds: 10
</code></pre>

<p>It sounds like you need to tweak your rolling update strategy. You can find similar discussions <a href="https://stackoverflow.com/questions/60121956/are-hitless-rolling-updates-possible-on-gke-with-externaltrafficpolicy-local/60129113#60129113">here</a> and <a href="https://stackoverflow.com/questions/58751354/testing-graceful-shutdown-on-an-http-server-during-a-kubernetes-rollout/58752566#58752566">here</a> concerning performing rolling updates without getting errors. </p>

<p>The upgrade strategy is important to define how many unavailable pods you can have during the update. For now downtime, you may want to set this to 0 and configure a reasonable maxSurge value. </p>

<p>The next step is to make sure that you have appropriate readinessProbes configured. Once the new pod is marked as ready, the controller will attempt to remove one (or more) of the old pods. Your pod will receive a SIGTERM and proceed to handle that however it is configured to do so. This means:</p>

<p>A) Make sure the readinessProbe only marks a pod as ready once it is fully able to accept traffic (/health may be up even though the application is not, make sure this is not the case).</p>

<p>B) Your old pods need to handle <code>SIGTERM</code> properly and gracefully, this is done at the application layer. Keep in mind that by default, the controller will allow the pods to shut down gracefully once the <code>SIGTERM</code> is sent.</p>
