Integrating with IBM Kubecost

You can maximize the benefits of IBM Kubecost and Instana by enhancing the Kubernetes cluster metrics that are gathered by Instana with cost, allocation, efficiency and savings data obtained from Kubecost.

Instana uses the Kubecost REST APIs to collect these metrics. Both Instana and Kubecost must monitor the same Kubernetes cluster.

Support information

Instana Essentials and Standard (SaaS or Self-hosted) supports Kubecost foundation (Self-hosted) and Enterprise (Cloud or Self-hosted). See the following table for details:

Kubecost Foundations (free) Kubecost Enterprise Self-hosted or Enterprise Cloud (paid)
<250 vCPU/cluster Unlimited clusters
<15 days of data retention Unlimited data retention
Self-hosted deployment SaaS or Self-hosted
No saved reports Saved reports

For more information, see the Kubecost pricing page.

To make sure that the Kubecost sensor is compatible with your current setup, check the following support information sections:

Supported operating systems

The Kubecost sensor supports the same operating systems as the Instana host agent. For more information, see Installing the Instana agent on Kubernetes.

Supported Kubecost versions

The Kubecost sensor supports the latest Kubecost 2.x releases.

Prerequisites

Before you enable the Kubecost sensor, complete the following steps:

  1. Deploy the Instana agent in one or more Kubenetes clusters. For more information, see Installing the Instana agent on Kubernetes.
  2. Deploy Kubecost on the same Kubernetes cluster that the Instana agent is set up to monitor. For more information, see Installation External link icon.
  3. After Kubecost is deployed, add the license key to enable Kubecost to collect usage metrics. For more information, see Adding a Product Key External link icon.
  4. Configure the Instana Kubecost sensor to collect Cost and Allocation metrics from this cluster by following the steps in the next section.

Configuring the Kubecost sensor

Instana collects the cost and allocation data by using the Kubecost REST APIs. To enable and configure the sensor, update the agent configuration file as shown in the following example:

# Kubecost Sensor
com.instana.plugin.kubecost:
 remote:
  - url: '<your-kubecost-address>'
    api_key: '<api-key-reqd-if-auth-enabled>' # Optional: Only required if Kubecost allows only authenticated connections.
    poll_rate: 1800 # seconds
    clusters: # Optional: List of one or more k8s cluster names.
     - 'cluster-one'

Configuration parameters

Table 1. Configuration parameters
Parameter Description
url Kubecost address, example: http://kubecost.demo.xyz
api_key (Optional) Your API key. This key is required if you configured Kubecost to allow only authenticated client requests.
poll_rate The frequency at which the metrics are fetched from Kubecost. The default frequency is 1800 seconds.
clusters (Optional) The list of Kubernetes clusters that are monitored by Kubecost. If specified, Instana pulls cost metrics for these clusters only. If not specified, Instana dynamically fetches cost metrics for all the active clusters in Kubecost.

Cost metrics are displayed in the Instana UI for only the clusters that are monitored by both the Instana agent and Kubecost.

Viewing Cost Metrics

After you enable the Kubecost sensor, you can view the cost-related metrics for the monitored cluster in the Instana UI. To view the metrics, complete the following steps:

  1. Go to Platforms > Kubernetes.
  2. Click the cluster in which Kubecost is deployed, from the list shown in the Clusters tab.
  3. Go to the Cost tab.

You can view the Cost and Allocation metrics captured from Kubecost on the Cost tab.

On the Kubernetes cluster dashboard, you can view the following KPIs:

  1. Total cluster cost
  2. Workload efficiency
  3. Estimated monthly savings

The KPIs are followed by the following sections:

  • Cost
  • Cost by namespace
  • Cost by deployment

The following image displays the total cost of the cluster including the Cluster cost and Idle cost:

“Figure
Total cost

To view detailed usage per namespace, check the Cost by namespace chart and table.

“Figure
Cost by namespace

To view the detailed usage per deployment, check the Cost by deployment chart and table.

“Figure
Cost by deployment

Metrics

The following table outlines the frequency of metric collection by the Kubecost sensor:

Table 2. Metrics
Metric Description
CPU Cost of node CPU attributed to each workload.
GPU Cost of node GPU attributed to each workload.
Network Cost of network egress and ingress attributed to each workload.
Persistent volume Cost of persistent volume storage attributed to each workload.
Load Balancer Cost of load balancers attributed to each workload.
Shared Shared overhead cost attributed to each workload.
Efficiency Cost weighted ratio of RAM and CPU usage to configured RAM and CPU usage.
RAM Cost of node RAM attributed to each workload.
Cost Cost attributed to each workload.
Workload efficiency Cost-weighted ratio of RAM and CPU usage to configured RAM and CPU requests.
Estimated Monthly Savings Estimated monthly savings available for this cluster.

The values shown in the table represent the metrics fetched in the current poll. It does not reflect the cumulative value over a chosen time window.

Kubecost sensor generates built-in events for various scenarios. For more information, see Built-in Events Reference.