Hello world to Lens and kubecost

Xin Cheng
2 min readNov 13, 2021

--

FinOps has been around for a while for public cloud, but recently Kubernetes FinOps has risen to my attention. If your organization manage multiple Kubernetes clusters and allow application developers to create containerized applications, cost optimization questions will finally come. But, first, you need visibility into what is happening to be able to take actions (that’s what observability over monitoring).

One popular solution for Kubernetes cost management is kubecost. This article will quickly go through a kubecost deployment using another popular IDE called Lens (another cloud be VSCode Kubernetes plugin).

Deploy kubecost

I use docker desktop on Mac for a quick local Kubernetes cluster to test. After fixing the issue below, I am able to start local Kubernetes with the Docker desktop.

(renaming the ~/Library/Group Containers/group.com.docker/pki directory.)

It also should add a docker-desktop context in local kubeconfig. In Lens, connect to it, then add k8s namespace called kubecost.

By default, Lens only has jfrog helm repo added. You need to add helm repo for kubecost, go to
Preferences | Kubernetes | Helm charts
kubecost
https://kubecost.github.io/cost-analyzer/

in Lens UI, click Apps/Charts, click cost-analyzer chart, install, change namespace to kubecost just created.

After the port-forward command in the main deployment article, you can visit http://localhost:9090 to view cost metrics shown in the article.

Interestingly, kubecost uses Thanos to provide durable storage for Prometheus (trend to use cloud object storage as backing store for Kubernetes persistent volumes).

--

--

Xin Cheng
Xin Cheng

Written by Xin Cheng

Multi/Hybrid-cloud, Kubernetes, cloud-native, big data, machine learning, IoT developer/architect, 3x Azure-certified, 3x AWS-certified, 2x GCP-certified

No responses yet