A metric adapter allows you to customize metrics to monitor resource usage in a cluster. This enables Horizontal Pod Autoscaler (HPA) for the cluster. This topic describes how to deploy a metric adapter to an external cluster that is registered in Container Service for Kubernetes.

Prerequisites

You have connected to an external Kubernetes cluster through Container Service for Kubernetes. For more information, see Register a cluster.

Background information

Kubernetes allows you to monitor metrics data and enable HPA based on the data. To meet diverse monitoring requirements of developers, Kubernetes defines the following APIs: Resource Metrics, Custom Metrics, and External Metrics. Resource Metrics API is provided by metrics-server to monitor the built-in logical objects in Kubernetes, such as pods, nodes, and namespaces. Custom Metrics API allows you to customize metrics. The metrics data is collected by Prometheus and consumed by HPA for auto scaling. External Metrics API allows you to use metrics from outside of a Kubernetes cluster. This API is suitable for cloud scenarios. For example, you can use the External Metrics API provided by a cloud vendor to query the request rate on an ingress.

Procedure

  1. Log on to the ACK console.
  2. In the left-side navigation pane, choose Marketplace > App Catalog.
  3. On the Alibaba Cloud Apps tab, click ack-alibaba-cloud-metrics-adapter.
  4. Click the Parameters tab and set related parameters.
    metric adapter
    Parameter Description
    accessKeyId The AccessKey ID of your Alibaba Cloud account.
    accessKeySecret The AccessKey secret of your Alibaba Cloud account.
    Region The region where your cluster is deployed, for example, cn-qingdao or ap-southeast-1.
    Note If a leased line is deployed between the cluster and your virtual private cloud (VPC), the leased line is automatically used.
  5. In the Deploy section, select the target cluster.
    Namespace and Release Name are set to the default values.
  6. Click Create.