gke using spot instances
To ensure your workload can work and uses spot instances (instead of either one), you should use the following configuration. Notice here, we have both tolerations and nodeSelector.
If you're using autopilot, then a new node gets created which uses spot instances. You can check this using the following command
kubectl get node/your-node-name -o yaml | grep cloud.google.com/gke-spot=true
Example output are shown here:-
I wasn't able to get this to run under autopilot, as GKE warden complaint about "Error from server (GKE Warden constraints violations): error when creating "compute-class.yaml": admission webhook "warden-validating.common-webhooks.networking.gke.io" denied the request: GKE Warden rejected the request because it violates one or more constraints.
Violations details: {"[denied by custom-compute-class-limitation]":["compute-class \"prefer-l4-spot\" must have NodePoolAutoCreation enabled in Autopilot. ComputeClass 'prefer-l4-spot'."]}"
Comments