Logotipo de K8s Autoscaling Troubleshooting

K8s Autoscaling Troubleshooting

Organización
k8s-servant
k8s-autoscaling-troubleshooting

Úsala cuando el autoescalado de Kubernetes no escala como se espera: un HorizontalPodAutoscaler cuyos TARGETS muestran «<unknown>», «missing request for cpu», «unable to get metrics for resource cpu» o «FailedGetResourceMetric»; un HPA atascado en maxReplicas («TooManyReplicas») o que no reduce la escala; «Metrics API not available» al ejecutar kubectl top; metrics-server no está Ready; un KEDA ScaledObject que no está Ready («ScaledObjectCheckFailed») o no crea ningún HPA; los escaladores de KEDA fallan; dos autoescaladores actúan sobre una misma carga de trabajo, o un VerticalPodAutoscaler no ofrece recomendaciones. Investiga con kubectl get, describe, events, logs y top, y propone soluciones. Primero lee la información y pregunta antes de cambiar nada.

Descripción general

Editork8s-servant
Repositoriok8s-skills
Nombre de la habilidadk8s-autoscaling-troubleshooting
Estrellas
36
Forks
7
Archivos incluidos
2
LicenciaApache-2.0
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 2

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por k8s-servant en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA K8s Autoscaling Troubleshooting en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

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
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa K8s Autoscaling Troubleshooting en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga K8s Autoscaling Troubleshooting automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que K8s Autoscaling Troubleshooting no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

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:

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA K8s Autoscaling Troubleshooting?

Úsala cuando el autoescalado de Kubernetes no escala como se espera: un HorizontalPodAutoscaler cuyos TARGETS muestran «<unknown>», «missing request for cpu», «unable to get metrics for resource cpu» o «FailedGetResourceMetric»; un HPA atascado en maxReplicas («TooManyReplicas») o que no reduce la escala; «Metrics API not available» al ejecutar kubectl top; metrics-server no está Ready; un KEDA ScaledObject que no está Ready («ScaledObjectCheckFailed») o no crea ningún HPA; los escaladores de KEDA fallan; dos autoescaladores actúan sobre una misma carga de trabajo, o un VerticalPodAutoscale...

¿Por qué usar K8s Autoscaling Troubleshooting en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. K8s Autoscaling Troubleshooting está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo K8s Autoscaling Troubleshooting en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-autoscaling-troubleshooting. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar K8s Autoscaling Troubleshooting?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar K8s Autoscaling Troubleshooting?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar K8s Autoscaling Troubleshooting con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA K8s Autoscaling Troubleshooting?

Sí. k8s-servant la ha publicado en GitHub bajo la licencia Apache-2.0. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇