×
Community Blog Connect Cluster Cost Analysis to an ACK Registered Cluster

Connect Cluster Cost Analysis to an ACK Registered Cluster

This article introduces cluster cost analysis and describes how to set up cost analysis for a Container Service for Kubernetes (ACK) registered cluster.

By Liusheng

This article introduces cluster cost analysis and describes how to set up cost analysis for a Container Service for Kubernetes (ACK) registered cluster.

Prerequisites

(1) The version of the Kubernetes cluster is v1.18.8 or later.

(2) Enable Alibaba Cloud Prometheus Service For more information, see Enable Prometheus Service.

Installation

Method 1 (Recommended) Use the onectl CLI to Configure and Install the Cost Analysis Component.

Using onectl CLI to configure a registered cluster, see Use onectl to configure a registered cluster for more information.

After configuring onectl, run the following command to automatically configure and install ack-cost-exporter components.

onectl addon install ack-cost-exporter

Expected output:

Successfully create ram policy 'externalK8sPolicy-ack-cost-exporter'.
Addon ack-cost-exporter installed

Method 2: Manual Configuration

Step 1: Grant Access to the ack-cost-exporter Component

(1) Create a RAM user. For more information, see Create a RAM user.

(2) Create a custom permission policy. For more information, see Create a custom permission policy. The following permissions are required for the ack-arms-prometheus component.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "bssapi:QueryInstanceBill",
                "bssapi:DescribeInstanceBill"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeDisks",
                "ecs:DescribeSpotPriceHistory",
                "ecs:DescribeInstances",
                "ecs:DescribePrice"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "eci: DescribeContainerGroupPrice",
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

(3) Add permissions to the RAM user. For more information, see Grant permissions to a RAM user.

(4) Create an AccessKey pair for the RAM user. For more information, see Create an AccessKey Pair.

(5) Use the AccessKey pair to create a Secret named alibaba-addon-secret in the registered cluster.

Run the following command to create the Secret for the ack-cost-exporter component:

kubectl -n kube-system create secret generic alibaba-addon-secret --from-literal='access-key-id=<your AccessKey ID>' --from-literal='access-key-secret=<your AccessKey Secret>'

Step 2: Install the ack-cost-exporter Component

(1) Log on to the ACK console. In the left-side navigation pane, click Clusters.
(2) On the Clusters page, click the name of the target cluster and choose Applications > Helm in the left-side navigation pane. If there are existing ack-cost-exporter installation records on the *Helm page, delete them before following the subsequent steps to reconnect.
(3) In the left-side navigation pane of the details page, select Operations > Components.
(4) On the Components page, click the Logs and Monitoring tab.
(5) Locate the ack-cost-exporter card and click Install in the lower right corner. Then, click OK. After the installation, you can learn more about the capabilities of the cost analysis component. For more information, see Cost Analysis.

1 1 0
Share on

Alibaba Container Service

167 posts | 30 followers

You may also like

Comments

Kidd Ip August 3, 2023 at 12:41 am

Thank you for sharing, it is good to have cost analysis in K8S!

Alibaba Container Service

167 posts | 30 followers

Related Products

  • Bastionhost

    A unified, efficient, and secure platform that provides cloud-based O&M, access control, and operation audit.

    Learn More
  • Managed Service for Grafana

    Managed Service for Grafana displays a large amount of data in real time to provide an overview of business and O&M monitoring.

    Learn More
  • ACK One

    Provides a control plane to allow users to manage Kubernetes clusters that run based on different infrastructure resources

    Learn More
  • Container Service for Kubernetes

    Alibaba Cloud Container Service for Kubernetes is a fully managed cloud container management service that supports native Kubernetes and integrates with other Alibaba Cloud products.

    Learn More