Demystifying Kubecost with EKS cluster

Demystifying Kubecost with EKS cluster

In Cloud & Devops community I got multiple inspirations on a daily basis from many folks . But there are few special ones , who really spot on . Amongst them Mathesh M .

In this article we will walk through and understand the below topic towards cost optimization of EKS cluster which is most critical part from the enterprises prospective . So why wait , let's get started


  • What is eksdemo ?
  • What is Kubecost ?
  • How its eks demo relate with Kubecost ?
  • End to End demo of Kubecost by spinning up a EKS cluster via eksdemo command line tool on top of eksctl tool .


What is eksdemo ?

It's a command line tool to spin up EKS cluster manage , monitor just like eksctl . It's incorporated by AWS within its community and then developing things . Hopefully we will seen more improvements and enhancements towards eksdemo going forward .

What is Kubecost ?

Kubecost is a powerful tool used to track , monitor and notify EKS cluster admins , DevOps folks for underutilized , unused pods , nodes towards Cost optimization . Kubecost provides real-time cost visibility and insights for teams using Kubernetes, helping you continuously reduce your cloud costs.


Image Courtesy : @Mathesh M

How eksdemo relate with Kubecost ?

Eksdemo is like kubectl which is a command line tool to create , manage , isolate or delete EKS clusters which by the assistance with CloudFormation (IaaC) the EKS cluster creation can be automated .

Another significant feature in kubecost is that it comes pre-configure with Prometheus ,so metric collection and customise Dashboard can be in tandem with KubeCost . It's act as a centralized platform for all of our enterprises to manage multiple EKS cluster and huge no of nodes and pods at scale . It's also comes with Free & Paid version .

End to End demo of Kubecost by spinning up a EKS cluster via eksdemo command line tool .

For Linux:

wget https://github.com/awslabs/eksdemo/releases/download/v0.15.0/eksdemo_Linux_x86_64.tar.gz        

  • Extract the tar file using the below command.

tar -xvf eksdemo_Linux_x86_64.tar.gz        

  • Move the binary file to the /usr/local/bin directory.

sudo mv eksdemo /usr/local/bin/        

  • Now, you can verify the installation by running the below command:

eksdemo version        

  • Create the EKS cluster

eksdemo create cluster -c <cluster-name>
# The above command will create the EKS Cluster with the default configurations. Also one thing to mention, as I told earlier, eksdemo is built on top of eksctl. So behind the scenes, it will use the eksctl to create the EKS Cluster.        

  • You can verify the EKS Cluster creation by running the below command:

eksdemo get cluster        


  • You can also explore the AWS Console to see the EKS Cluster details and the resources provisioned for the EKS Cluster.

Now prior to install the Kubecost we require EBS CSI Driver . Additionally if you are installing Kubecost using Helm , then please read the following notes .


So from the above notes we should have Helm and EBS CSI driver installed in the EKS cluster .

  • Run the below command to install the EBS CSI Driver in the EKS cluster with IAM roles and policies to interact with EKS cluster . Following are the pods created regarding the same by executing the below commands
  • kubectl get pods -n kube-system

eksdemo install storage-ebs-csi -c Eksdemocluster        

Installing Kubecost :-

As previously highlighted that Kubecost pre-configure comes with Prometheus , hence you can view all of the pods both for Kubecost & Prometheus .Because for collecting the metrics, Kubecost uses the Prometheus behind the scenes.

If you already have the Prometheus installed in your EKS cluster, you can skip the --node-exporter flag.

eksdemo install kubecost-eks-amp -c <cluster-name> --node-exporter        

The command also create a Load balancer to expose the service and access the Kubecost Dashboard from web by running the Load balancer URL .

kubectl get svc -n kubecost        

  • You have to copy the LoadBalancer service URL and open it in the browser with Port 9090. You will see the Kubecost dashboard like below :-

Let's now navigate to some of the features by some useful snippets ,which will ease things about Kubecost .


Savings :- It can displayed an approximate Savings on EKS clusters with all recommendations in multiple areas from pods to nodes .


The Allocation feature also provide cumulative cost by namespace . So if my EKS cluster setup by any namespace. We can optimize the cost based on Namespace as well which will an impact of a Microservices feature .

Alerts Toggle :- In the top right hand Alerts icon can be notify users , administrators who are monitoring Kubecost on daily basis .



Lastly under Contexts we can switch clusters from one to another through Kubecost UI .

Also you might be interested in Reporting and sharing with multiple stakeholders .

This concludes the End to End walk through of Kubecost which facilitates the comprehensive cost monitoring of metrics back by Prometheus and play a significant role in Enterprise towards Kubernetes cost monitoring and reduction towards Application transformation journey .

要查看或添加评论,请登录

社区洞察

其他会员也浏览了