Breaking down EKS costs with Kubecost & Opencost
I recently needed to break down our shared EKS (Kubernetes) cluster costs by product/team.
You can tag AWS resources using the built-in AWS tags and use the AWS Cost Explorer tool.
However, for shared compute resources, like EKS, it's more difficult to get this cost breakdown. The challenge comes from having EKS nodes running multiple teams' workloads on it. How do you attribute who owns what percentage of the node?
You might think you can use Kubernetes labels and annotations, but those don't propagate to EC2 tags.
That's where Kubecost and Opencost come in.
These tools are installed on your Kubernetes cluster and will analyze and give you a breakdown of costs by namespace, product, service, etc. as a percentage of the cost of the node.