Skip to content

CICD-285 · Horizontal Pod Autoscaler validation ​

Encyclopedia · Advanced Kubernetes operations · All snippets

Previous · CICD-284 · Next · CICD-286

1. Where it fits ​

  • Placement CI validation step.
  • Prerequisites kubectl, isolated cluster or namespace and installed CRDs when named.
  • Platforms kubernetes, local-lab.

2. Copy the snippet ​

bash
kubectl -n staging get hpa web -o json | jq -e '.status.conditions | any(.type=="ScalingActive" and .status=="True")'

3. How it works ​

The query examines whether the HPA can evaluate its metric. An active condition is a preflight signal, while changing replica counts under load demonstrates scaling.

4. Verify the result ​

Metrics server or adapter must be available and CPU requests defined. Test replica movement under controlled load.

Validation syntax-validated (Bash parse). Status definitions.