Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
ballast

ballast

> 云原生
Free

Automated Kubernetes workload resource tracking and adjustment

159 stars0 likes5 views
GitHub

About

Automated Kubernetes workload resource tracking and adjustment

Ballast

Ballast is a Kubernetes operator that automatically right-sizes workload resource requests and limits based on real operational history. It is a more active alternative to Fairwinds Goldilocks: rather than suggesting changes, it applies them — at admission time and on running pods via in-place resize (Kubernetes 1.35+).

What it does

This is one cluster's CPU over three days. The purple line is allocatable capacity; the blue line is the sum of pod requests — what the scheduler believes is claimed; the red line is what those pods actually burn.

For the first two days requests ride right up against the ceiling. On paper the cluster is full and can't schedule another pod, yet real usage runs at less than half the reservation. That gap is pure waste: capacity paid for, reserved, and never used.

Partway through 7/3 the workloads are enrolled in Ballast. Requests drop to track observed usage, freeing roughly half the cluster's schedulable CPU without touching a single running workload. That reclaimed headroom is the point: the same nodes now fit far more work, or you run the same work on fewer nodes.

Why not just use VPA?

The Vertical Pod Autoscaler is the obvious tool for this job, and for a single stable, long-lived workload it works well. Ballast exists because VPA ties a workload's usage history to that one workload's identity in one namespace, and three everyday situations throw that history away and drop you back to guessing:

  • Cold start. VPA learns from nothing. Its recommender aggregates usage into decaying histograms (memory in 24-hour peak windows over an 8-day default history), so a freshly deployed workload has no samples and gets a low-confidence, deliberately padded recommendation until days of real traffic accrue.
  • No cross-namespace memory. VPA keys its history on the tuple (namespace, container name, pod labels), and that key is not adjustable — it is derived automatically, and a VPA object is itself namespaced, so it physically cannot aggregate pods from another namespace. Deploy the same app (service: billing, component: backend-api, profile: dev) into a second namespace, say a different developer's own test namespace, and the namespace in that key changes, so VPA sees a brand-new workload and starts from zero. Every namespace relearns the same app independently. Cold start, again.
  • Redeploy gap. A workload's history lives in its VPA object's checkpoints (VerticalPodAutoscalerCheckpoint resources owned by the VPA object). Delete the workload and its VPA object, as any GitOps teardown or helm uninstall does, and Kubernetes garbage-collects the checkpoints along with it. Redeploy a minute later and there is no history left to recover. Cold start, a third time.

Ballast fixes all three by decoupling history from the workload object. It keys usage on a workload identity tuple you choose (a set of pod labels; see WorkloadProfile Identity) and stores it cluster-wide in Redis/Valkey, independent of namespace and independent of any single workload's lifecycle. Forty dev namespaces running the same app all feed one well-sampled profile, so a brand-new deployment — in a fresh namespace, or right after a teardown — inherits the fleet's accumulated history and is sized correctly from its very first admission instead of relearning from scratch.

How it works

Workloads opt in with a single label on their pod templates. Ballast observes real CPU, memory, and ephemeral-storage utilization, accumulates a rolling history keyed to a workload identity tuple (a set of pod labels you configure), and uses that history to right-size all three resources across an escalating ladder of behaviors:

  1. measure — collect per-container usage samples into a time-series store (Redis/Valkey).
  2. apply — also patch resource requests and limits at admission time when a pod is created (implies measure).
  3. resize — also adjust resources on running pods via the Kubernetes in-place resize API (1.35+) (implies apply).

You choose a rung with the ballast.tightlinesoftware.com/mode label; each rung includes everything below it. Nothing is applied or resized until the WorkloadProfile meets its readiness threshold — that is normal behavior for any resize-enabled workload.

Pod eviction for cluster rebalancing is handled by Kubernetes Descheduler — see the Enrollment section for details.

Prerequisites

  • Kubernetes 1.35+ (required for in-place pod resize; earlier versions support measure and apply but not resize)
  • metrics-server installed in the cluster (source for CPU and memory; ephemeral-storage usage comes from the kubelet Summary API and needs no extra component)
  • TLS certificate for the admission webhook (see Webhook TLS below)
  • A Redis-compatible store (Ballast ships with a bundled Valkey via Helm; an existing Redis or Valkey instance works too). The bundled Valkey persists to a PersistentVolumeClaim on the cluster's default StorageClass by default, so accrued history survives pod reschedules; its memory and storage defaults are small and linked, so scale them together (see the annotated valkey: block in values.yaml).

Installation

cert-manager must already be installed in the cluster (Ballast does not install it):

bash
helm install ballast oci://ghcr.io/tight-line/charts/ballast \
  --namespace ballast-system \
  --create-namespace

This pulls the latest signed chart from the GitHub Container Registry. To pin a version, add --version (the Releases page lists every version). For supply-chain-sensitive clusters, verify the chart's signature before installing, and consider enforcing that verification at admission time (examples/admission).

The chart ships with a sensible default for ballastConfig.identityLabels (app.kubernetes.io/name + app.kubernetes.io/component). Read the section below before overriding it — the choice has cluster-wide consequences.

Upgrades are helm upgrade --install ballast oci://ghcr.io/tight-line/charts/ballast with no extra steps. CRDs are kept in sync automatically: Helm itself never upgrades the crds/ directory, so the chart runs a pre-install/pre-upgrade hook Job (ballastd apply-crds) that server-side-applies the CRD manifests baked into the operator image. Set crds.upgradeHook.enabled: false to opt out if external tooling manages CRDs; you are then responsible for applying config/crd/bases/ on every upgrade.

Verifying the release

Both the container image (ghcr.io/tight-line/ballast) and the Helm chart (ghcr.io/tight-line/charts/ballast) are keyless-signed with cosign via GitHub OIDC and the public sigstore infrastructure. There is no public key to manage; verification checks that the artifact was signed by Ballast's release workflow.

bash
IDENTITY='^https://github\.com/Tight-Line/ballast/\.github/workflows/release\.yml@refs/tags/v'
ISSUER=https://token.actions.githubusercontent.com

# container image
cosign verify ghcr.io/tight-line/ballast: \
  --certificate-identity-regexp "$IDENTITY" \
  --certificate-oidc-issuer "$ISSUER"

# Helm chart
cosign verify ghcr.io/tight-line/charts/ballast: \
  --certificate-identity-regexp "$IDENTITY" \
  --certificate-oidc-issuer "$ISSUER"

The image also carries a SLSA build-provenance attestation and an SBOM; SECURITY.md has the full set of verification commands. To make the cluster admit only images that pass this check, see examples/admission.

Older releases

Ballast is distributed as signed OCI artifacts from the GitHub Container Registry: the operator image at ghcr.io/tight-line/ballast and the Helm chart at ghcr.io/tight-line/charts/ballast. Releases through v0.4.x were also published to a GitHub Pages Helm repo at https://tight-line.github.io/ballast. That repo is now frozen: existing helm repo add users and already-published versions keep resolving, but new versions ship only via the OCI chart above, so migrate to the helm install oci://… flow when you upgrade.

Every release, with its notes and the packaged chart attached, is on the Releases page.

WorkloadProfile Identity

Ballast groups pods into WorkloadProfile objects by matching a configurable set of pod label keys called the identity tuple. The tuple is defined once in BallastConfig.spec.identityLabels and applies to every namespace in the cluster.

WorkloadProfiles are cluster-scoped. Every pod in every namespace that shares the same label values for the identity keys feeds measurements into the same profile. This is intentional: forty dev namespaces all running the same billing app produce one well-sampled WorkloadProfile, not forty thin ones.

The one thing that splits an identity tuple is the policy governing it. A profile holds a single set of recommendations, and the policy is what decides how they are measured and sized, so pods that resolve to different policies get different profiles (see policy precedence). With only the default cluster-wide policy in place, nothing splits and the tuple is the whole story.

Default: name + component

yaml
ballastConfig:
  identityLabels:
    - app.kubernetes.io/name
    - app.kubernetes.io/component

This works well for clusters that run a single environment class. The frontend and backend of the same app get separate profiles; forty developers' copies of billing all contribute to the same (billing, api) profile.

Mixed environments in the same cluster

If your cluster runs dev, staging, and production side-by-side and you want separate profiles per environment, add ballast.tightlinesoftware.com/resource-profile to the identity tuple and apply it to your pods:

yaml
# BallastConfig / Helm values
ballastConfig:
  identityLabels:
    - app.kubernetes.io/name
    - app.kubernetes.io/component
    - ballast.tightlinesoftware.com/resource-profile
yaml
# Pod template labels
labels:
  app.kubernetes.io/name: billing
  app.kubernetes.io/component: api
  ballast.tightlinesoftware.com/resource-profile: prod

Now (billing, api, prod) and (billing, api, dev) are measured independently. Pods without the ballast.tightlinesoftware.com/resource-profile label get a placeholder value in the profile name (noresourceprofile) rather than being skipped, so opted-in pods always produce a profile.

Changing identityLabels wipes your operational history. It redefines what constitutes a workload identity, so all existing WorkloadProfile objects are renamed and their accumulated Redis history is orphaned. Ballast starts fresh from zero samples. Plan your tuple before enrolling workloads.

Enrollment

Enroll a workload by setting the ballast.tightlinesoftware.com/mode label on its pod template. Ballast never acts on a workload without explicit opt-in. The value is a single rung on an escalating ladder; each rung includes everything below it.

ballast.tightlinesoftware.com/mode Behavior
measure Collect metrics only
apply measure, plus patch requests/limits at admission time
resize apply, plus adjust resources on running pods via in-place resize

Enrollment is a label, not an annotation, so the API server can filter on it server-side. Ballast's controllers watch and its admission webhook fires only for pods that carry the label, which keeps the operator's footprint proportional to the number of enroll

Issues· 9 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

开发者工具

No comments yet. Be the first to share.

> Details

PublishedSep 9, 2026
UpdatedSep 18, 2026
Category云原生
PricingFree

> Related tools

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,