Analyze and reduce Kubernetes infrastructure costs through resource right-sizing and idle resource cleanup.

Install

mkdir -p .claude/skills/k8s-cost && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7299" && unzip -o skill.zip -d .claude/skills/k8s-cost && rm skill.zip

Installs to .claude/skills/k8s-cost

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Optimize Kubernetes costs through resource right-sizing, unused resource detection, and cluster efficiency analysis. Use for cost optimization, resource analysis, and capacity planning.
185 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Analyze namespace and cluster costs
  • Identify orphaned persistent volume claims
  • Provide resource right-sizing recommendations
  • Identify idle load balancers
  • Scale down non-production environments

How it works

It utilizes cost analysis tools to inspect resource usage, identify waste like orphaned PVCs or overprovisioned pods, and suggest scaling actions.

Inputs & outputs

You give it
Kubernetes namespace or cluster context
You get back
Cost optimization recommendations

When to use k8s-cost

  • Cleaning up orphaned persistent volume claims
  • Right-sizing overprovisioned pod resources
  • Analyzing namespace cost allocation
  • Scaling down development environments during off-hours

About this skill

Kubernetes Cost Optimization

Cost analysis and optimization using kubectl-mcp-server's cost tools.

When to Apply

Use this skill when:

  • User mentions: "cost", "savings", "optimize", "expensive", "budget"
  • Operations: cost analysis, right-sizing, cleanup unused resources
  • Keywords: "how much", "reduce", "efficiency", "waste", "overprovisioned"

Priority Rules

PriorityRuleImpactTools
1Find and delete unused PVCsCRITICALfind_orphaned_pvcs
2Right-size overprovisioned podsHIGHget_resource_recommendations
3Identify idle LoadBalancersHIGHget_services
4Scale down non-prod off-hoursMEDIUMscale_deployment
5Consolidate small namespacesLOWAnalysis

Quick Reference

TaskToolExample
Namespace costget_namespace_costget_namespace_cost(namespace)
Cluster costget_cluster_costget_cluster_cost()
Unused PVCsfind_orphaned_pvcsfind_orphaned_pvcs(namespace)
Right-sizingget_resource_recommendationsget_resource_recommendations(namespace)

Quick Cost Analysis

Get Cost Summary

get_namespace_cost(namespace)
get_cluster_cost()

Find Unused Resources

find_unused_resources(namespace)
find_orphaned_pvcs(namespace)

Resource Right-Sizing

get_resource_recommendations(namespace)
get_pod_metrics(name, namespace)

Cost Optimization Workflow

1. Identify Overprovisioned Resources

get_resource_recommendations(namespace="production")

get_pod_metrics(name, namespace)
get_resource_usage(namespace)

2. Find Idle Resources

find_orphaned_pvcs(namespace)

find_unused_resources(namespace)

3. Analyze Node Utilization

get_nodes()
get_node_metrics()

Right-Sizing Guidelines

Current StateRecommendation
CPU usage < 10% of requestReduce request by 50%
CPU usage > 80% of requestIncrease request by 25%
Memory < 50% of requestReduce request
Memory near limitIncrease limit, monitor OOM

Cost by Resource Type

Compute (Pods/Deployments)

get_resource_usage(namespace)
get_pod_metrics(name, namespace)

Storage (PVCs)

get_pvc(namespace)
find_orphaned_pvcs(namespace)

Network (LoadBalancers)

get_services(namespace)

Multi-Cluster Cost Analysis

Compare costs across clusters:

get_cluster_cost(context="production")
get_cluster_cost(context="staging")
get_cluster_cost(context="development")

Cost Reduction Actions

Immediate Wins

  1. Delete unused PVCs: find_orphaned_pvcs() then delete
  2. Right-size pods: Apply get_resource_recommendations()
  3. Scale down dev/staging: Off-hours scaling

Medium-term Optimizations

  1. Use Spot/Preemptible nodes: For fault-tolerant workloads
  2. Implement HPA: Auto-scale based on demand
  3. Use KEDA: Scale to zero for event-driven workloads

Long-term Strategy

  1. Reserved instances: For stable production workloads
  2. Multi-tenant clusters: Consolidate small clusters
  3. Right-size node pools: Match workload requirements

Automated Analysis Script

For comprehensive cost analysis, see scripts/find-overprovisioned.py.

KEDA for Cost Savings

Scale to zero with KEDA:

keda_scaledobjects_list_tool(namespace)
keda_scaledobject_get_tool(name, namespace)

KEDA reduces costs by:

  • Scaling pods to 0 when idle
  • Event-driven scaling (queue depth, etc.)
  • Cron-based scaling for predictable patterns

Related Skills

When not to use it

  • When the cluster lacks the necessary monitoring metrics
  • When the user does not have permission to modify cluster resources

Limitations

  • Requires access to cluster metrics
  • Recommendations require manual review before application

How it compares

This skill provides specific, actionable cost-saving recommendations based on cluster metrics rather than general resource monitoring.

Compared to similar skills

k8s-cost side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
k8s-cost (this skill)36moReviewIntermediate
k8s-cilium16moReviewAdvanced
linkerd-patterns65moReviewAdvanced
storage-networking67moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

k8s-cilium

rohitg00

Cilium and Hubble network observability for Kubernetes. Use when managing network policies, observing traffic flows, or troubleshooting connectivity with eBPF-based networking.

16

linkerd-patterns

wshobson

Implement Linkerd service mesh patterns for lightweight, security-focused service mesh deployments. Use when setting up Linkerd, configuring traffic policies, or implementing zero-trust networking with minimal overhead.

672

storage-networking

pluginagentmarketplace

Master Kubernetes storage management and networking architecture. Learn persistent storage, network policies, service discovery, and ingress routing.

663

k8s-helm

rohitg00

Manage Helm charts, releases, and repositories. Use for Helm installations, upgrades, rollbacks, chart development, and release management.

857

observability-engineer

sickn33

Build production-ready monitoring, logging, and tracing systems. Implements comprehensive observability strategies, SLI/SLO management, and incident response workflows. Use PROACTIVELY for monitoring infrastructure, performance optimization, or production reliability.

1242

kubernetes-architect

sickn33

Expert Kubernetes architect specializing in cloud-native infrastructure, advanced GitOps workflows (ArgoCD/Flux), and enterprise container orchestration. Masters EKS/AKS/GKE, service mesh (Istio/Linkerd), progressive delivery, multi-tenancy, and platform engineering. Handles security, observability, cost optimization, and developer experience. Use PROACTIVELY for K8s architecture, GitOps implementation, or cloud-native platform design.

636

Search skills

Search the agent skills registry