In EKS Fargate, how can you tag the costs related to Fargate?

1.1k Views Asked by At

We have an 'application' tag on our EKS cluster and fargate profile. We also have a k8s label 'application' on the pod. When we look in the cost explorer, the costs related to fargate (for example EU-Fargate-vCPU-Hours:perCPU (Hrs)) don't seem to be linked to the application tag.

Has anyone been able to link EKS fargate costs to a specific tag in cost explorer?

2

There are 2 best solutions below

0
On BEST ANSWER

Kubernetes (EKS) tags are different from AWS native tags they don't get propagate to take advantage of cost allocation techniques. We hear this often from customer and it's something we are considering.

0
On

(Adding an updated answer, since AWS and Kubecost collaborated on a slightly improved solution that was announced Aug 25th, 2022, which was after the original answer.)

From what I can tell, there's a degree of turnkey support for a degree of big picture aggregate cost at a cluster level granularity:

There's also a degree of support for workload level cost tracking (pod/namespace level granularity), but it's not turnkey, nor integrated into AWS billed cost tracking service:
https://docs.aws.amazon.com/eks/latest/userguide/cost-monitoring.html
mentions that in a default installation of the kubecost add-on for EKS. It'll install prometheus and store kubernetes workload (pod/namespace level granularity) cost tracking data in prometheus, and make it available from a kubecost specific web app GUI hosted on EKS.

If you keep reading that page has 2 interesting entries in its FAQs.

(both Q&A below are copied from the above linked url)

  • FAQ-Q: "Can Kubecost track costs for Amazon EKS on AWS Fargate?
    FAQ-A: Kubecost provides best effort to show cluster cost visibility for Amazon EKS on Fargate, but with lower accuracy than with Amazon EKS on Amazon EC2. This is primarily due to the difference in how you're billed for your usage. With Amazon EKS on Fargate, you're billed for consumed resources. With Amazon EKS on Amazon EC2 nodes, you're billed for provisioned resources. Kubecost calculates the cost of an Amazon EC2 node based on the node specification, which includes CPU, RAM, and ephemeral storage. With Fargate, costs are calculated based on the requested resources for the Fargate Pods."
  • FAQ-Q: "Can I integrate Kubecost with AWS Cost and Usage Report for more accurate reporting?
    FAQ-A: Yes. You can configure Kubecost to ingest data from AWS Cost and Usage Report to get accurate cost visibility, including discounts, Spot pricing, reserved instance pricing, and others. For more information, see AWS Cloud Integration in the Kubecost documentation." https://docs.kubecost.com/install-and-configure/install/cloud-integration/aws-cloud-integrations#aws-cloud-integration
    https://github.com/kubecost/poc-common-configurations/tree/main/aws

My interpretation of the above 2 FAQs summarizes to:

  1. kubecost is limited in its ability to accurately track workload level costs backed by Fargate.
  2. It mentions your costs tracking can become more accurate by integrating with CUR (cost usage reporting) of AWS billing, but from what I could gather from skimming and not reading closely, is that kubecost can't export its cost data into AWS billing reports. It's more that kubecost can import from AWS billing reports to increase the accuracy/granularity of kubecost's reports.
    (It would have been nice if instead the accuracy/granularity of the AWS managed service got improved, but I don't think it works that way.)