k8s-node-termination-handler
k8s-node-termination-handler copied to clipboard
What is the API that it uses to know that the node will be down after 30 seconds?
What is the API that it uses to know that the node will be down after 30 seconds?
Can you please share the URL of the API so that we can also create a script own our own?
@ankit-arora-369 I think this provides what you're after (Official Docs). Note that I have found this to work both from within a GKE node as well as within pod on a node.
curl "http://metadata.google.internal/computeMetadata/v1/instance/preempted" -H "Metadata-Flavor: Google"
Or polling request that returns only when there's a change to the value:
curl "http://metadata.google.internal/computeMetadata/v1/instance/preempted?wait_for_change=true" -H "Metadata-Flavor: Google"
This doesn't work because it turns TRUE only when G3 signal is returned.