The cost analysis feature of Container Service for Kubernetes (ACK) provides dashboards that show visualized information about the costs of your clusters, namespaces, node pools, and applications. This topic describes how to enable the cost analysis feature.

Prerequisites

  • The Kubernetes version of your cluster is 1.18.8 or later. If the Kubernetes version of your cluster is earlier than 1.18.8, update the Kubernetes version to 1.18.8 or later. For more information, see Upgrade the Kubernetes version of an ACK cluster.
  • Application Real-Time Monitoring Service (ARMS) Prometheus is enabled for your cluster. For more information, see Enable ARMS Prometheus.
  • The ack-cost-exporter component is installed in your cluster.

Procedure

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
  4. In the left-side navigation pane of the details page, choose Operations > Cost Analysis.
  5. On the Cost Analysis page, click KubernetesWorkerRole-*** to go to the RAM console and modify the RAM policy that is attached to the RAM role.
    1. On the details page of the RAM role, click the name of the K8sWorkerRolePolicy-*** policy.
    2. On the details page of the RAM policy, click Modify Policy Document.
    3. In the Modify Policy Document panel, add the following content and click OK.
              {
                  "Action": [
                      "bssapi:QueryInstanceBill"
                  ],
                  "Resource": "*",
                  "Effect": "Allow"
              },
              {
                  "Action": [
                      "ecs:DescribeDisks",
                      "ecs:DescribeSpotPriceHistory",
                      "ecs:DescribeInstances",
                      "ecs:DescribePrice"
                  ],
                  "Resource": "*",
                  "Effect": "Allow"
              }
      Note To specify multiple actions, add a comma (,) to the end of the content of each action before you enter the content of the next action.
  6. On the Cost Analysis page, click Install.
  7. After the component is installed, click Upgrade to update the component.
    After the component is updated, dashboards appear on the Cost Analysis page.