Updated on 2024-04-15 GMT+08:00

metrics-server

From version 1.8 onwards, Kubernetes provides resource usage metrics, such as the container CPU and memory usage, through the Metrics API. These metrics can be directly accessed by users (for example, by running kubectl top) or used by controllers (for example, Horizontal Pod Autoscaler) in a cluster for decision-making. Metrics Server fetches these metrics.

Metrics Server is a cluster-wide aggregator of resource usage data. It is used as the metrics-server add-on on UCS. You can quickly install this add-on on the cluster details page.

After metrics-server is installed, you can create an HPA policy on the Workload Scaling page. For details, see Workload Auto Scaling (HPA).

Official community projects: https://github.com/kubernetes-sigs/metrics-server

Constraints

metrics-server can be installed only in on-premises clusters.

Installing the Add-on

  1. Access the cluster details page.

    • If the cluster is not added to any fleet, click the cluster name.
    • If the cluster has been added to a fleet, click the fleet name. In the navigation pane, choose Clusters > Container Clusters.

  2. In the navigation pane, choose Add-ons. Locate metrics-server in Add-ons Available and click Install.
  3. Set Add-on Specifications to Standalone, HA, or Custom and click Install.

    • In the on-premises cluster, the maximum number of metrics-server instances depends on the number of manage nodes. If you want to create more metrics-server instances using custom specifications, expand the number of manage nodes first.
    • The manage nodes are managed using labels and taints in the on-premises cluster. To expand the number of the manage nodes, you only need to add labels and taints to non-manage nodes in the cluster. The procedure is as follows:
      1. Access the cluster details page and click Nodes in the navigation pane.
      2. Select the non-manage node and click Labels and Taints.
      3. Click Add Operation to add an update content: Add/Update > Kubernetes > cop.manage > manage.
      4. Click Add Operation to add an update content: Add/Update > Taint > role > manage > NoSchedule.
      5. Click OK.

  4. Click the name of metrics-server in the installed add-on list to view the deployment status of the add-on instance in the cluster.

Upgrading the Add-on

  1. Access the cluster details page. In the navigation pane, choose Add-ons.
  2. In the installed add-on list, if there is "New version available" next to the version label of metrics-server, click Upgrade.

    • If the button is unavailable, the add-on is already up-to-date and no upgrade is required.
    • During the upgrade, metrics-server of the old version will be discarded, and metrics-server of the latest version will be installed.

  3. Configure the parameters as prompted and click OK.

Modifying the Add-on

  1. Access the cluster details page. In the navigation pane, choose Add-ons.
  2. Locate metrics-server in the installed add-ons and click Edit.
  3. Configure the parameters as prompted and click OK.

Uninstalling the Add-on

  1. Access the cluster details page. In the navigation pane, choose Add-ons.
  2. Locate metrics-server in the installed add-ons and click Uninstall.
  3. In the displayed dialog box, click Yes.

    After metrics-server is uninstalled, you need to install another add-on that provides the Metrics API. If no add-on is installed, existing workload scaling policies will become unavailable.