Kubernetes Horizontal Pod Autoscaler Manifest Version 2 beta 2

From NovaOrdis Knowledge Base
Revision as of 18:55, 13 October 2020 by Ovidiu (talk | contribs) (→‎type)
Jump to navigation Jump to search

External

Internal

Overview

v2 beta2 Horizontal Pod Autoscalers support autoscaling solution based on custom and external metrics. See:

Custom Metrics-based Scaling

Example

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: example
spec:
  minReplicas: 1
  maxReplicas: 5
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: httpd
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 50
    - type: Pods
      pods:
        metric:
          name: packets-per-second
        target:
          type: AverageValue
          averageValue: 1K

.spec Elements

minReplicas

maxReplicas

scaleTargetRef

metrics

type

The type can be Resource, Pods, Object.

resource

target

type

AverageValue/averageValue, Utilization/averageUtilization

Object metrics support target types of both Value and AverageValue. With Value, the target is compared directly to the returned metric from the API. With AverageValue, the value returned from the custom metrics API is divided by the number of Pods before being compared to the target.