AWS / Kubernetes

Scaling EKS to zero starts with the cluster

Three EC2 workers can belong to one development cluster. A dashboard that gives each worker its own stop button makes the wrong operation look easy.

The three rows belong together

An EC2 inventory lists machines. Kubernetes runs applications across those machines, and a managed node group controls their capacity. Stopping a worker from an EC2 row ignores the pods running there, their disruption budgets and the group that owns the instance.

Auto Scaling can treat a stopped instance as unhealthy and replace it. The group's desired capacity still says it needs workers. AWS describes these health checks. A stop button can therefore cause disruption without keeping the cluster at zero.

SnoozeDB groups EKS workers under their cluster and node groups, and disables individual EC2 scheduling for them. That gives the person making the decision the right scope: the applications and worker capacity of one cluster.

Keep the cluster visible after the workers disappear

EC2 tags help identify which instances belong to a cluster. They cannot describe a cluster after its last worker has gone. Discovery needs to query EKS itself.

SnoozeDB reads the cluster and managed node groups through the AWS EKS API. A cluster with zero workers stays in the inventory, so there is still a cluster row to inspect and wake. This works for clusters provisioned directly in the customer's AWS account, without moving them to a BYOC platform.

The account's CloudFormation template grants AWS access to all clusters, including ones created later. A sync adds each new cluster to To triage. The user chooses Manage or Protect in SnoozeDB, just as for RDS and EC2. Further syncs keep that choice; AWS access does not automatically enable cluster operations.

A successful regional scan updates that inventory. A failed scan keeps the previous result. Zero matched EC2 instances and a completed sleep are different observations; the dashboard tracks the cluster operation separately.

A cluster with three workers becomes a cluster with zero workers while its EKS control plane keeps running. Hibernation runs through the customer's CloudFormation role.
Sleep removes worker capacity. The EKS control plane stays up, and the saved sizes are restored at wake.

Use the access the account already granted

Putting a cluster to sleep does not have to start with an agent in the customer's VPC. SnoozeDB already assumes the CloudFormation role the customer created. Hibernation works through that role and the AWS APIs for EKS and Auto Scaling, so there is no Kubernetes access, credential or process to maintain.

The role needs two extra Auto Scaling actions, SuspendProcesses and ResumeProcesses, limited to groups tagged with the cluster name. Existing customers update their stack from Cloud integrations. Until they do, a hibernation request fails with a message that points there.

SnoozeDB's existing scheduler advances each operation on every pass, so the sleep and the wake do not depend on a process that could disappear with the workers.

Save the running configuration before changing it

For a managed node group, AWS allows minimum and desired capacity to reach zero while maximum capacity stays positive. SnoozeDB first saves each group's minimum, desired and maximum size. It then suspends the Launch process of the underlying Auto Scaling group and sets minimum and desired to zero. It waits for the group to have no instances.

Suspending Launch matters. AWS warns against changing desired capacity while Cluster Autoscaler is controlling it, and an autoscaler that raises desired capacity would start nodes during the sleep. See the node group capacity reference.

Wake resumes Launch, restores the exact saved sizes and waits for in-service capacity. If someone changed a node group while the cluster slept, wake stops without restoring anything, so a person can look at it first. An operation that does not finish within 45 minutes fails.

SnoozeDB does not drain the nodes, scale Deployments down or suspend CronJobs, because it has no Kubernetes access. Pods stop abruptly and stay Pending until the nodes return. That is acceptable for many dev/test environments and wrong for others.

Start with a dedicated dev/test cluster

An owner or admin can hibernate and wake a cluster by hand, with MFA when the workspace requires it, or set a schedule that follows the organization's business hours or a custom window. A manual action that contradicts the schedule holds until the schedule's next transition, for at most 7 days.

EKS follows the product's exclusion rules. Production environment tags and custom tag exclusions from Settings block operations on the cluster or its node groups. An untagged cluster can be managed if it meets the technical requirements. No EKS opt-in tag is required.

Some clusters are not eligible: Fargate, EKS Auto Mode, clusters managed by a third-party platform, and clusters with Karpenter or other nodes outside managed node groups. Those nodes would keep running, so hibernation would not reach zero.

A failed operation leaves the cluster in an error state, and a schedule does not wake an errored cluster. An administrator chooses Wake up after fixing the cause.

Zero workers still leaves a bill

The EKS control plane keeps running during sleep, so its cluster charge remains. Load balancers, NAT gateways, volumes and public IPv4 addresses also continue to cost money. Use the EKS pricing details and your billing data to separate worker usage from the costs that remain.

Savings Plans commitments and Reserved Instance charges remain in force when workers disappear. Reducing worker usage does not cancel those purchases.

SnoozeDB does not yet attribute EKS savings in the dashboard. Measure a complete sleep and wake on your cluster before estimating the benefit, including the time the team needs to wait for applications to return.

The EKS hibernation and recovery guide covers discovery, requirements and the checks to run on a real cluster. Begin with an environment that can tolerate an interruption.