Wavefront HPA Adapter for Kubernetes
Wavefront is a high-performance streaming analytics platform for monitoring and optimizing your environment and applications.
The Wavefront HPA (Horizontal Pod Autoscaler) adapter for Kubernetes implements the Kubernetes custom.metrics.k8s.io/v1beta1 and external.metrics.k8s.io/v1beta1 APIs allowing you to autoscale pods based on metrics available within Wavefront.
Prerequisites
- Kubernetes 1.9+
- The aggregation layer needs to be enabled in your Kubernetes cluster prior to deploying the Wavefront adapter.
Getting Started
Refer the Getting Started guide for an overview of the functionality provided by this adapter.
Configuration
Refer the documentation for detailed configuration options.
Installation
Helm install
Refer to the helm chart to install the adapter using Helm.
Manual install
- Clone this repo.
- Edit the
wavefront-url
and wavefront-token
properties in deploy/manifests/05-custom-metrics-apiserver-deployment.yaml
.
- Optionally, edit the
deploy/manifests/04-custom-metrics-config-map.yaml
and modify the external metrics you wish to export.
- Finally run
kubectl apply -f deploy/manifests
to deploy the adapter in your Kubernetes cluster.
Debugging
To verify the installation, run kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1" | jq .
. You should get the list of supported metrics similar to:
{
"kind": "APIResourceList",
"apiVersion": "v1",
"groupVersion": "custom.metrics.k8s.io/v1beta1",
"resources": [
{
"name": "nodes/cpu.node_reservation",
"singularName": "",
"namespaced": false,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "pods/network.rx_errors_rate",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "pods/network.tx_rate",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "pods/cpu.request",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
}
]
}
You can similarly run kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1" | jq .
to verify the external metrics API.
HPA Autoscaling
See the sample configurations under hpa-examples on how to autoscale deployments based on metrics under the custom or external metrics APIs.
Run kubectl describe hpa example-hpa-custom-metrics
to verify the autoscaling works.