Classic Container Cost Reports
Configure Container Infrastructure for Cost Analysis
The rapidly changing workload requirements in a containerized environment make it difficult to track the cost of shared resources for the delivery of business functionality. It is particularly challenging to identify and collate the costs of all the underlying cloud resources that are required in delivering and supporting a business functionality. As a result, organizations face challenges in attributing usage and cost to specific teams and departments, making it harder to track budgets and define governance.
How Tanzu CloudHealth Approaches Container Cost Allocation
In the platform, the approach for allocating the costs of containerized tasks is as follows:
- The underlying hardware resources that make up your containerized environment are considered as shared assets.
- The costs of the shared assets are allocated to the containerized tasks that consume them, with the allocation being proportional to consumption of the underlying shared resources by the workloads.
How to Organize Container Infrastructure
In the platform, organize your container assets and tasks using Perspectives. The goal of this organization is to map specific container tasks to the container assets where those tasks are run.
Overview
- Gather the hardware supporting your clusters into one or more Perspective Groups. Include dedicated compute and storage resources as well as shared resources.
- Gather containerized workloads into meaningful Perspective Groups. It is not necessary for this Group to belong to the same Perspective that contains the previous Group of hardware resources.
- Define one or more container cost distribution rules to allocate the cost of the hardware Groups to workload Groups. Define multiple rules for more fine-grained control over the allocation.
Step 1: Group Container Assets by Cluster
Group assets such as AWS services, Azure services, and Data Center assets that are associated with container clusters. For example, if you have one or more EC2 Instances dedicated to a specific container cluster, create a Perspective Group that gathers those EC2 Instances.
If you have already grouped your container assets by cluster, use those Perspective Groups.
- Navigate to select Setup > Perspectives. Then click New Perspective.
- Name and describe the Perspective. Then click Create Perspective & Start Building.
- In the Perspective Editor, select an Asset Type from the dropdown.
- Select a field you want to use for categorization. The dropdown indicates not only what fields you can use but also the quality of categorization.
- Click Categorize. Results that fulfill the filter criteria appear.
-
Click Add All as Dynamic Rule to create multiple Groups at the same time. This example shows how to gather AWS assets that are tagged with KubernetesCluster
. This tag has one of four possible values:
us1.prod.cloudhealthtech.com
us1.dev.cloudhealthtech.com
us1.staging.cloudhealthtech.com
us2.dev.cloudhealthtech.com
Each organization tags and categorizes container clusters differently. Use metadata that is specific to your organization so that you can gather container clusters in the most efficient way.
- Wait 24 hours for these Perspective Groups to get integrated into reports.
Step 2: Group Tasks Running in Container Clusters
Group the tasks that are running in your container clusters. Select a categorization approach that returns a manageable number of tasks.
You can create these Groups in a new Perspective or in the same Perspective as the one you created in Step 1.
- In the Perspective Editor, from the Asset Type dropdown, select Kubernetes Task. Select a field to use for categorization. Example approaches for grouping container tasks:
- If you already associate your tasks with Task Namespaces using a tag such as Task_Namespace, use this metadata to group your container tasks. You can also use the specific namespace label to group your container tasks.
- If you tend to run tasks in specific clusters, group tasks by Cluster.
- Click Categorize. Results that fulfill the filter criteria appear.
-
Click Add All as Dynamic Rule to create multiple Groups at the same time.
The Browse Assets section for each Group is empty, because this Group only represents tasks or business logic, not physical assets that run those tasks.
Step 3: Distribute Container Costs
Create one or more container cost distribution rules to allocate the cost of the hardware Groups to workload Groups. See Reallocate Cluster Costs.
Reallocate Cluster Costs
To reallocate cluster costs in the Tanzu CloudHealth platform, create a cost distribution rule.
Create a Cost Distribution Rule
- Navigate to Setup > Containers > Cost Distribution. Then click New Ruleset.
- Name and describe the ruleset.
- Expand the From Perspective dropdown and select the source perspective from which you want to reallocate costs.
- In the Rules section, click Add Rule and configure the rule as follows:
- From Perspective Group: Select the source for reallocation.
- To Perspective: Select the destination for reallocation.
- (Optional) Cluster Scope: To limit the distribution scope, select a cluster. If no cluster is selected, the cost is distributed to all container groups within the perspective.
- Distribution Method: Select the distribution method. You can select all CPU, all memory, or a custom distribution that will allow you to select a mix of CPU and memory.
- Repeat the previous step to add more rules, if needed.
Container Cost Reports
Navigate to Reports > Containers > Cost History to access the Container Cost History report. You can select your preferred Cost Distribution Rule from the dropdown selector.
Container Cost by Namespace
Report Settings:
- Interval: Monthly
- X-Axis: Monthly
- Y-Axis: Cost ($)
- Category: Perspective of Container Namespaces