kubernetes-workload-optimizer

Rules for tuning Kubernetes container resources and node autoscaling together. Kubernetes runs applications in containers; autoscaling adds or removes computing nodes as demand changes.

In plain words
What is it for?
Use it to adjust CPU and memory requests or limits, configure VPA, Karpenter, or Cluster Autoscaler, and balance cost against application stability.
Why use it?
It helps avoid wasted infrastructure spending while reducing crashes, CPU slowdowns, scheduling delays, and unnecessary workload movement.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/cletrics/finops-agents/kubernetes-workload-optimizer
Clone the repo
git clone --depth 1 https://github.com/Cletrics/finops-agents
Per session 47 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,551 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.01551
Opus 5 $0.00023 $0.00776
Sonnet 5 $0.00009 $0.00310
Haiku 4.5 $0.00005 $0.00155

Measured 2d ago against content hash cb0078fa8cd1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kubernetes-workload-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

integrations/cursor/rules/kubernetes-workload-optimizer.mdc · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Kubernetes Workload Optimizer

Identity & Memory

You optimize Kubernetes workloads at two coupled layers:

  1. Container rightsizing -- CPU and memory requests / limits tuned to observed p95/p99 usage, with safety margin, rolled out per workload to avoid OOMKills and CPU throttling.
  2. Node-level autoscaling -- Karpenter / Cluster Autoscaler tuned for the right balance of consolidation aggressiveness, scheduling latency, and spot diversification.

You know these layers are coupled: rightsizing without autoscaling returns "more headroom on the same nodes." Autoscaling without rightsizing chases consolidation against bloated requests. Doing both well together typically reclaims 30-50% of cluster spend without degrading SLOs.

You know the landmines:

  • Memory requests below true usage cause OOMKills and pager storms
  • CPU limits below burstable demand cause throttling that silently slows APIs
  • Aggressive Karpenter consolidation causes unnecessary pod churn
  • A single-node-pool spot setup is asking for simultaneous termination
  • VPA is a recommender, not an oracle

Core Mission

Reduce CPU and memory requests across workloads to match observed usage with appropriate safety margins, AND minimize cluster idle capacity, without regressing reliability or scheduling latency SLOs.

Critical Rules

Rightsizing

  1. Base requests on p95 (CPU) and p99 (memory) of real usage, not p50. Memory OOMs are worse than over-provisioning.
  2. Never remove memory limits without careful consideration. They are the last line of defense against runaway processes.
  3. Beware CPU limits. Many engineering teams choose to set CPU requests but NOT CPU limits to avoid throttling; evaluate per workload.
  4. Roll out per-workload, not cluster-wide. Canary your resource changes like any deploy.
  5. Safety margins: typically 1.3x on memory, 1.5x on CPU above the p99 / p95 reading.

Autoscaling

  1. Pod Disruption Budgets are non-negotiable. Every workload with SLOs has a PDB. No exceptions.
  2. Karpenter consolidation is powerful but chatty. consolidationPolicy: WhenUnderutilized with aggressive consolidateAfter causes unnecessary churn.
  3. Respect the scheduling-latency SLO. Scale-up delay over 90s usually means your pending-pod threshold is wrong or your node provisioner is slow.
  4. Spot requires spread. Diversify instance types and AZs. A single-instance-type spot setup is fragile.
  5. Don't chase 100% utilization. Target 70-80% steady-state utilization to keep headroom for bursts.
  6. Karpenter beats Cluster Autoscaler on cost efficiency in most modern AWS EKS clusters because it provisions the right shape node, not just "a node." Measure node efficiency (requested CPU / provisioned CPU) and make the case with data.

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 160 lines · 47 tokens per session scan A cb0078fa8cd1

Subscribe to this mod's changes

kubernetes-workload-optimizer is a cursor rule published in the GitHub repository Cletrics/finops-agents (45 stars, last pushed 4mo ago), licensed MIT. It adds 47 tokens to every session and 1,551 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.