/platform-extras-skills:karpenter-cluster-autoscalingfrom platform-extras-skills
Guides configuring Karpenter for Kubernetes node autoscaling including NodePool and EC2NodeClass setup, consolidation/bin-packing, Spot/On-Demand mixing, and comparison with Cluster Autoscaler.
Ships in platform-extras-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The Kubernetes Cluster Autoscaler scales fixed-shape node groups
(Auto Scaling Groups / VM Scale Sets / node pools) up and down based on
pending pods and node utilization — it's reliable but coarse: node
shape is decided ahead of time per node group, and scale-down is
group-aware rather than genuinely bin-packing across instance types.
Karpenter instead provisions individual nodes directly (no node group
indirection), choosing the cheapest instance type and Availability Zone
that satisfies a pending pod's actual requirements at scale-up time, and
continuously consolidates running nodes — replacing several
underutilized nodes with fewer, better-packed ones, or swapping an
On-Demand node for a cheaper Spot equivalent — without waiting for a
fixed node-group scaling policy to catch up. That flexibility is also
where most Karpenter misconfiguration bites: an unbounded NodePool can
provision instance types or sizes nobody intended, and aggressive
consolidation can evict pods more often than a stateful or
latency-sensitive workload can tolerate if not scoped with disruption
budgets and pod-level guardrails.
NodePool/EC2NodeClass (AWS) to constrain
which instance types, architectures, capacity types (On-Demand vs.
Spot), and zones Karpenter is allowed to provision.Pending that should have triggered a scale-up,
or nodes that never scale down despite being underutilized.karpenter.sh/v1 API) consolidated the earlier v1beta1 CRDs;
confirm which API version a given cluster is running before applying
examples, since Provisioner/AWSNodeTemplate (pre-1.0) were renamed
to NodePool/EC2NodeClass.aws:ResourceTag/karpenter.sh/discovery conditions, not
account-wide EC2 permissions.karpenter.sh/discovery: <cluster-name>) so EC2NodeClass can find
them without hardcoding IDs.Install the Karpenter controller via Helm, scoped to the cluster's IRSA/Pod Identity role:
helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter \
--version 1.1.1 \
--namespace kube-system \
--set settings.clusterName=<CLUSTER_NAME> \
--set settings.interruptionQueue=<CLUSTER_NAME>-karpenter-interruption \
--set serviceAccount.annotations."eks\.amazonaws\.com/role-arn"="arn:aws:iam::<AWS_ACCOUNT_ID>:role/KarpenterControllerRole-<CLUSTER_NAME>"
Define an EC2NodeClass describing the AMI, subnets, security
groups, and instance profile Karpenter-provisioned nodes should use:
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: default
spec:
amiFamily: AL2023
role: "KarpenterNodeRole-<CLUSTER_NAME>"
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: <CLUSTER_NAME>
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: <CLUSTER_NAME>
blockDeviceMappings:
- deviceName: /dev/xvda
ebs:
volumeSize: 50Gi
volumeType: gp3
encrypted: true
Define a NodePool constraining instance types, capacity type,
and consolidation behavior — this is the primary lever for cost and
blast-radius control:
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: general-purpose
spec:
template:
spec:
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default
requirements:
- key: karpenter.k8s.aws/instance-category
operator: In
values: ["c", "m", "r"]
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values: ["4"]
- key: karpenter.sh/capacity-type
operator: In
values: ["spot", "on-demand"]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
expireAfter: 720h # force node replacement at least every 30 days (patching hygiene)
limits:
cpu: "1000" # hard ceiling on total CPU this NodePool can provision
memory: 4000Gi
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 5m
limits is not optional in production — an unbounded NodePool will
happily scale to whatever a runaway Deployment/HPA requests.
Create a separate, more restrictive NodePool for
latency-sensitive or stateful workloads that shouldn't be
consolidated as aggressively, using nodeAffinity/taints to steer
scheduling:
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: stateful-on-demand
spec:
template:
spec:
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default
requirements:
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
taints:
- key: workload-type
value: stateful
effect: NoSchedule
disruption:
consolidationPolicy: WhenEmpty # only consolidate fully-empty nodes, not underutilized ones
consolidateAfter: 30m
Pair with a matching tolerations + nodeAffinity on the stateful
workload's pod spec so it lands only on this NodePool.
Set a PodDisruptionBudget on anything consolidation/expiration
could evict, so Karpenter's disruption controller respects
availability requirements rather than draining a node all at once:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: payments-api-pdb
namespace: payments
spec:
minAvailable: 2
selector:
matchLabels:
app: payments-api
Verify consolidation and bin-packing behavior with
kubectl get nodeclaims and node utilization dashboards — Karpenter
should be replacing multiple underutilized nodes with fewer,
better-packed ones over time, not just scaling up on demand and never
scaling down.
Debug pods stuck Pending by checking Karpenter controller logs
and events on the pod itself:
kubectl describe pod <pod-name> -n <namespace>
kubectl logs -n kube-system deployment/karpenter -f
Common causes: no NodePool satisfies the pod's requested
resources/nodeSelector/affinity combination, the NodePool's
limits are already exhausted, or the pod requests a resource
(e.g. a specific GPU type) not represented in any requirements
list.
If migrating from Cluster Autoscaler, remove the
cluster-autoscaler Deployment (or scale it to zero and confirm no
scaling activity) and taint/cordon its managed node groups before
introducing Karpenter NodePools, so both autoscalers never compete
for the same pending pods simultaneously.
limits.cpu/limits.memory on every NodePool —
without it, a misbehaving HPA or a bad deploy can scale a NodePool
far beyond intended capacity/cost before anyone notices.consolidationPolicy: WhenEmptyOrUnderutilized for stateless,
interruption-tolerant workloads and WhenEmpty (or disable
consolidation) for stateful/latency-sensitive ones — aggressive
consolidation is a cost win for the former and an availability risk
for the latter without a PodDisruptionBudget in place.PodDisruptionBudgets on anything Karpenter might consolidate
or expire, especially workloads with fewer than 3 replicas — without
one, Karpenter's disruption controller has no signal to slow down or
stagger evictions.requirements over
pinning one exact type — flexibility across instance types is what
lets Karpenter find Spot capacity and bin-pack efficiently; an overly
narrow NodePool behaves like a fixed node group again.expireAfter to force periodic node replacement (e.g. 30
days) so nodes pick up the latest AMI/patches automatically rather
than accumulating drift on long-lived nodes.NodePools by workload class (general-purpose vs.
stateful/GPU/latency-sensitive) rather than one NodePool for the
whole cluster — it lets consolidation aggressiveness, capacity type,
and instance requirements differ per workload's actual tolerance.Symptom: Pods remain Pending indefinitely even though Karpenter
is installed and running.
Fix: No NodePool in the cluster satisfies the pod's
requirements (resource requests, nodeSelector, architecture,
toleration for a taint), or every eligible NodePool has already hit
its limits. Check kubectl describe pod for scheduling events and
the Karpenter controller logs for the specific reason no NodeClaim
was created; widen requirements or raise limits deliberately.
Symptom: Node cost is much higher than expected, and Karpenter
keeps provisioning large, expensive instance types.
Fix: The NodePool's requirements are too narrow (e.g. pinned
to one large instance family) or a workload's resource requests are
oversized relative to actual usage, forcing Karpenter to provision
bigger nodes to fit them. Broaden instance-type flexibility and
cross-check actual usage via Kubecost/Prometheus before treating
requested resources as accurate sizing.
Symptom: A stateful workload (e.g. a Kafka broker or database
StatefulSet) gets evicted and rescheduled more often than expected,
causing intermittent availability blips.
Fix: The workload was scheduled onto a NodePool with
consolidationPolicy: WhenEmptyOrUnderutilized and no
PodDisruptionBudget, so Karpenter's consolidation treated it like
any other movable pod. Move it to a dedicated NodePool with
consolidationPolicy: WhenEmpty (or disruption disabled) and add a
PodDisruptionBudget.
Symptom: After enabling Karpenter alongside an existing Cluster Autoscaler setup, nodes scale up and down erratically, sometimes within the same minute. Fix: Both autoscalers are managing (or reacting to) the same node groups/pending pods and fighting each other's decisions. Fully decommission Cluster Autoscaler for any node group Karpenter now owns, or partition workloads so only one autoscaler is ever responsible for a given set of pods.
Symptom: Karpenter-provisioned Spot nodes get interrupted
frequently, and interruption handling doesn't drain pods gracefully
before termination.
Fix: The SQS interruption queue (settings.interruptionQueue)
wasn't configured, so Karpenter never received the two-minute Spot
interruption notice from AWS to cordon/drain proactively. Configure
the interruption queue at install time (step 1) and confirm events
are flowing (aws sqs receive-message against the queue during a
test interruption, or check controller logs for interruption events).
Scenario: A cluster runs the Kubernetes Cluster Autoscaler against three fixed EKS managed node groups (small/medium/large instance types), and the platform team wants to cut node cost by moving interruption-tolerant workloads to Spot and letting Karpenter bin-pack more efficiently, without risking the cluster's one stateful Kafka StatefulSet.
default EC2NodeClass (step 2) using subnet/security-
group discovery tags already present on the cluster's VPC.general-purpose NodePool (step 3) allowing c/m/r
instance categories, both spot and on-demand capacity types, with
consolidationPolicy: WhenEmptyOrUnderutilized and a limits.cpu
ceiling set to roughly 20% above current peak cluster CPU usage.stateful-on-demand NodePool (step 4) for the Kafka
StatefulSet: on-demand only, tainted workload-type=stateful, with
consolidationPolicy: WhenEmpty, and add a matching toleration plus
a PodDisruptionBudget (minAvailable: 2 out of 3 Kafka brokers) so
consolidation never drops below quorum.nodeSelector to prefer the general-purpose NodePool, verify
pods land on Karpenter-provisioned nodes, and monitor for a day.stateful-on-demand NodePool
last, verifying the PodDisruptionBudget holds during the node
swap and no broker quorum is lost.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
16 skills in this plugin
/backstage-developer-portalGuides building an internal developer portal with Backstage — authoring catalog-info.yaml to register services in the software catalog, setting up TechDocs for docs-as-code, writing Software Templates to scaffold new services, and understanding the plugin architecture. Use when a user asks to "register a service in Backstage", "write a catalog- info.yaml", "set up TechDocs", "create a Backstage software template for scaffolding new repos", "add a Backstage plugin", or "build an internal developer portal."
/distributed-tracing-with-tempo-and-jaegerGuides configuring Grafana Tempo or Jaeger as the distributed tracing backend — trace storage backend selection and retention, sampling strategy at the backend/collector level (head-based vs. tail-based), and trace-to-metrics/trace-to-logs correlation so a trace ID can pivot directly into a log line or a metrics exemplar. Use when the user asks to "set up Tempo," "configure Jaeger storage," "set trace retention," "configure trace-to-logs correlation in Grafana," "design a sampling strategy for traces," or "query traces with TraceQL." This is the tracing *backend/storage* layer — instrumenting applications and configuring the OpenTelemetry Collector that feeds this backend is covered separately in opentelemetry-instrumentation-and-collector-configuration.
/fluent-bit-configuration-validationValidates Fluent Bit pipeline configuration syntax and tests the INPUT/FILTER/OUTPUT pipeline against sample log lines before a production rollout — dry-run checks, parser testing, and route/Match verification. Use when a user asks to "validate this Fluent Bit config before deploying," "test my Fluent Bit parser against sample logs," "will this Fluent Bit change break log routing," "check this Fluent Bit config in CI," or reports logs silently missing/misrouted after a Fluent Bit config change.
/fluent-bit-log-forwarding-configurationConfigures Fluent Bit as a lightweight log forwarder — INPUT sources (`tail`, `systemd`, Kubernetes container logs), FILTER stages (`kubernetes` metadata enrichment, `parser`, `grep`, `modify`, `nest`/`lift`), and OUTPUT routing to Loki, Elasticsearch/OpenSearch, or S3, including multiple outputs via tags/`Match` and backpressure/ buffering settings. Use when the user asks to "set up Fluent Bit," "forward Kubernetes pod logs to Loki/Elasticsearch/S3," "write a Fluent Bit parser for my log format," "route different logs to different outputs," or "Fluent Bit is dropping logs / backing up."
/incident-investigation-using-metrics-logs-tracesGuides correlating Prometheus metrics, log queries, and distributed traces together during a live incident investigation — using each signal's strengths to narrow from "something is wrong" to a specific root cause faster than any single signal alone. Use when a user asks to "investigate this incident using our metrics and logs," "find the root cause across dashboards, logs, and traces," "correlate this latency spike with logs and a trace," "pivot from an alert to the actual failing request," or is actively triaging a live production issue and needs a systematic cross-signal approach rather than guessing which dashboard to check next.
/kubecost-cost-visibilityGuides deploying Kubecost inside Kubernetes clusters to allocate cloud spend down to namespace, workload, and label, build showback/chargeback reports for platform stakeholders, and feed cost signals into cluster autoscaling and rightsizing decisions. Use when a user asks to "show cost per namespace/team/label in Kubernetes", "set up Kubecost", "build a Kubernetes showback or chargeback report", "find which workload is driving the cloud bill", "size resource requests based on cost", or "connect Kubernetes cost data to autoscaler decisions."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin platform-extras-skillsOther plugins' skills for the same job