Installing Kubecost on Alibaba

Installing Kubecost via Helm

Installing Kubecost on an Alibaba cluster is the same as other cloud providers with Helm v3.1+:

helm install kubecost/cost-analyzer -n kubecost -f values.yaml

Your values.yaml files must contain the below parameters:

        cluster_id: aliyun-ali-test-1 # Each cluster should have a unique ID

  clusterName: "aliyun-ali-test-" # used for display in Kubecost UI
  serviceKeySecretName: "alibaba-service-key"

The alibaba-service-key can be created using the following command:

kubectl create secret generic alibaba-service-key -n kubecost –from-file=./example_path

Your path needs a file having Alibaba Cloud secrets. Alibaba secrets can be passed in a JSON file with the file in the format:

     "alibaba_access_key_id": “XXX”
     "alibaba_secret_access_key": “XXX"

These two can be generated in the Alibaba Cloud portal. Hover over your user account icon, then select AccessKey Management. A new window opens. Select Create AccessKey to generate a unique access token that will be used for all activities related to Kubecost.

Alibaba Cloud integration

Currently, Kubecost does not support complete integration of your Alibaba billing data like for other major cloud providers. Instead, Kubecost will only support public pricing integration, which will provide proper list prices for all cloud-based resources. Features like reconciliation and savings insights are not available for Alibaba. For more information on setting up a public pricing integration, see our Multi-Cloud Integrations doc.


Cannot install Kubecost without a default StorageClass

While getting all the available Storage Classes that the Alibaba K8s cluster comes with, there may not be a default storage class. Kubecost installation may fail as the cost-model pod and Prometheus server pod would be in a status pending state.

To fix this issue, make any of the Storage Classes in the Alibaba K8s cluster as Default using the below command:

 kubectl patch storageclass alicloud-disk-available -p '{"metadata": {"annotations":{"":"true"}}}' 

Following this, installation should proceed as normal.

Last updated