This adapter contains an implementation of external metrics API. It is therefore suitable for use with the autoscaling/v2 Horizontal Pod Autoscaler in Kubernetes 1.6+.
git clone firstname.lastname@example.org:apache/skywalking-swck.git
config/adapter/adapter/kustomization.yaml file to change your preferences. If you prefer to your private docker image, a quick path to override
ADAPTER_IMG environment variable :
export ADAPTER_IMG=<private registry>/adapter:<tag>
make to generate the final manifests and deploy:
The adapter takes the standard Kubernetes generic API server arguments (including those for authentication and authorization). By default, it will attempt to using Kubernetes in-cluster config to connect to the cluster.
It takes the following addition arguments specific to configuring how the adapter talks to SkyWalking OAP cluster:
--oap-addrThe address of OAP cluster.
--metric-filter-regexA regular expression to filter metrics retrieved from OAP cluster.
--refresh-intervalThis is the interval at which to update the cache of available metrics from OAP cluster.
External metrics allow you to autoscale your cluster based on any metric available in OAP cluster. Just provide a metric block with a
selector, and use the
External metric type.
- type: External external: metric: name: <metric_name> metricSelector: matchLabels: <label_key>: <label_value> ... target: ....
label_keyis from the arguments of swctl .
The options of label keys are:
serviceThe name of the service.
instanceThe name of the service instance.
endpointThe name of the endpoint.
labelis optional, The labels you need to query, used for querying multi-labels metrics. Unlike swctl, this key only supports a single label due to the specification of the custom metrics API.
For example, if your application name is
front_gateway, you could add the following section to your HorizontalPodAutoscaler manifest to specify that you need less than 80ms of 90th latency.
- type: External external: metric: name: service_percentile metricSelector: matchLabels: service: front_gateway # The index of [P50, P75, P90, P95, P99]. 2 is the index of P90(90%) label: "2" target: type: value value: 80