Kubernetes
Connect Kubernetes to bring your cluster cost into Cloud & AI Cost Management.
Before You Start
See Roles and Policies for the Connector to learn about the IAM roles and policies that you need to be assigned to be able to create a connector.
Deploy one delegate per cluster
CACM does not support a single delegate serving multiple clusters. Metric collection is memory-intensive, and the resource requirement grows with the number of nodes in each cluster. Sharing a delegate across clusters will exceed its resource capacity and produce inaccurate cost data.
Right-size your delegate before you deploy
The more nodes your cluster has, the more CPU and memory your delegate needs. Always deploy one delegate replica sized for that cluster. Do not split the load across multiple smaller replicas, as CACM does not support horizontal scaling. Go to Cluster, Delegate, and Metrics Server Requirements to review sizing before you deploy.
Install Delegate
Install a Harness Kubernetes delegate in the cluster.
Delegate permission requirements
You can choose one of the following permissions for the delegate for CACM:
Install Delegate with cluster-wide read/write access: Creates a new namespace called "harness-delegate-ng" with the service account bound to Cluster Admin role. This Delegate will be able to read tasks (capture change events etc., needed for Harness Cloud & AI Cost Management) anywhere on the K8s cluster where the Delegate is installed.
Install Delegate with cluster-wide read access: (Requires read-only Cluster Admin role) Creates a new namespace called "harness-delegate-ng" with the service account bound to Cluster Admin role. This Delegate will be able to perform read-only tasks (capture change events etc., needed for Harness Cloud & AI Cost Management) anywhere on the K8s cluster where the Delegate is installed.
Delegate role requirements for CACM visibility features and recommendations:
The YAML provided for the Harness Delegate defaults to the cluster-admin role. If you can't use cluster-admin because you are using a cluster in your company, you'll need to edit the delegate YAML to include the role below. If you deployed your delegate with Helm, you can also set the value ccm.visibility: true to have this role and binding created.
Set up the Kubernetes connector
Quick Create Method
What this creates
The following entities are created in this process:
A Kubernetes delegate of medium size with cluster admin permissions.
A Kubernetes connector which can also be used for other Harness modules such as CI, CD, and so on.
Cost Visibility is enabled on this Kubernetes connector.
Step-by-Step Guide
Step 1: Overview
Launch the wizard and select Kubernetes as the cloud provider. Click on Quick Create.
Enter a name for your connector. Note that this is the name with which the Kubernetes Cluster will be identified in Harness Cloud & AI Cost Management. Also, you must have the Cluster Admin Role for the Cluster you want to add.
Click Continue.
Step 2: Download and Apply YAML
To grant Harness the required cluster permissions, apply the delegate YAML.
What this YAML does
Creates a Harness Delegate.
Grants the Delegate the
cluster-adminrole.
How to apply
In the wizard, click Download YAML (you can preview the file).
Run the following command:
After the command succeeds, return to the wizard and click Continue. Harness will create a Kubernetes Connector.
EKS requirement
For Amazon EKS clusters, make sure the Kubernetes Metrics Server is installed in the cluster where the Harness Delegate runs.
Step 3: Create and Test Connection
After successfully creating the delegate and connectors and verifying permissions, select Finish. The connector is now listed in the Kubernetes clusters table.
🎉 You’ve now connected your Kubernetes cluster and enabled cost visibility in Harness.
Advanced Method
Before you begin
If you have previously created a connector to the preferred cluster for any other modules (Deployments, Builds etc.), you may reference the same connector to upgrade to support Cloud & AI Cost Management.
If this is your first time creating a connector to the cluster, you need to create a new connector.
To fully enable CACM for a Kubernetes cluster, you need to:
Deploy a delegate into the target cluster. This gives Harness a connection into your cluster.
Create a Harness cloud provider Kubernetes connector that targets the delegate. This ties your cluster and delegate to a representation of your cluster in Harness.
Create a Harness CACM Kubernetes connector that targets the Kubernetes connector. This enables the delegate to start collecting usage metrics to be sent back to Harness for use in CACM.
(Optional) Deploy the autostopping controller and router into the target cluster. This enables you to create CACM autostopping rules to reduce costs of your cluster.
Data availability
After you enable CACM in your first cluster, the data is available within a few minutes for viewing and analysis.
However, you can't see the idle cost due to missing utilization data. CACM generates the last 30 days of the cost data based on the first events.
From the second cluster onwards, it takes about 2 to 3 hours for the data to be available for viewing and analysis.
If you are using a CACM cloud connector, the data generation is delayed. Since CACM performs cost true-up based on cost information available at cloud provider source.
Kubernetes CACM connection requirements and workflow
For CACM, you can only use Kubernetes connectors at the Account level in Harness. This section describes how to set up the CACM Kubernetes connector.
Here's a visual representation of the CACM Kubernetes connector requirements and workflow:

Create the Cloud Provider Kubernetes Cluster Connector
Once the delegate is deployed you need to create a Kubernetes cloud provider connector at the Account level. This connector should be created to Use credentials of a specific Harness delegate and select the delegate you deployed into the target cluster.
Make sure the connector passes its connection test to validate the delegate has been installed correctly and can make outbound connections to the Harness Manager.
Delegate and connector ratio
Deploy each delegate inside its target cluster. CACM collects metrics directly from the cluster it runs in and cannot serve multiple clusters. As a result, the ratio of Delegates to Connectors in Harness is 1:2. For 20 clusters, you need 20 delegates and 40 connectors (one Kubernetes cloud provider connector and one CACM Kubernetes connector per cluster).
Create CACM Kubernetes Connector
Interactive Guide
Step-by-Step Guide
Step 1: Overview
Select Kubernetes Connector: Choose an existing Kubernetes connector from your available connectors.
Configure Cloud Cost Connector: Enter a name, optional description, and tags for your connector.
Click Continue to proceed to the next step.
Step 2: Feature Selection
Choose the Cloud & AI Cost Management features you want to enable for your Kubernetes cluster:
Deep Kubernetes Cost Visibility (Selected by default)
Kubernetes Optimization by AutoStopping (Optional)
Cloud provider notes
For AWS and Azure, if the cloud connectors are set up, then the cost will be trued-up to the pricing received from the CUR/billing export. However, for GCP the list pricing is used.
CACM supports Karpenter for AWS starting from version 0.37 and later. However, it is currently not supported for GCP and Azure.
Click Continue to proceed to the next step.
Step 3: Secret Creation (Conditional - if AutoStopping is selected)
Create an API key from your Harness account settings
Create namespace:
Create secret YAML file - Replace
YOUR_API_TOKEN_HEREwith your actual API key:Apply the secret:
Step 4: Provide Permissions
Download YAML file - The wizard will provide a YAML file containing permissions to access the pods and services of the cluster. You can also preview the YAML file.
Copy the downloaded YAML to a machine where you have kubectl installed and have access to your Kubernetes cluster. Run the following command to apply the Harness delegate to your Kubernetes Cluster:
Click Done and then Continue
Step 5: Verify Connection
Harness will verify the connection to your Kubernetes cluster
🎉 Success! You've successfully connected your Kubernetes cluster to Harness Cloud & AI Cost Management.
Troubleshooting
In the Verify connection step, if you get an error message like few of the visibility permissions are missing, then you need to review the CACM permissions required for Harness Delegate.

Verify that you have all the required permissions for the Service account using the following commands:
Here is an example showing the commands and output using the default Delegate Service account name and namespace:
Next Steps
Explore these features to enhance your cloud & AI cost management:
Create Budgets and Alerts to monitor spend thresholds
Use BI Dashboards to visualize cloud usage and trends
Revisit optional integrations:
Turn visibility into action and unlock cost efficiency across your Azure cloud infrastructure.
FAQs
Last updated
Was this helpful?