Analyzes Kubernetes cluster resource allocation versus actual usage to find waste and generate right-sizing recommendations. Use when someone asks about Kubernetes costs, overprovisioned pods, resource requests/limits tuning, cluster efficiency, or cloud bill reduction for K8s workloads. Trigger words: k8s costs, pod resources, right-size, overprovisioned, resource waste, cluster optimization, CPU/memory requests.
This skill audits Kubernetes clusters for resource inefficiency by comparing requested CPU/memory against actual usage from metrics-server. It identifies zombie deployments, overprovisioned workloads, and generates kustomize-compatible patches for right-sizing with safety buffers.
Run kubectl cluster-info and kubectl top nodes to confirm connectivity and that metrics-server is running. If metrics-server is unavailable, inform the user and suggest installing it first.
For each namespace (or user-specified namespaces):
# Get resource requests/limits for all pods
kubectl get pods --all-namespaces -o json | jq '[.items[] | {
namespace: .metadata.namespace,
pod: .metadata.name,
containers: [.spec.containers[] | {
name: .name,
cpu_request: .resources.requests.cpu,
cpu_limit: .resources.limits.cpu,
mem_request: .resources.requests.memory,
mem_limit: .resources.limits.memory
}]
}]'
# Get actual usage
kubectl top pods --all-namespaces --no-headers
For each deployment, compute:
Use these reference prices if the user doesn't specify:
Flag deployments where:
For each overprovisioned workload:
Format a table showing:
User prompt:
Audit the api-services namespace for resource waste
Agent output:
Resource Audit: api-services namespace
───────────────────────────────────────
Deployment Replicas CPU Req→Used Mem Req→Used Efficiency Est. Waste
user-auth 3 500m→120m 1Gi→340Mi 26% $85/mo
order-processor 2 1000m→650m 2Gi→1.4Gi 68% $31/mo
email-worker 2 250m→15m 512Mi→80Mi 8% $42/mo
Recommendations:
1. email-worker: Reduce to 1 replica, set requests to cpu:50m/mem:150Mi → saves $42/mo
2. user-auth: Set requests to cpu:180m/mem:500Mi → saves $68/mo
3. order-processor: Requests are reasonable, minor trim to cpu:850m → saves $12/mo
Total potential savings: $122/month ($1,464/year)
User prompt:
Find unused deployments across all namespaces
Agent output:
Zombie Workloads Detected
─────────────────────────
Namespace: staging
✗ feature-auth-v2 2 replicas CPU: 0m Last deploy: 2025-09-14 → $28/mo wasted
✗ hotfix-payment-flow 1 replica CPU: 0m Last deploy: 2025-10-02 → $14/mo wasted
✗ demo-dashboard 3 replicas CPU: 0m Last deploy: 2025-07-28 → $42/mo wasted
Namespace: dev
✗ test-migration 1 replica CPU: 0m Last deploy: 2025-11-18 → $14/mo wasted
Suggested cleanup:
kubectl delete deployment feature-auth-v2 hotfix-payment-flow demo-dashboard -n staging
kubectl delete deployment test-migration -n dev
Total zombie cost: $98/month
npx skills add TerminalSkills/k8s-cost-optimizer下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer