This article explores the concept of "scale-from-zero" in Kubernetes environments, a strategy to combat the high costs of idle, over-provisioned infrastructure in hybrid and multi-cloud setups. It details how this approach provisions resources only when actual demand requires them, moving away from traditional "always-on" models, particularly for intermittent workloads like batch jobs, AI/ML pipelines, and CI/CD runners. The article highlights the architectural components and operational workflow involved in implementing scale-from-zero with tools like Cluster API and capacity annotations.
Read original on DZone MicroservicesThe persistent challenge in infrastructure management is the cost associated with over-provisioning. Many organizations provision for peak load or worst-case scenarios, leading to significant idle capacity and wasted budget. This is particularly pronounced with expensive resources like GPUs and in complex hybrid/multi-cloud Kubernetes deployments where the "always-on" default compounds costs across numerous clusters and teams. The article introduces "scale-from-zero" as a paradigm shift to align infrastructure capacity directly with actual demand, rather than maintaining expensive hot standbys or permanently provisioned node pools.
Traditional infrastructure provisioning often results in substantial idle resources. Examples include GPU node pools for monthly batch jobs, standby data centers for disaster recovery, and CI/CD runners waiting for pipeline triggers. While seemingly reasonable decisions at a micro-level, these add up to a major structural cost at enterprise scale. The "hot standby" model, in particular, is an expensive insurance policy that often sits idle, waiting for an event that may never occur.
Scaling Challenge
The fundamental problem is provisioning for peak demand but paying for average (or below average) usage. This is exacerbated in large-scale Kubernetes deployments where similar patterns are replicated across teams and environments, making cost attribution and resolution difficult.
Scale-from-zero aims to make node pools with zero running nodes visible and schedulable to the Kubernetes scheduler. This is achieved through capacity annotation, where metadata is attached to node pool definitions, informing the scheduler about the potential CPU, memory, and GPU resources that would exist if a node were running. This allows the scheduler to make placement decisions and queue pods against an empty pool, triggering an autoscaler to provision resources only when needed.
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: gpu-node-pool
annotations:
capacity.annotations.kubernetes.io/gpu: "1"
capacity.annotations.kubernetes.io/cpu: "8"
capacity.annotations.kubernetes.io/memory: "64Gi"
spec:
replicas: 0 # Starts at zero
selector:
matchLabels:
node-pool: gpu
template:
spec:
metadata:
labels:
node-pool: gpu
spec:
taints:
- key: "nvidia.com/gpu"
effect: "NoSchedule"
...