Generated banner for Aks Cost Optimization
Generated logo for Aks Cost Optimization

Aks Cost Optimization

MicrosoftOfficialCreated by Microsoft

  • Skill
  • Research and analysis
  • Cloud and DevOps
  • MIT
  • No issues found

From the author

Analyze advanced AKS cost efficiency. WHEN: "AKS NAP readiness", "AKS bin packing", "AKS node scaling bottleneck", "AKS blocked scale-down", "AKS storage cost". DO NOT USE AS DIRECT ENTRY FOR: overall AKS cost assessments or rightsizing/VPA/CAS/Spot (azure-kubernetes); spend/anomalies/commitments (cost-analysis/cost-optimization); incidents (aks-troubleshooting).
— the description by Microsoft

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for analyzing advanced cost efficiency in Azure Kubernetes Service (AKS) clusters. It focuses on technical placement and scheduling factors rather than high-level financial reporting. The skill guides users through evaluating Node Auto-Provisioning (NAP) readiness, bin-packing efficiency, node scaling bottlenecks, and storage costs. It is designed to be used for specific technical investigations, requiring the user to route broader cost or incident-related queries to their respective specialized skills.

What it does

  • Evaluates cluster bin-packing efficiency and identifies consolidation candidates.
  • Assesses readiness for adopting Node Auto-Provisioning (NAP).
  • Identifies root causes for node scaling bottlenecks and blocked scale-down events.
  • Analyzes storage cost and mapping configurations.
  • Provides evidence-based recommendations for pool adjustments or placement changes.
  • Requires explicit user approval before any cluster configuration changes.

When to use it

  • When investigating inefficient resource utilization or poor bin-packing in an AKS cluster.
  • When evaluating whether to migrate from fixed node pools or Cluster Autoscaler to NAP.
  • When troubleshooting persistent node scaling bottlenecks or blocked scale-down operations.
  • When analyzing storage-related costs within an AKS environment.

Advantages

  • Provides deep technical insights into scheduling and placement constraints.
  • Prevents conflicting recommendations by routing to specialized skills for financial or incident data.
  • Ensures safe operations by requiring manual approval for all proposed changes.
  • Uses standardized evidence collection for consistent analysis across clusters.

Usage examples

“Analyze why my AKS cluster is failing to scale down nodes.”
The agent will investigate blocked scale-down events, check for PDBs or disruption budgets, and identify if the nodes are managed by NAP or CAS to provide a resolution path.
“Is my cluster ready for Node Auto-Provisioning?”
The agent will perform an eligibility check, verify current networking and identity configurations, and report if NAP is a viable and cost-effective alternative for your workload.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoft/aks-cost-optimization/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip aks-cost-optimization.zip -d .agents/skills

Documentation by Microsoft

AKS Cost Optimization

When to Use This Skill

Use for advanced existing-cluster analysis requiring scheduling, placement, or verified storage mapping. Route overall AKS cost assessments to azure-kubernetes, spend/anomalies to cost-analysis, commitments to cost-optimization, and incidents to aks-troubleshooting when those skills are available. When called from an overall assessment, return findings for its ranked report.

MCP Tools

Prefer fitting Azure MCP reads. Never invent tools or use az/kubectl without approved shell access and a target-bound context.

Workflow/Steps

  1. Bind the subscription, cluster, resource group, and kube context.

  2. Route to NAP readiness, bin-packing, node-scaling bottlenecks, or storage optimization.

  3. When invoked for AKS commitment context, use the commitment-demand handoff and return demand evidence without benefit analysis or a transaction.

  4. Keep reads non-mutating; require approval for every change.

Error Handling

  • Missing capability: analyze supplied evidence or provide a collection plan; mark dependent cost or commitment results unavailable.

  • Evidence conflict: mark the conclusion unconfirmed.

Files

references/bin-packing-evidence.md

Bin-Packing Evidence

Collect bounded evidence for one candidate pool at a time. Include all nodes and scheduled pods across namespaces; add only pools losing nodes or receiving workloads.

Cluster and Workloads

Use Azure MCP AKS for cluster/pool, autoscaling/NAP, node resource group, CRG, and surge data; otherwise use an approved az aks show. With approved shell access and target-bound kubectl, run:

kubectl get nodes -l "kubernetes.azure.com/agentpool=<POOL>" \
  -o custom-columns="NAME:.metadata.name,NAP_POOL:.metadata.labels.karpenter\.sh/nodepool,SKU:.metadata.labels.node\.kubernetes\.io/instance-type,ZONE:.metadata.labels.topology\.kubernetes\.io/zone,CPU:.status.allocatable.cpu,MEM:.status.allocatable.memory,PODS:.status.allocatable.pods,TAINTS:.spec.taints"

kubectl get pods -A --field-selector "spec.nodeName=<NODE_NAME>" \
  -o custom-columns="NAMESPACE:.metadata.namespace,NAME:.metadata.name,NODE:.spec.nodeName,OWNER_KIND:.metadata.ownerReferences[0].kind,OWNER_NAME:.metadata.ownerReferences[0].name,REQUESTS:.spec.containers[*].resources.requests,INIT_REQUESTS:.spec.initContainers[*].resources.requests,OVERHEAD:.spec.overhead,SELECTOR:.spec.nodeSelector,AFFINITY:.spec.affinity,TOLERATIONS:.spec.tolerations,SPREAD:.spec.topologySpreadConstraints,PVCS:.spec.volumes[*].persistentVolumeClaim.claimName"

Aggregate all nodes before modeling. For discovered namespaces, project PDBs; collect FailedScheduling only for known pending pods eligible for affected pools. Resolve referenced owners, following ReplicaSets to Deployments. Retrieve other details only for identified constraints. Never retrieve full nodes; they include cached images. Report covered pools, nodes, namespaces, owners, and omissions.

Reuse rightsizing metrics or retrieve 7-14 days of CPU/memory history. Current usage alone cannot justify consolidation. If requests or history are missing, invoke azure-kubernetes for rightsizing if available; otherwise stop. Read PVC/PV topology or SKU/quota only when it constrains placement.

For unexplained scaling, evictions, or pending pods despite available compute, use node scaling bottlenecks before consolidation.

Signals

  • compatible small pools with sustained low requested and actual utilization;

  • nodes with stranded CPU but insufficient memory, or the reverse;

  • oversized pod requests that prevent otherwise available capacity from being used;

  • required node/pod affinity, anti-affinity, topology spread, selectors, taints, zones, host ports, PV node/zone affinity, maxPods, or extended resources that restrict placement;

  • PDBs, unmanaged pods, node-local storage, or do-not-disrupt settings that block safe eviction;

  • persistent pending pods confirmed eligible for affected pools; include their requests in the theoretical minimum, exclude unrelated pods, and do not model unresolved scheduling failures.

Pools are merge candidates only when workload isolation, OS/architecture, priority, zones, networking, security/compliance, storage, accelerator, and availability requirements remain compatible. Preserve a dedicated production system pool.

Placement Controls

For every workload and pool, inventory controls that limit eligible nodes or block eviction. Record the source, hard or preferred behavior, scope, eligible nodes/domains, excluded capacity, and documented intent. Include topology spread, affinity/anti-affinity, selectors, taints/tolerations, zones, host ports, storage locality, extended resources, and disruption controls.

Correlate each control with scheduling failures, evictions, blocked scale-down, or autoscaler/NAP node creation; presence alone does not prove cost impact. Preserve confirmed requirements and unknown intent. Flag owner review only when evidence shows a control is stale, redundant, conflicting, broader than its intent, or disproportionately strands capacity.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Microsoft
Publisher
Microsoft (Official)
Source
microsoft/skills · .github/plugins/aks-skills/skills/aks-cost-optimization · commit 0696600
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from .github/plugins/aks-skills/LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aks-cost-optimization.zip