You can bind tags to Elastic Container Instance resources such as elastic container instances, image caches, and virtual nodes (VNodes) as needed. Then, you can manage enterprise ledgers based on tags. This topic describes how to query split bills of an enterprise on demand based on tags.
Bind tags to Elastic Container Instance resources
Tags are similar to labels in Kubernetes in terms of features. Tags are used to mark Elastic Container Instance resources that have the same management or business requirements. This facilitates subsequent classification management and filtering operations. The following table describes the Elastic Container Instance resources to which you can bind tags:
Scenario | Resource | References |
Add tags in the Elastic Container Instance console or by calling an API operation | Elastic container instances | |
Image caches | ||
VNodes | Manually deploy a VNode in a self-managed Kubernetes cluster | |
Add tags by adding annotations to Kubernetes clusters | Elastic container instances |
By default, the following tags are added to the elastic container instances that are created by using Container Service for Kubernetes:
ManagedBy: the type of the cluster.
ClusterId: the cluster ID.
NameSpace: the namespace of the cluster.
OwnerReferenceKind: the type of the workload that is created in the cluster, such as Deployment and Job.
OwnerReferenceName: the name of the workload that is created in the cluster, such as Deployment name and Job name.
PodName: the name of the pod.
Query split bills based on tags
Log on to the Elastic Container Instance console.
In the top navigation bar, click Expenses to go to the Expenses and Costs console.
In the left-side navigation pane, choose
.Enable cost allocation tags.
The first time you enable cost allocation tags
On the Cost allocation tags page, read the description of tags and click Next.
Select a tag that you want to enable, click ">" to move the tag to the Selected Tags list, and then click Next.
Click Enable.
You previously enabled cost allocation tags
To enable a single tag, find the tag and click Enable in the Operations column.
To enable multiple tags at a time, select the tags and click Batch Enable in the lower part of the page.
NoteTags are case-sensitive. If a large number of tags are displayed in the list, you can search for tags by key.
In the left-side navigation pane, choose
. You can allocate resources to cost centers by tag.Add a cost center.
In the left-side navigation pane of the Cost Centers page, click the "+" icon next to Cost Center.
In the Add Cost Center dialog box, enter a name for the cost center and click OK.
Allocate resources to the cost center.
In the left-side navigation pane of the Cost Centers page, click All Resources.
In the Tag column of the resource list on the right, click the filter icon. In the dialog box that appears, select the tags that you enabled and click OK.
Select Elastic Container Instance resources from the filter results and click Allocate. In the Allocate dialog box, select the cost center that you added and click OK.
In the left-side navigation pane, choose
. On the Split Bill page, filter and view split bills by cost center.NoteThe first time you use the split bill feature, follow the on-screen instructions to enable the feature.
In the left-side navigation pane, choose Cost Management > Cost Analysis. Filter costs by cost center and tag to view the cost analysis.
NoteThe first time you use the cost analysis feature, follow the on-screen instructions to enable the feature.
On the Cost Analysis page, the display mode of charts varies based on the value of Category. The filters that you select from the Filters section on the right filter the data that you want to view. For example, you can select Instance Tag from the Category drop-down list, and then select the tags that you want to view in the Filters section. This way, you can view the cost details of the resources to which the tags are added.