Faberby FaberOps

HorizontalPodAutoscaler Unable to Compute Metrics

Matches Kubernetes HorizontalPodAutoscaler FailedGetResourceMetric, FailedGetExternalMetric, and missing container resource request conditions.

Kind
Signature
Version
2.0.0
Tier
verified
Needs Faber
v2.0.0+
Digest prefix
sha256:84c8e6ff

Contract facts

Sources
2
kubernetes, prometheus
Log patterns
3
RE2, replayed in CI
Kubernetes matchers
1
CEL on live objects
Samples
3 and 2
must match and must not

Inspect it

Inspect the contract and RBAC delta

$ faberctl catalog inspect signatures/hpa-unable-to-compute-metrics \ --source oci://ghcr.io/faberops/catalog:v2

How it works

Sources

kubernetes, prometheus

What it matches

Must match

  • Warning FailedGetResourceMetric: unable to get metrics for resource cpu: no metrics returned
  • Warning FailedComputeMetricsReplicas: failed to get cpu utilization: missing request for cpu in container api
  • HPA payments/checkout-hpa unable to get metrics for resource memory

Must not match

  • Normal SuccessfulRescale: New size: 4 reason: cpu resource utilization above target
  • HPA payments/checkout-hpa ScalingActive=True

Signature source

signature.yamlFailureSignature29 lines
apiVersion: catalog.faberops.dev/v2
kind: FailureSignature
metadata:
  name: hpa-unable-to-compute-metrics
spec:
  description: Matches Kubernetes HorizontalPodAutoscaler FailedGetResourceMetric, FailedGetExternalMetric, and missing container
    resource request conditions.
  sources:
  - kubernetes
  - prometheus
  logPatterns:
  - FailedGetResourceMetric|FailedComputeMetricsReplicas
  - missing request for (cpu|memory) in container
  - unable to get metrics for resource (cpu|memory)
  samples:
    match:
    - 'Warning FailedGetResourceMetric: unable to get metrics for resource cpu: no metrics returned'
    - 'Warning FailedComputeMetricsReplicas: failed to get cpu utilization: missing request for cpu in container api'
    - HPA payments/checkout-hpa unable to get metrics for resource memory
    noMatch:
    - 'Normal SuccessfulRescale: New size: 4 reason: cpu resource utilization above target'
    - HPA payments/checkout-hpa ScalingActive=True
  kubernetes:
  - apiVersion: autoscaling/v2
    kind: HorizontalPodAutoscaler
    match: has(object.status) && has(object.status.conditions) && object.status.conditions.exists(c, c.type == "ScalingActive"
      && c.status == "False")
  queries:
    promql: kube_horizontalpodautoscaler_status_condition{condition="ScalingActive",status="false"} == 1
pack.yamlcatalog metadata11 lines
# Catalog metadata for signatures/hpa-unable-to-compute-metrics. Not applied to the cluster.
apiVersion: catalog.faberops.dev/v2
kind: CatalogPack
metadata:
  name: hpa-unable-to-compute-metrics
  category: signatures
  version: 2.0.0
spec:
  tier: verified
  minFaberVersion: v2.0.0
  digest: sha256:84c8e6ffffddcb1c7f9ce371a64b5c1d2dd240e32fb08861756d99c2ddbf4e1a

Signatures are catalog data. A Playbook references one by name in a connector trigger. It is never applied on its own.