Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Kubernetes Blog 5 min read Release mediumAdept

Kubernetes v1.37: Scale Workloads to Zero with HorizontalPodAutoscaler

Kubernetes v1.37 promotes HPA scale-to-zero to Beta and enables it by default, so a HorizontalPodAutoscaler with minReplicas: 0 can scale workloads to zero and back based on object or external metrics such as queue length. Resource metrics like CPU and memory cannot do this, because they come from running Pods and disappear at zero. The controller records a ScaledToZero status condition to tell its own scale-downs apart from manual pauses, and it will not wake a workload an operator set to zero. A worked example uses Prometheus Adapter to expose a queue-lag metric, with caveats: cold-start latency, Services don't buffer HTTP requests while no Pods are ready, and both control-plane components need the feature gate during version-skewed upgrades. Before downgrading, set minReplicas back to at least one.

Related posts

  • Kubernetes v1.37: Garhwal

    Kubernetes Blog mediumAdept

    Kubernetes v1.37 ships 67 enhancements: 16 Stable, 23 Beta, 27 Alpha and 1 deprecation. Highlights include stable resilient watch cache initialization, where kube-apiserver now returns HTTP 429 instead of overloading etcd, so clients should honor Retry-After and back off. HPA scale-to-zero reaches Beta for object and external metrics, admission policies can be loaded from static manifests, and Pod-level checkpoint/restore arrives in Alpha via new CRI RPCs. Stable graduations include KYAML, metrics.k8s.io v1, SELinux mount-based labeling (which can break Pods with different labels sharing a volume), several DRA features, StorageVersionMigration, and Pod certificates with ClusterTrustBundles.

  • Kubernetes v1.37: Metrics API graduates to stable

    Kubernetes Blog mediumAdept

    Kubernetes v1.37 graduates the metrics.k8s.io resource Metrics API, which supplies node and Pod CPU and memory usage to kubectl top and the HorizontalPodAutoscaler, to stable v1. The v1 surface is identical to v1beta1, with the same NodeMetrics and PodMetrics types and no field or semantic changes. kubectl top prefers v1 and falls back to v1beta1, but the HPA controller still only supports v1beta1. Metrics implementations such as metrics-server must serve v1 and register a v1.metrics.k8s.io APIService, and should keep serving both versions during the transition.

  • Thundering herd of circuit breakers

    Zalando Engineering mediumAdept

    A client's circuit breaker stayed open for hours because its half-open probes hit a service that the HPA had scaled down to three pods. The sparse probes succeeded, the breaker closed, and the withheld traffic arrived at once, queued for over 100 ms per request, timed out and re-opened the breaker. Each cycle lasted only about three seconds, too short for CPU-averaged autoscaling to notice. Zalando found the cycle by exporting OpenTelemetry traces as CSV into a bespoke uPlot visualizer that plots hundreds of traces at once. Suggested fixes are autoscaling on queue depth or concurrency, longer or heavier half-open probes, pre-scaling before the breaker closes, load shedding, and propagating cancellations.

  • Building a Custom Metrics Exporter for Kubernetes

    Kubernetes Blog mediumAdept

    A Prometheus metrics exporter is a small HTTP server exposing application state on /metrics, letting Kubernetes workloads surface signals like queue depth or job latency beyond CPU and memory. A Go exporter built with client_golang registers a counter, gauge and histogram named <namespace>_<name>_<unit>, refreshes them in a polling loop shorter than the 15s scrape interval, and serves a separate /healthz probe. The setup ships as a multi-stage distroless image, runs as a Deployment plus a named-port Service, and is scraped via a ServiceMonitor whose release label must match the Prometheus selector, or via annotation-based discovery. Prometheus Adapter is the next step for feeding these metrics to the HorizontalPodAutoscaler.

  • Deploy autoscaling services, AI Workflow automation, and LLM APIs Without Kubernetes

    Railway mediumAdept

    Many teams adopting Kubernetes only need to build containers, expose endpoints, scale and observe services, and a managed container platform like Railway can cover those needs with far less operational overhead. Each Kubernetes building block is mapped to a platform feature: Ingress plus cert-manager becomes automatic TLS and private hostnames, Secrets become reference variables that propagate on rotation, CI/CD plus ArgoCD becomes git-push deploys with PR preview environments, and the HPA metrics stack becomes dashboard-set replicas. The tradeoff is lost control over scheduling, custom readiness probes and custom scaling metrics, which still justifies Kubernetes at larger scale.

The quest for software engineering knowledge.

Look:
Layout: