← blog · November 30, 2026

Actually Saving Money with Spot Instances: Interruption Notices, Instance Type Diversification and Kubernetes Node Pools

Spot capacity is not a pricing option, it is a resilience contract. Which workloads tolerate it, what the interruption notice is good for, how to diversify, and the Kubernetes pitfalls around PDBs, grace periods and fallback capacity.

Interruptible virtual machines (Spot on AWS and Google Cloud, Spot VMs on Azure) are a provider's idle capacity, sold far below on-demand prices. The discount is real; the price is that the provider can take the machine back with very little notice. The usual failure is treating spot as "cheap hardware": a team moves an existing workload onto it unchanged and has an outage during the first wave of reclaims. Spot is not a pricing option, it is a resilience contract. The savings only show up if the workload is written assuming any machine can disappear at any moment.

How much warning you get, and what it is good for

Providers warn before reclaiming, but the windows differ. AWS publishes an interruption notice in the instance metadata service two minutes ahead, plus an earlier, best-effort "rebalance recommendation" signal with no guarantee attached. Google Cloud gives spot VMs roughly thirty seconds. Azure announces a Preempt event through Scheduled Events with a minimum of thirty seconds.

Those numbers tell you what the warning is for: a clean exit, not a rescue. Thirty seconds is enough to leave the load balancer, finish in-flight requests and hand a dequeued job back. It is not enough to copy hundreds of gigabytes of local data elsewhere. Anything a spot-hosted component loses must either already exist somewhere else or be cheap to recompute.

Which workloads belong on spot

One question decides it: if one copy of this process dies without warning, what does a user see?

Good fits:

  • Stateless web and API replicas, as long as there are several of them spread across instance types.
  • Queue workers, provided jobs are idempotent and return to the queue when their visibility timeout expires.
  • CI build agents. An interrupted build reruns; you lose minutes.
  • Batch processing and model training that write regular checkpoints.

Keep these off spot:

  • Anything with a single replica. Putting it on spot hands your outage schedule to the provider.
  • Database primaries, consensus groups such as etcd, and the Kubernetes control plane. Losing two members at once costs you quorum, and once quorum is gone a recovery procedure is running the cluster, not you.
  • Long jobs without checkpoints. Losing a six-hour job in hour five costs more than the discount saves.
  • Components that keep the only copy of data on local disk.

Diversification is where resilience actually comes from

Reclaims are not randomly distributed. When capacity tightens for a specific instance type in a specific zone, the machines in that pool go together. Run your entire spot fleet on one type in one zone and a single capacity event takes all of it at once.

The right approach is to let the same workload run on many interchangeable instance types: different generations, different vendors, a similar CPU to memory ratio. More pools means less correlated loss. On AWS the standard way is to list multiple instance types in an Auto Scaling group or fleet and choose the price-capacity-optimized allocation strategy. It prefers pools that are both cheap and unlikely to be reclaimed, rather than simply the cheapest. A lowest-price-only strategy steers you into the most contended pools and raises your interruption rate.

One caveat: diversifying instance types requires the application to cope with it. If x86 and ARM will mix, images must be multi-arch. A JVM heap or worker pool sized for a specific memory amount will start with the wrong settings on a smaller machine.

Spot nodes in Kubernetes

In Kubernetes, spot is separated at the node pool level. The basic pattern: taint the spot nodes and let only interruption-tolerant workloads tolerate the taint, so a database or a single-replica component never lands there by accident.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
spec:
  replicas: 6
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
    spec:
      terminationGracePeriodSeconds: 25
      tolerations:
        - key: capacity-type
          operator: Equal
          value: spot
          effect: NoSchedule
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: ScheduleAnyway
          labelSelector:
            matchLabels:
              app: api
      containers:
        - name: api
          image: example/api:1.0

The taint key and value are placeholders; managed Kubernetes services and node provisioners put their own labels on spot nodes, so use whatever your environment provides.

Two details matter here. First, terminationGracePeriodSeconds. The default is thirty seconds, which equals or exceeds the warning on Google Cloud and Azure. Even if draining starts the moment the notice arrives, a grace period longer than the machine's remaining life means the process gets cut off mid-shutdown. Keep the grace period under the notice window and test that the application really finishes within it.

Second, spreading. Without spread constraints across zones and, ideally, node types, the scheduler may pack replicas onto a handful of nodes and one reclaim wave takes them all.

You also need a component that turns the warning into a node drain; Kubernetes does not do this on its own. On AWS that is aws-node-termination-handler, or Karpenter, which watches interruption events itself; managed services on other providers ship an equivalent mechanism. The kubelet's graceful node shutdown feature (shutdownGracePeriod) also gives pods time when the OS receives a shutdown signal. Treat it as a safety net, not the whole solution.

Pitfalls

A PodDisruptionBudget will not save you. PDBs govern voluntary disruptions. When the provider takes the machine, the budget is not consulted; the node is gone. If the drain component honours the PDB and waits, the clock runs out while it waits and pods die messily anyway. Base availability on replica count and spreading, not on PDBs.

No fallback capacity, no recovery. If the spot pool is exhausted and the workload sits as pending pods, the outage starts after the reclaim, not during it. Give every critical workload a path onto on-demand nodes: either a separate on-demand pool with a preferred (not required) spot node affinity, or a node provisioner that knows about both capacity types. Make the preference mandatory and pods have nowhere to go once spot capacity runs dry.

Putting the floor on spot. Every user-facing service has a minimum replica count it must keep even at the worst moment. That floor belongs on on-demand or reserved capacity; spot should only cover the peak. A split like "four of six replicas on demand, the rest on spot" costs a little more than an all-spot setup but survives a mass reclaim.

Local ephemeral disk. Local NVMe and ephemeral storage vanish with the instance. Fine for caches, not fine for queue persistence or build artifacts. Even with network volumes, detaching and reattaching a disk to another machine can take minutes, longer than the notice window.

Training without measuring checkpoint cost. Checkpoint too rarely and you lose more work; too often and writing to storage eats your compute. Measure the reclaim rate in your own environment for a few weeks and pick the interval from that. Test restoring from checkpoints regularly too; a checkpoint you have never restored is a checkpoint you do not have.

Measuring savings from the invoice alone. The real gain is the discount minus rerun work, minus time spent with pending pods, minus hours spent falling back to on-demand. Claiming "we saved seventy percent" without tracking those is reading half the spreadsheet.

When not to use spot

If the workload is small and steady, the operational cost of diversification, a drain component and a fallback pool can exceed the savings for a few machines; reserved capacity or a savings plan is the smarter choice there. If the application cannot shut down cleanly, takes minutes to start, or keeps session state in memory, fix that first, because spot will expose those weaknesses every day. And if the team lacks the observability to see and explain reclaim events, spot produces unexplained outages rather than savings.

The order is: make the workload stateless and interruption-tolerant first, then keep the floor on on-demand and give the peak to spot across a wide range of instance types, and only then measure savings together with the work you had to rerun.

[ ← Back to burak.sh ]