Orchestration

Kubecost Tutorial: A Getting Started Guide

Kubecost is an enterprise-grade application designed to monitor and manage Kubernetes spend. The installation process involves using the Kubecost Helm chart repository. This is a step-by-step tutorial on getting started with Kubecost by installing the Helm chart, drawing directly from the provided sources.

Tutorial: Getting Started with Kubecost Installation

This tutorial details how to install the latest stable version of Kubecost using Helm.

Prerequisites

Before beginning, ensure you have:

  1. A running Kubernetes cluster.
    • Kubecost 3.0 supports Kubernetes versions from 1.29 to 1.34.
  2. Helm installed on your local machine or access environment.

Step 1: Install the Latest Stable Version via a Single Command

The quickest way to install Kubecost is by running a single helm install command. This method automatically adds the repository and installs the chart into a new namespace.

Crucially, you must set a cluster ID using the --set global.clusterId flag during installation. Replace someclustername with a descriptive name for your cluster:

helm install kubecost \
  --repo https://kubecost.github.io/kubecost kubecost \
  --namespace kubecost --create-namespace \
  --set global.clusterId=someclustername

Step 1 (Alternative): Install by Adding the Repository

If you prefer to manage your Helm repositories separately, you can add the Kubecost repository first:

  • Add the Repository:
helm repo add kubecost https://kubecost.github.io/kubecost/

  • Update Repository List:
helm repo update

  • Install the Chart:
helm install kubecost kubecost/kubecost -n kubecost --create-namespace

Step 2: Verification and Post-Installation Notes

Once installed, Kubecost will immediately begin processing data.

  1. Data Re-ingestion: Because recent versions (like 3.0) use the ClickHouse database, a complete re-ingestion of data will begin.
    • This process can take anywhere from 20 minutes to 2 days, depending on the size of the dataset and the performance of the storage backing the Persistent Volume.
    • During this time, the UI will be available but will display a progress indicator.
    • Data is imported backwards in time until the full history is available.
  2. Accessing Configuration Values: If you need to verify or inspect configuration settings for the specific version you installed (e.g., 3.0.3), you can use helm show values:
helm show values kubecost/kubecost --version 3.0.3

Step 3: Uninstalling Kubecost (Cleanup)

If you need to remove Kubecost from your cluster, follow these steps:

  1. Uninstall the Chart:
helm uninstall kubecost -n kubecost

Note: This command uninstalls the application but does not delete the persistent volume storing the Kubecost metrics.

  1. Manually Delete Metrics Volume (Optional but Recommended): To delete the persistent volume and completely clean up the deployment, you must delete the namespace: kubectl delete namespace kubecost

Advanced Installation Options

For development or testing purposes, you can install non-stable versions:

Target VersionCommand SnippetNotes
Beta/Release Candidateshelm install kubecost ... --develRequires passing the --devel flag.
Nightly Buildshelm install nightly --repo https://kubecost.github.io/nightly-helm-chart kubecost ...Uses a separate nightly-helm-chart repository.

Leave a Reply

Your email address will not be published. Required fields are marked *