kubernetes-skills/claude/k8s-cost/SKILL.md
Optimize Kubernetes costs through resource right-sizing, unused resource detection, and cluster efficiency analysis. Use for cost optimization, resource analysis, and capacity planning.
npx skillsauth add rohitg00/kubectl-mcp-server k8s-costInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cost analysis and optimization using kubectl-mcp-server's cost tools.
Use this skill when:
| Priority | Rule | Impact | Tools |
|----------|------|--------|-------|
| 1 | Find and delete unused PVCs | CRITICAL | find_orphaned_pvcs |
| 2 | Right-size overprovisioned pods | HIGH | get_resource_recommendations |
| 3 | Identify idle LoadBalancers | HIGH | get_services |
| 4 | Scale down non-prod off-hours | MEDIUM | scale_deployment |
| 5 | Consolidate small namespaces | LOW | Analysis |
| Task | Tool | Example |
|------|------|---------|
| Namespace cost | get_namespace_cost | get_namespace_cost(namespace) |
| Cluster cost | get_cluster_cost | get_cluster_cost() |
| Unused PVCs | find_orphaned_pvcs | find_orphaned_pvcs(namespace) |
| Right-sizing | get_resource_recommendations | get_resource_recommendations(namespace) |
get_namespace_cost(namespace)
get_cluster_cost()
find_unused_resources(namespace)
find_orphaned_pvcs(namespace)
get_resource_recommendations(namespace)
get_pod_metrics(name, namespace)
get_resource_recommendations(namespace="production")
get_pod_metrics(name, namespace)
get_resource_usage(namespace)
find_orphaned_pvcs(namespace)
find_unused_resources(namespace)
get_nodes()
get_node_metrics()
| Current State | Recommendation | |--------------|----------------| | CPU usage < 10% of request | Reduce request by 50% | | CPU usage > 80% of request | Increase request by 25% | | Memory < 50% of request | Reduce request | | Memory near limit | Increase limit, monitor OOM |
get_resource_usage(namespace)
get_pod_metrics(name, namespace)
get_pvc(namespace)
find_orphaned_pvcs(namespace)
get_services(namespace)
Compare costs across clusters:
get_cluster_cost(context="production")
get_cluster_cost(context="staging")
get_cluster_cost(context="development")
find_orphaned_pvcs() then deleteget_resource_recommendations()For comprehensive cost analysis, see scripts/find-overprovisioned.py.
Scale to zero with KEDA:
keda_scaledobjects_list_tool(namespace)
keda_scaledobject_get_tool(name, namespace)
KEDA reduces costs by:
development
Manage vCluster (virtual Kubernetes clusters) instances using vind. Use when creating, managing, or operating lightweight virtual clusters for development, testing, or multi-tenancy.
development
Debug Kubernetes pods, nodes, and workloads. Use when pods are failing, containers crash, nodes are unhealthy, or users mention debugging, troubleshooting, or diagnosing Kubernetes issues.
devops
Kubernetes storage management for PVCs, storage classes, and persistent volumes. Use when provisioning storage, managing volumes, or troubleshooting storage issues.
testing
Manage Istio service mesh for traffic management, security, and observability. Use for traffic shifting, canary releases, mTLS, and service mesh troubleshooting.