<p>I'm currently running on AWS and use <a href="https://github.com/kube-aws/kube-spot-termination-notice-handler" rel="noreferrer">kube-aws/kube-spot-termination-notice-handler</a> to intercept an AWS spot termination notice and gracefully evict the pods.</p>

<p>I'm reading <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/preemptible-vm" rel="noreferrer">this GKE documentation page</a> and I see:</p>

<blockquote>
  <p>Preemptible instances terminate after 30 seconds upon receiving a preemption notice.</p>
</blockquote>

<p>Going into the Compute Engine documentation, I see that a ACPI G2 Soft Off is sent 30 seconds before the termination happens but <a href="https://github.com/kubernetes/kubernetes/issues/22494" rel="noreferrer">this issue</a> suggests that the kubelet itself doesn't handle it.</p>

<p><strong>So, how does GKE handle preemption?</strong> Will the node do a drain/cordon operation or does it just do a hard shutdown?</p>

<p>Yes you are right, so far there is no built in way to handle <code>ACPI G2 Soft Off</code>.</p>

<p>Notice that if <a href="https://cloud.google.com/compute/docs/instances/preemptible" rel="nofollow noreferrer">normal preemptible</a> instance supports shutdown scripts (where you could introduce some kind of logic to perform drain/cordon), this is not the case if they are Kubernetes nodes: </p>

<blockquote>
  <p>Currently, preemptible VMs do not support shutdown scripts.  </p>
</blockquote>

<p>You can perform some test but quoting again from documentation:</p>

<blockquote>
  <p>You can simulate an instance preemption by stopping the instance.</p>
</blockquote>

<p>And so far if you stop the instance, even if it is a Kubernetes node no action is taken to cordon/drain and gratefully remove the node from the cluster.</p>

<p>However this feature is still in beta therefore it is at its early stage of life and in this moment it is a matter of discussion if and how introduce this feature.</p>

<p><strong>Disclaimer: I work For Google Cloud Platform Support</strong></p>
