Skip to main content

Feature Flags with Cloud Cost Module Overview

Feature Flag with Cloud Cost Management tool is a new feature that will enable you to easily identify cost anomalies when enabling a feature. The Feature Flags module integrates with the Harness Cloud Cost Management (CCM) and is able to identify potential correlations between flag change events and cost anomalies.

From the UI within the Harness Application, you'll be able to report the presence of anomalies which will make it easier for you to find which flags may be related to the reported anomalies.

There are pre-requisites in order to use this feature which you can below in the Setting Up Cloud Cost Management in Feature Flags.

note

If you'd like to learn more about the various types of costs within Cloud Cost Management, have a look at Harness' Cloud Cost Management Key Concepts page.

Why use the Cloud Cost Management tool within Feature Flags?​

Using Cloud Cost Management within Feature Flags will help you to:

  1. Increase Visibility: You're able to gain insights into the cost of your Feature Flags.

  2. Have an Improved Proactive Cost Management Experience: You can now have real-time insights into the impact of your Feature Flag changes and optimize your cloud spending into a less manual and time-consuming process.

  3. Adopt Higher Level Troubleshooting: The hope we have at Harness is that this will help you to reduce time to finding solutions around any cost disparaties as well as help to improve your operational effiency of your products.

We've also added an additional feature to the Cloud Cost Monitoring tool. There are three status modes which helps us to categorise anomalies under Monitoring, Anomaly Found and No Changes.

The "No Changes" status within Cloud Cost Monitoring

The "Monitoring" status within Cloud Cost Monitoring

The "Anomalous Spending" status within Cloud Cost Monitoring

Setting Up Cloud Cost Management in Feature Flags

How To Set Up The CCM Feature For Your Environments

  1. On the Home Page of the Harness Application, select Environmentss.
  2. On the Environments page, you should see the option to open Add Cloud Cost Monitoring.
  3. If you are yet to set up your CCM with your Cloud Provider, check the instructions below.

The Cloud Cost Monitoring Feature Within The Environments Menu

How To Set Up The CCM Feature For Your Flags

  1. On the Home Page of the Harness Application, select your Project and click on Feature Flags.
  2. Under the dropdown menu that appears, click Feature Flags. This should take you to the dashboard of the Feature Flags page of your project.
  3. Click on one of your pre-existing Feature Flags on your dashboard.
  4. On the left hand side, the option to toggle Cloud Cost Monitoring should appear.

The Cloud Cost Monitoring Feature Within Harness Feature Flags

If you haven't set up your Harness account to your Cloud Provider before, the option to do so will appear.

note

If you haven't already created any Feature Flags, do follow the Harness 'Create a Feature Flag' documentation.

To set up your Cloud Provider with your account, follow the instructions which aligns with your Cloud Provider:

Setting Up Cloud Cost Management With Your Cloud Providers

Connect CCM For AWS

AWS Connector requirements

  • The same connector cannot be used in NextGen and FirstGen.
  • For CCM, AWS connectors are available only at the Account level in Harness.
  • If you have multiple AWS accounts, you may need to create multiple AWS connectors depending on desired functionality:
    • Cost Visibility: You may need to create one or multiple AWS connectors depending on the availability of consolidated billing. Go to Cost and Usage Reports (CUR) for more information.
    • Resource Inventory Management: You need to create an AWS connector for each account.
    • Optimization by AutoStopping: You need to create an AWS connector for each account.

Cost and Usage Reports (CUR)

  • If you have consolidated billing process enabled, then you need to create only a single CUR for the management account. This provides cost data for all member accounts in the organization.

  • For the Cost Visibility feature alone, you will only need a single AWS connector configured with the management account CUR.

  • In order to take advantage of other features such as Inventory Management and AutoStopping, you need to create a connector for each member account:

    • If you are using the UI to create the additional connectors, configure all connectors with the same management account CUR.
    • If you are using the API to create the additional connectors, you can omit billing information altogether.

Set Up CCM for AWS

To enable CCM for your AWS services (such as EC2, S3, RDS, Lambda, and so on), you simply need to connect Harness to your AWS accounts.

Perform the following steps to connect CCM to the AWS account.

  1. Create a new AWS connector using one of the two options below:
  1. Go to Account Resources > Connectors.
  2. Select + New Connector.
  3. Under Cloud Costs, select AWS.
  1. Perform the following tasks in the AWS Connector wizard.

Overview

  1. Enter the following details and select Continue.
FieldDescription
Connector NameEnter any name for the connector. This name will appear throughout the product to identify this AWS account.
Specify the AWS account IDThe Account ID of the AWS account to connect to. To find your AWS account ID, see Finding your AWS account ID.
Is this an AWS GovCloud account?Select Yes if connecting to a GovCloud account.
note

If you'd like further information about setting up your Cloud Provider, have a read of the Harness 'Set up CCM for AWS' documentation.

Connect CCM For Azure

Set up CCM for Azure

Harness Cloud Cost Management (CCM) monitors the cloud costs of your Azure services. Connect your Azure account and set up Billing Export to get insights into your cloud infrastructure and Azure services such as Storage accounts, Virtual machines, Containers, and so on. CCM also allows you to optimize your instances and AKS clusters using intelligent cloud AutoStopping rules.

info

After enabling CCM, it takes about 24 hours for the data to be available for viewing and analysis.

Prerequisites

  • Make sure that you have the Application Administrator role assigned to your Azure AD. Users in this role can create and manage all aspects of enterprise applications, application registrations, and application proxy settings. See Application Administrator.
  • Many Azure CLI commands act within a subscription. Make sure that you have selected the right subscription before executing the commands. If you need to switch subscription, run: az account set -s <'*'subs id/name'*'> For more information, see Manage Subscriptions.

Azure Connector requirements

  • The same connector cannot be used in NextGen and FirstGen. For information on creating an Azure connector in the FirstGen see Set Up Cost Visibility for Azure.
  • For CCM, Azure connectors are available only at the Account level in Harness.
  • You can create multiple Azure connectors for each Harness Account.
  • You can create multiple Azure connectors per Azure Tenant with unique subscription IDs.
  • If you have separate billing exports for each of your subscriptions in your Azure account, set up separate connectors in Harness to view the cloud cost of all the subscriptions in CCM.

Connect CCM to your Azure Account

Perform the following steps to connect to your Azure account:

  1. Create a new Kubernetes connector using one of the two options below:
  1. Go to Account Resources > Connectors.
  2. Select + New Connector.
  3. Under Cloud Costs, select Azure.
  1. Perform the following tasks in the Azure Connector wizard.

Overview

  1. In the Azure Connector wizard, in the Overview section, enter the following details:
    1. Connector name: Enter a name for the connector.

    2. Azure Tenant ID: Enter the Tenant ID of your Azure AD account. A tenant represents an organization. It's a dedicated instance of Azure AD that an organization or app developer receives at the beginning of a relationship with Microsoft. Each Azure AD tenant is distinct and separate from other Azure AD tenants. To find your tenant ID, do the following:

      1. Launch Microsoft Entra ID (formerly Active Directory).
      2. Copy the tenant ID from the Tenant information.

      The Tenant Information section in Azure

      If you don't find the tenant ID in the Azure console, run the az account show command using the Azure CLI.

    3. Azure Subscription ID: Enter the Azure subscription ID. To find your Subscription ID, do the following:

      1. Launch Azure Cost Management page.
      2. Under Product + services, select Azure subscriptions.
      3. Copy the Subscription ID for your subscription.

      The Cost Management page on Azure

      If you don't find the Subscription ID in the Azure console, you can use Azure CLI. See List your Azure subscriptions with CLI.

    4. Description (optional): Enter a brief description that conveys the purpose of this connector.

    5. Tag (optional): Enter text to create a tag for this connector.

  2. Select Continue.
note

If you'd like further information about setting up your Cloud Provider, have a read of the Harness 'Set up CCM for Azure' documentation.

Set Up CCM For GCP

Harness Cloud Cost Management (CCM) monitors the cloud costs of your GCP products, projects, SKUs, and location. As a first step, you need to connect Harness to your GCP account to get insights into your cloud infrastructure, and GCP services, Compute Engine, Cloud Storage, BigQuery, etc. CCM offers a wide range of features to track and control costs associated with your cloud resources.

☆ NOTE — After enabling CCM, it takes about 24 hours for the data to be available for viewing and analysis.

Before you begin

  • The same connector cannot be used in NextGen and FirstGen. For information on creating a GCP connector in the FirstGen see Set Up Cost Visibility for GCP.
  • Review Required permissions and roles to create an IAM role at the organization level
  • Ensure that you have the following permissions to enable and configure the export of Google Cloud billing data to a BigQuery dataset:
    • Billing Account Administrator role for the target Cloud Billing account
    • BigQuery User role for the Cloud project that contains the BigQuery dataset that will be used to store the Cloud Billing data

Connect Harness to Google Cloud Platform (GCP) Account

☆ NOTE — Time periods in the GCP Cloud Billing report use the Pacific Time Zone (PST) and observe daylight saving time shifts. However, Harness CCM explorer uses the UTC time zone. You may notice some cloud cost differences between Harness CCM explorer and the GCP Cloud Billing report due to the time zone difference.

  1. Create a new Kubernetes connector using one of the two options below:
  1. Go to Account Resources > Connectors.
  2. Select + New Connector.
  3. Under Cloud Costs, select GCP.
  1. Perform the following tasks in the GCP Connector wizard.

Overview

  1. In Overview, in Connector Name, enter a name that describes this account.
  2. In Specify Project ID, enter the project ID and select Continue. For more information on how to get a project ID, go to Create a BigQuery dataset.
note

If you'd like further information about setting up your Cloud Provider, have a read of the Harness 'Set up CCM for GCP' documentation.

Set Up CCM For Kubernetes

Prerequisites

Make sure you have the following set up before you create a Kubernetes connector for CCM:

  • Kubernetes cluster: You need a target Kubernetes cluster for the Harness Delegate and deployment. Make sure your cluster meets the following requirements:
    • Number of nodes: 2

    • vCPUs, Memory, Disk Size: 4vCPUs, 16GB memory, 100GB disk. In GKE, the e2-standard-4 machine type is enough for this quickstart.

    • Networking: outbound HTTPS for the Harness connection to app.harness.io, github.com, and hub.docker.com. Allow TCP port 22 for SSH.

    • Kubernetes service account with permission to create entities in the target namespace is required. The set of permissions should include listgetcreate, and delete permissions. In general, the cluster-admin permission or namespace admin permission is enough.
      For more information, see User-Facing Roles from Kubernetes.

note

You must not rename the cluster. If you're setting up a new connector with this cluster, it is identified by the clustername. Renaming the cluster results in duplicate entries in the dashboard.

  • Delegate size: Your Kubernetes cluster must have unallocated resources required to run the Harness Delegate workload:

    • Laptop - 2GB memory, 0.5CPU
    • Small - 4GB memory, 1CPU
    • Medium - 8GB memory, 2CPU
    • Large - 16GB memory, 4CPU
warning
  • These sizing requirements are for the Delegate only. Your cluster will require more memory for Kubernetes, the operating system, and other services. Ensure that the cluster has enough memory, storage, and CPU for all of its resource consumers.
  • We recommend using one delegate per cluster and Large size delegates for production clusters for optimal performance.
  • Delegate permissions: You can choose one of the following permissions for CCM:

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 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 Cost Management) anywhere on the K8s cluster where the Delegate is installed.

  • Metrics Server: Metrics Server must be running on the Kubernetes cluster where your Harness Kubernetes Delegate is installed. Before enabling CCM for Kubernetes, you must make sure the utilization data for pods and nodes is available.
info

Metrics Server is installed by default on GKE and AKS clusters; however, you need to install it on the AWS EKS cluster.

The Metrics Server is a cluster-wide aggregator of resource usage data. It collects resource metrics from kubelets and exposes them in the Kubernetes API server through Metrics API. CCM polls the utilization data every minute on the Delegate. The metrics are aggregated for 20 minutes and then CCM keeps one data point per 20 minutes. For more information, see Installing the Kubernetes Metrics Server from AWS.
To install the metrics server on your EKS clusters, run the following command:

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.5.0/components.yaml  

Resources can be adjusted proportionally based on number of nodes in the cluster. For clusters exceeding 100 nodes, allocate the following additional resources:

  • 1m core per node
  • 2MiB memory per node

Connect Your Kubernetes Cluster to CCM

Perform the following steps to connect your Kubernetes cluster to CCM.

  1. Create a new Kubernetes connector using one of the two options below:
  1. Go to Account Resources > Connectors.
  2. Select + New Connector.
  3. Under Cloud Costs, select Kubernetes.
note

If you'd like further information about setting up your Cloud Provider, have a read of the Harness 'Set up CCM for Kubernetes' documentation.