Throwaway clusters
A throwaway cluster is a whole cluster you create for one purpose, a test run, a demo, a per-branch preview, and delete when you are done. Because Syself Autopilot provisions a cluster in minutes and it is one declarative object, a throwaway cluster is cheap to create and cheap to script, and on your own Hetzner bill you pay only for the hours it exists.
When an ephemeral cluster beats a namespace#
A namespace in a shared cluster is lighter, so reach for a throwaway cluster only when you need what a namespace cannot give:
- A different Kubernetes or Cluster Stack version than the shared cluster runs, for an upgrade test.
- Full isolation, so the test cannot affect anything real, including the control plane.
- A clean slate every time, with no leftover state from the last run.
- A per-branch or per-PR preview that comes and goes with the branch.
For a quick test that fits inside an existing cluster, a namespace is still the cheaper choice.
A minimal declaration#
Keep throwaway clusters small: a single control-plane node (no HA needed for something disposable) and one small worker pool.
apiVersion: cluster.x-k8s.io/v1beta2
kind: Cluster
metadata:
name: preview-pr-1234
spec:
clusterNetwork:
services:
cidrBlocks: ["10.128.0.0/12"]
pods:
cidrBlocks: ["192.168.0.0/16"]
serviceDomain: "cluster.local"
topology:
classRef:
name: hetzner-apalla-1-36-v1
version: v1.36.3
controlPlane:
class: hcloud
replicas: 1
workers:
machineDeployments:
- class: workeramd64hcloud
name: md-0
replicas: 2
failureDomain: nbg1
variables:
- name: region
value: nbg1
Create it from a template so every throwaway cluster is identical; a Kustomize overlay that stamps in the name and branch works well.
Wire a preview cluster into CI#
A common use is a preview environment per pull request: CI creates a cluster named for the PR, deploys the branch, runs tests or hands a reviewer a URL, and deletes the cluster when the PR closes. Drive it with a headless kubeconfig so the pipeline can apply the Cluster object without a browser login, and make the delete a required step on PR close so previews do not pile up.
Budget cost against lifetime#
The cost of a throwaway cluster is its machines multiplied by its lifetime, so the levers are size and duration. Keep them small, and make sure they are actually deleted: a preview cluster that outlives its PR is pure waste on your Hetzner bill. Pair short-lived clusters with a scheduled sweep that deletes any preview cluster older than a day or two, as a backstop for a delete step that failed.
Delete it cleanly#
Tearing a throwaway cluster down is the same safe order as any cluster, and it matters here because you do it often: remove DNS and LoadBalancer Services first, then delete the Cluster object. Follow Delete a cluster so nothing, a retained volume or an orphaned load balancer, keeps billing after the cluster is gone.
Related#
- Run dev, staging, and prod , longer-lived per-environment clusters
- Delete a cluster , the safe teardown order in full