KubeCost — For Better Cost Efficiency

Aymen Abdelwahed
uleap
Published in
4 min readMar 4, 2023

--

Cloud changed the Dynamics; Engineers are spending more money with code while having less visibility and low predictability on Finance. They are just not aware! Costs could go higher than expected till the time the organization hits a Bill-Shock!

Too late to react! Pay the bill, Then analyze and improve…

How to tackle Volatile Cloud spending!

Cost Control — A significant challenge

It has always been a challenge for DevOps teams to provide insights/visibility on costs and chargebacks, mainly on Kubernetes-related workloads, and ensure advanced control of usage/cost optimizations. Adding to that, the frequent changes in infrastructure create more room for inaccuracies in cost calculations.

Customers who are more cautious about cost optimizations are always looking for a granular level of cost details. Unfortunately, this kind of data is not available OOTB for Kubernetes; This is where KubeCost comes in handy and shines (Well, not that far!).

KubeCost: A full cost transparency to empower innovation while driving budget accountability.

Today’s agenda covers the following:

Summary:
- KubeCost in a Nutshell
- KubeCost - Architecture & Concepts
- KubeCost - Key Features

KubeCost in a Nutshell

While KubeCost could simplify Kubernetes spending management, do not expect it to be the answer for changing teams’ mindset toward effective cost management. It is just a facilitator instrument.

KubeCost is offered as Open-Source and Commercial variants.

The open-source variant has a very limited set of features compared to the commercial one; “The latter is not in our scope ”

KubeCost — CNCF Landscape

KubeCost is an open-source cost management, introduced to the CNCF four years ago and is backed by a good community behind.

CNCF Landscape — KubeCost Project description

Architecture & Concepts

KubeCost assists in building spending efficiencies for Kubernetes clusters and workloads. It supports Kubernetes distributions from v1.8 onwards.

The solution focuses on three areas, as described below:

  • “spending visibility,”
  • “Insights/optimizations”,
  • and “Governance”.
KubeCost — Better FinOps for Kube clusters

KubeCost’s “Spend visibility” is a single pane of glass joining all real-time cost monitoring data of the Kubernetes clusters and their associated resources, including storage, networking, and more.

Based on the acquired data and metrics, dynamic recommendations are established by KubeCost's “Insights & optimizations” to control better and thus reduce the platform-related fees without sacrificing reliability/availability.

KubeCost’s “Governance” feature enables report generation and alert management.

Components

KubeCost has several components described, clarified, and linked together in the high-level overview below:

KubeCost — High-Level Overview

The KubeCost-pod includes several containers running side by side, such as:

  • FrontEnd container, providing an Nginx app server (UI Console)
  • Cost model calculation container,
  • and a Rest API endpoint for Kubecost.

The solution includes an optimized version of Prometheus for storing whatever captured information.

The data, captured from a number of DaemonSets, includes metrics such as "How many pods are running per VM/Instance/Node?", "How long are they running?", "How much CPU are they charging?" and "How much Network bandwidth do they consume?". Those DaemonSets could act as either Node-Exporter, cAdvisor, Network-Metric, or KubeSubMetrics, and periodically route information to KubeCost.

A caching mechanism is also part of the architecture, offloading KubeCost from data-visualization processing and cost calculation, and thus enables better performance and higher solution reliability.

KubeCost — Key Features

KubeCost’s key features and capabilities are mainly focused on cost transparency and management on Kubernetes by taking into consideration CPU, memory, and storage-related costs. The Cost visibility could be defined using resource labels, annotations, namespaces, and more. The Cost optimizations and Node Sizing recommendations are made available across different Kubernetes entities, which can go even granular to a namespace or resource-based cost visibility.

The solution comes with built-in support for different Cloud Providers, including solutions such as, but not limited to, ‘AWS Cost Utilisation Report’ and ‘Athena’.

KubeCost offers the ability to define real-time budget alerts (cluster- or namespace-based), which can be configured to trigger automatic notifications.

To Conclude — The association with FinOps.

KubeCost could assist in leveraging FinOps practices by providing the missing insights on Kubernetes-related workloads and thus bringing back businesses to control the costs of apps running in K8s.

--

--

Aymen Abdelwahed
uleap
Editor for

Is a Cloud-Native enthusiast with 14 plus years of experience. He’s continuously immersing himself in the latest technology trends & projects.