Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 2.83 KB

introduction.md

File metadata and controls

54 lines (41 loc) · 2.83 KB

Getting Started

This HPA adapter can be used to horizontally autoscale your Kubernetes Pods based on metrics available within Operations for Applications.

By default, the Kubernetes HorizontalPodAutoscaler controller fetches metrics from a series of APIs. This adapter implements the APIs detailed below.

custom.metrics.k8s.io

For the custom metrics API, this adapter provides all Kubernetes metrics collected using the Operations for Applications Kubernetes Metrics Collector.

This can be configured using the wavefront-metric-prefix adapter property. See metrics.md for the list of metrics provided through this API.

Use the external metrics API described below if you want to use non-Kubernetes metrics or Kubernetes metrics collected using a different mechanism than the Operations for Applications Kubernetes Metrics Collector.

external.metrics.k8s.io

The external metrics API allows you to autoscale on any arbitrary metric available in Operations for Applications.

Metrics can be specified via annotations on HPAs or via a static configuration file.

Annotations

Annotations are metadata you attach to Kubernetes objects.

The adapter can dynamically discover HPAs and source external metrics via annotations. The annotations should be of the form wavefront.com.external.metric/<metric_name>: '<ts query>'. For example:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: example-app
  annotations:
    wavefront.com.external.metric/sqs_queue_size: 'align(5m, avg(ts("aws.sqs.approximatenumberofmessagesvisible", QueueName="app-queue")))'
spec:
  minReplicas: 1
  maxReplicas: 5
  metrics:
  - type: External
    external:
      metricName: sqs_queue_size
      targetAverageValue: 248000m
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: example-app

Note: The external metric names should be globally unique.

Static Configuration File

To specify external metrics via a configuration file:

  1. Deploy a Kubernetes ConfigMap listing the metrics you want to autoscale on.
  2. Configure the external-metrics-config adapter property based on the ConfigMap and redeploy the adapter.
  3. Deploy an HPA based on an external metric.

Kubernetes HPA Spec

Refer to the autoscaling spec for more details on configuring HPAs based on the custom or external metrics APIs.