Implementing Chargeback/Showback for multi-tenant clusters¶
As organizations embrace multi-tenancy i.e. share clusters among applications/teams to reduce cluster sprawl and spend, it is imperative that granular resource utilization metrics are collected and aggregated from their clusters. Tracking and reporting costs on a per application/team basis (referred to as chargeback/showback) is essential for a number of reasons including:
- Billing internal teams/applications (their cost center IDs) based on their consumption
- Gaining visibility into the cost structure to determine inefficiencies and drive cost optimization exercises
- Forecasting future spend
Rafay's integrated Cost Management solution makes it extremely simple for customers to standardize collection of metrics in a consistent manner across clusters (cloud, on-premise) and implement chargeback/showback models.
Guide for Success¶
Step 1: Process/methodology to identify resources belonging to teams/applications
It is important as a first step to put together a process to determine how resources running on a cluster can be identified and mapped to a team/application. Appropriate policies can then be configured to ensure that resources (e.g. namespaces) are always tagged with the right labels.
Rafay's integrated OPA Gatekeeper solution can be leveraged to ensure that resources are deployed with appropriate labels.
Step 2: Apportion costs for Unallocated Resources
There are resources on the cluster that are unused, the costs of which need to be divided among the tenants sharing the cluster. This can be done proportionately (based on tenant usage) or equally among the tenants.
Step 3: Apportion costs for Common Services
There could be services running on the clusters that are "common/shared" to/among the different tenants (teams or applications) using the clusters. Examples include security and monitoring tool. It is important to track the costs for running such services and apportion those appropriately.
Step 4: Consolidation
Some customers also want to take costs for non-K8s resources, personnel, licensing into consideration. This step is to consolidate all those with costs for K8s resources.
Implementing Chargeback/Showback with Rafay¶
Rafay's integrated cost management solution provides out of box options for creating chargeback/showback groups and generating reports. - Chargeback/showback groups can be a combination of projects, clusters, namespaces and labels (pod, namespace etc.) - Two types of reports can be generated - Summary and Detailed. Summary reports have been tailored for a FinOps type persona and allows aggregation of costs based on Project, Cluster, Namespace or Application/Namespace labels. Detailed reports are tailored towards identifying inefficiencies and includes pod level metrics aggregated per day.
Rafay's integrated Cost Management solution stores hourly metrics for 2 weeks and metrics on a per day basis for 6 months.
A typical customer appends appropriate labels to namespaces (e.g. Cost Center ID, BU identifier) and generates summary reports on an ongoing basis to track spend per team/application. Each line item in the generated report will correspond to a "key-value pair" i.e. each Cost Center ID will have a line item.
It is also possible to automate creation of chargeback groups generate reports via CLI, API and TF.
Rafay's cost management solution also provides in-built options to apportion costs for unallocated resources and common services. Costs can be divided based on usage or equally among tenants.
A recent release added the ability to identify common services (e.g. security tools, monitoring tools) through configuration of namespace list/labels and share the cost of running these common services among tenants (teams/applications) sharing the cluster when generating chargeback/showback reports.
In a subsequent blog post, we will cover how "Cost Explorer" included with Rafay's Cost Management solution can help with "cluster right-sizing" and "application right-sizing" exercises.
If you are interested in learning more about Rafay's "Kubernetes Management" or "Cost Management" offerings,
Sign up for a Free Trial
Schedule a demo of Rafay Cost Management
Reach out if you would us to create and post videos of specific use cases or scenarios related to Cost Management.
Sincere thanks to readers of our blog who spend time reading our product blogs. Please Contact the Rafay Product Team if you would like us to write about other topics.