This product is not supported for your selected Datadog site. ().

Metadata

Id: 2f652c42-619d-4361-b361-9f599688f8ca

Cloud Provider: k8s

Framework: Kubernetes

Severity: Low

Category: Availability

Learn More

Description

The Horizontal Pod Autoscaler must target a valid object.

Compliant Code Examples

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: php-apache
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: Object
    object:
      metric:
        name: requests-per-second
      describedObject:
        apiVersion: networking.k8s.io/v1beta1
        kind: Ingress
        name: main-route
      target:
        type: Value
        value: 10k
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: matching-svc
  namespace: default
spec:
  metrics:
    - resource:
        name: cpu
        target:
          averageUtilization: 50
          type: Utilization
      type: Resource
  minReplicas: 1
  maxReplicas: 5
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: matching-svc

Non-Compliant Code Examples

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: php-apache
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: Object
    object:
      metric:
        name: requests-per-second
      target:
        type: Value
        value: 10k
      describedObject:
        apiVersion: networking.k8s.io/v1beta1
        kind: Ingress