Logo: K8s Autoscaling Troubleshooting

K8s Autoscaling Troubleshooting

Organisatioun
k8s-servant
k8s-autoscaling-troubleshooting

Benotzt dës Skill, wann d'automatesch Skaléierung a Kubernetes net wéi erwaart funktionéiert: bei engem HorizontalPodAutoscaler steet bei TARGETS „<unknown>“, „missing request for cpu“, „unable to get metrics for resource cpu“ oder „FailedGetResourceMetric“, en HPA hänkt bei maxReplicas („TooManyReplicas“) oder skaléiert net erof, kubectl top weist „Metrics API not available“, metrics-server ass net Ready, e KEDA ScaledObject ass net Ready („ScaledObjectCheckFailed“) oder erstellt keen HPA, KEDA-Scaler schloen feel, zwee Autoscaler si fir eng Workload zoustänneg oder e VerticalPodAutoscaler huet keng Recommandatiounen. Ënnersicht de Problem mat kubectl get, describe, events, Logs an top a proposéiert Léisungen. Liest fir d'éischt a freet, éier eppes geännert gëtt.

Iwwersiicht

Editeurk8s-servant
Repositoryk8s-skills
Skill-Nummk8s-autoscaling-troubleshooting
Stären
36
Forks
7
Matgeliwwert Dateien
2
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    k8s-servant huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill K8s Autoscaling Troubleshooting an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert K8s Autoscaling Troubleshooting an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet K8s Autoscaling Troubleshooting automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass K8s Autoscaling Troubleshooting net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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:

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill K8s Autoscaling Troubleshooting?

Benotzt dës Skill, wann d'automatesch Skaléierung a Kubernetes net wéi erwaart funktionéiert: bei engem HorizontalPodAutoscaler steet bei TARGETS „<unknown>“, „missing request for cpu“, „unable to get metrics for resource cpu“ oder „FailedGetResourceMetric“, en HPA hänkt bei maxReplicas („TooManyReplicas“) oder skaléiert net erof, kubectl top weist „Metrics API not available“, metrics-server ass net Ready, e KEDA ScaledObject ass net Ready („ScaledObjectCheckFailed“) oder erstellt keen HPA, KEDA-Scaler schloen feel, zwee Autoscaler si fir eng Workload zoustänneg oder e VerticalPodAutoscaler...

Firwat K8s Autoscaling Troubleshooting op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. K8s Autoscaling Troubleshooting besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech K8s Autoscaling Troubleshooting an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen K8s Autoscaling Troubleshooting benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat K8s Autoscaling Troubleshooting benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir K8s Autoscaling Troubleshooting domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill K8s Autoscaling Troubleshooting gratis?

Jo. k8s-servant huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇