How to tell from within a pod that the container is running on a preemptible node?

12/16/2018

I using GKE to run a cluster with a mixture of preemptible nodes and non-preemptible nodes.

I am using requiredDuringSchedulingIgnoredDuringExecution to restrict target deployments to two node-pools: preemptible and non-preemptible, and I am using preferredDuringSchedulingIgnoredDuringExecution to prefer preemptible pools.

I want to encourage steady pod migration to preemptible nodes. I think I can do this by detecting this pods are running in non-preemptible node and regularly shutting them down. The preference setting will first attempt to schedule new pods in the preemptible node pool.

How to tell from within a pod that the container is running on a preemptible node?

-- Gajus
google-kubernetes-engine

0 Answers