K8s Autoscaling Troubleshooting logo

K8s Autoscaling Troubleshooting

Organization
k8s-servant
k8s-autoscaling-troubleshooting

Use when Kubernetes autoscaling does not scale as expected: a HorizontalPodAutoscaler whose TARGETS show "<unknown>", "missing request for cpu", "unable to get metrics for resource cpu" or "FailedGetResourceMetric", an HPA stuck at maxReplicas ("TooManyReplicas") or not scaling down, "Metrics API not available" from kubectl top, metrics-server not Ready, a KEDA ScaledObject that is not Ready ("ScaledObjectCheckFailed") or creates no HPA, KEDA scalers failing, two autoscalers on one workload, or a VerticalPodAutoscaler without recommendations. Investigates with kubectl get, describe, events, logs and top, and proposes fixes. Reads first and asks before changing anything.

Overview

Publisherk8s-servant
Repositoryk8s-skills
Skill namek8s-autoscaling-troubleshooting
Stars
36
Forks
7
Bundled files
2
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by k8s-servant on GitHub. Read the source before you install it.

Installation

Install the K8s Autoscaling Troubleshooting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/k8s-servant/k8s-skills.git /tmp/k8s-skills
mkdir -p .claude/skills
cp -r /tmp/k8s-skills/skills/k8s-autoscaling-troubleshooting .claude/skills/k8s-autoscaling-troubleshooting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable K8s Autoscaling Troubleshooting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads K8s Autoscaling Troubleshooting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so K8s Autoscaling Troubleshooting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Autoscaling troubleshooting

Find out why a workload does not scale the way it should, and propose a fix. Read first, ask before changing. Run the investigation commands freely. Run a command under an "Ask first" line only after the user approves that exact command; if your credentials do not allow it, give it to the user to run. Never run a "Proposed fix"; hand it to the user.

A HorizontalPodAutoscaler (HPA) sets the replica count of a Deployment or StatefulSet every 15 seconds from metrics: CPU and memory from metrics-server (metrics.k8s.io), or custom and external metrics from an adapter. KEDA turns a ScaledObject into an HPA named keda-hpa-<name> and serves its triggers as external metrics (external.metrics.k8s.io). A VerticalPodAutoscaler (VPA) changes requests instead of replicas. The HPA writes what it decided, and why, into three status conditions (AbleToScale, ScalingActive, ScalingLimited) and its events, so they usually name the cause.

The commands use placeholders: my-namespace, my-app (the workload, its HPA and its ScaledObject). Replace them with the real names. The built-in view role can read HPAs and KEDA's objects, but not APIServices or VPAs; if they are forbidden, say so and ask the user for them. Never read Secrets, nor the Secrets a KEDA TriggerAuthentication names. Do not print TriggerAuthentications or ScaledObjects with -o yaml or describe: some hold credentials inline (a Vault token, a password in trigger metadata); read them with the fields below.

When to use

  • kubectl get hpa shows <unknown> in TARGETS, or REPLICAS do not change under load.
  • The workload stays at maxReplicas, or never scales down.
  • kubectl top fails, or metrics-server is not Ready.
  • A ScaledObject or ScaledJob is not Ready or not Active, or its HPA is missing.

Hand-offs, by skill name. When the evidence points elsewhere, continue with that skill; if it is not installed, keep going with the steps here and tell the user which skill would help:

  • The HPA asks for more replicas, but the new pods stay Pending or crash: k8s-workload-troubleshooting, k8s-node-troubleshooting.
  • Custom metrics come from Prometheus (prometheus-adapter or a KEDA prometheus trigger) and the query returns nothing: k8s-prometheus-troubleshooting.
  • A refusal (Forbidden) in the KEDA or metrics-server logs: k8s-rbac-troubleshooting.

Investigate

Work through the steps in order. Stop when you have the cause and its evidence.

1. Read the HPA: targets, replicas, and the three conditions with their reasons.

bash
kubectl get hpa -n my-namespace
kubectl get hpa my-app -n my-namespace -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'
kubectl get hpa my-app -n my-namespace -o jsonpath='{.spec.scaleTargetRef}{"\n"}{.spec.minReplicas} {.spec.maxReplicas}{"\n"}{.spec.metrics}{"\n"}{.spec.behavior}{"\n"}'
kubectl get events -n my-namespace --field-selector involvedObject.kind=HorizontalPodAutoscaler

2. Compare with the target workload: its replicas, its pods' resource requests (utilization is usage divided by request) and the pods' current usage.

bash
kubectl get deployment my-app -n my-namespace -o jsonpath='{.spec.replicas} {.status.readyReplicas}{"\n"}{range .spec.template.spec.containers[*]}{.name}{" "}{.resources}{"\n"}{end}'
kubectl top pods -n my-namespace
kubectl get hpa -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,TARGET:.spec.scaleTargetRef.name

3. Check the metrics pipeline: metrics-server and the APIServices that serve resource and external metrics.

bash
kubectl get apiservices v1beta1.metrics.k8s.io v1beta1.external.metrics.k8s.io
kubectl get deployment metrics-server -n kube-system
kubectl logs -n kube-system deployment/metrics-server --tail=50

4. If KEDA scales the workload, read the ScaledObject's status and KEDA's operator log.

bash
kubectl get scaledobjects,scaledjobs,triggerauthentications -n my-namespace
kubectl get scaledobject my-app -n my-namespace -o jsonpath='{.spec.scaleTargetRef}{"\n"}{.spec.minReplicaCount} {.spec.maxReplicaCount}{"\n"}{range .spec.triggers[*]}{.type}{"\n"}{end}{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'
kubectl get events -n my-namespace --field-selector involvedObject.kind=ScaledObject
kubectl logs -n keda deployment/keda-operator --tail=100

5. Open the matching reference and follow its steps:

What you seeReference
HPA conditions and events, <unknown> targets, min and max, behavior, tolerance, two HPAs on one workloadreferences/hpa.md
metrics-server, kubectl top, APIServices, KEDA ScaledObjects, scalers and its webhook, the VPAreferences/metrics-keda-vpa.md

Read the results

What the common findings mean (Kubernetes 1.37, metrics-server 0.9, KEDA 2.21):

  • TARGETS cpu: <unknown>/50% and ScalingActive False FailedGetResourceMetric with failed to get cpu utilization: missing request for cpu in container app of Pod ...: a container has no CPU request, so utilization is undefined and the HPA does nothing for that metric. Every container of the pod needs the request.
  • The same reason with unable to get metrics for resource cpu: ...: no metrics. no metrics returned from resource metrics API is normal for a minute after a pod starts; if it stays, or the message names the resource metrics API, check metrics-server and v1beta1.metrics.k8s.io.
  • ScalingLimited True TooManyReplicas (the desired replica count is more than the maximum replica count): the HPA wants more pods than maxReplicas. Either the limit is too low, or each pod is too small for the load (its CPU limit caps usage far above its request). TooFewReplicas is the same at minReplicas.
  • AbleToScale False FailedGetScale: the HPA's scaleTargetRef names a workload that does not exist (or has no /scale).
  • ScalingActive False AmbiguousSelector: two HPAs select the same pods.
  • ScaledObject Ready False ScaledObjectCheckFailed with ScaledObject doesn't have correct scaleTargetRef specification: deployments.apps "..." not found: KEDA cannot find the target and creates no HPA, so the workload is not scaled at all.
  • HPA scales up, then the replicas fall back: something else sets spec.replicas (a GitOps tool, or applying a manifest that sets replicas), or scale-down waits out its stabilization window (5 minutes by default).

State the cause in one sentence, then the evidence you saw (the condition, reason and message, the spec fields, the requests), then the proposed fix.

Proposed fix

Show each fix to the user before running it: what it changes and how to undo it. Changing an HPA's minReplicas or maxReplicas is reversible and only changes scaling, so it goes under "Ask first" and runs only after the user says yes. Changing a workload's requests restarts its pods, and changing ScaledObjects, triggers, metrics-server or KEDA affects scaling for others: hand those to the user as proposed fixes. Prefer fixing the source (the manifest in Git, the Helm values); a live change is overwritten by the next deploy. Write each undo with the values you found.

Raise the HPA's maximum, when the cluster has room for more pods:

Ask first: the agent runs this only after the user approves it.

bash
kubectl patch hpa my-app -n my-namespace --type=merge -p '{"spec":{"maxReplicas":6}}'
# Undo: kubectl patch hpa my-app -n my-namespace --type=merge -p '{"spec":{"maxReplicas":3}}'

Give every container a CPU request, in the workload's source (this rolls the pods):

Proposed fix: review before running. The agent does not run this.

bash
kubectl set resources deployment/my-app -n my-namespace -c app --requests=cpu=100m
# Undo: kubectl rollout undo deployment/my-app -n my-namespace

Point a ScaledObject at the workload that exists, in its source:

Proposed fix: review before running. The agent does not run this.

bash
kubectl patch scaledobject my-app -n my-namespace --type=merge -p '{"spec":{"scaleTargetRef":{"name":"my-app"}}}'
# Undo: kubectl patch scaledobject my-app -n my-namespace --type=merge -p '{"spec":{"scaleTargetRef":{"name":"my-app-v2"}}}'

Sources

Checked against the Kubernetes 1.37 documentation and source (v1.37.1), metrics-server v0.9.0 and KEDA v2.21.0:

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the K8s Autoscaling Troubleshooting AI skill do?

Use when Kubernetes autoscaling does not scale as expected: a HorizontalPodAutoscaler whose TARGETS show "<unknown>", "missing request for cpu", "unable to get metrics for resource cpu" or "FailedGetResourceMetric", an HPA stuck at maxReplicas ("TooManyReplicas") or not scaling down, "Metrics API not available" from kubectl top, metrics-server not Ready, a KEDA ScaledObject that is not Ready ("ScaledObjectCheckFailed") or creates no HPA, KEDA scalers failing, two autoscalers on one workload, or a VerticalPodAutoscaler without recommendations. Investigates with kubectl get, describe, events,...

Why use K8s Autoscaling Troubleshooting on TypingMind?

Because you install it once and use it with any model. K8s Autoscaling Troubleshooting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install K8s Autoscaling Troubleshooting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use K8s Autoscaling Troubleshooting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with K8s Autoscaling Troubleshooting?

As many as you like. As long as a model supports skills, you can use K8s Autoscaling Troubleshooting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the K8s Autoscaling Troubleshooting AI skill free?

Yes. It is published on GitHub by k8s-servant under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇