<p>My deployment's pods are doing work that should not be interrupted. Is it possible that K8s is polling an endpoint about update readiness, or inform my pod that it is about to go down so it can get its affairs in order and then declare itself ready for an update?</p>

<p>Ideal process:</p>

<ol>
<li>An updated pod is ready to replace an old one</li>
<li>A request is sent to the old pod by k8s, telling it that it is about to be updated</li>
<li>Old pod gets polled about update readiness</li>
<li>Old pod gets its affairs in order (e.g. stop receiving new tasks, finishes existing tasks)</li>
<li>Old pod says it is ready</li>
<li>Old pod gets replaced</li>
</ol>

<p>You could perhaps look into using <a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/" rel="noreferrer">container lifecycle hooks</a> - specifically prestop in this case. </p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: your-pod
spec:
  containers:
  - name: your-awesome-image
    image: image-name
    lifecycle:
      postStart:
        exec:
          command: ["/bin/sh", "my-app", "-start"]
      preStop:
        exec:
          # specifically by adding the cmd you want your image to run here
          command: ["/bin/sh","my-app","-stop"]
</code></pre>
