Skip to content

Commit ad21299

Browse files
committed
Improve docs for Kubecost
1 parent 05fa6a4 commit ad21299

5 files changed

+57
-106
lines changed

latest/ug/cluster-management/cost-monitoring-kubecost-bundles.adoc

+2-6
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,13 @@ Yes. `Kubectl-cost` is an open source tool by Kubecost (Apache 2.0 License) that
314314

315315
Kubecost provides a web dashboard that you can access through `kubectl` port forwarding, an ingress, or a load balancer. You can also use the {aws} Load Balancer Controller to expose Kubecost and use Amazon Cognito for authentication, authorization, and user management. For more information, see link:containers/how-to-use-application-load-balancer-and-amazon-cognito-to-authenticate-users-for-your-kubernetes-web-apps[How to use Application Load Balancer and Amazon Cognito to authenticate users for your Kubernetes web apps,type="blog"] on the {aws} blog.
316316

317-
*Is Amazon EKS Anywhere supported?*
318-
319-
No.
320-
321317
[#kubecost-additional]
322318
== Additional Kubecost Features
323319

324320
* The following features are available in both Kubecost v1 and v2.
325-
* *Export cost metrics* – Amazon EKS optimized cost monitoring is deployed with Kubecost and Prometheus, which is an open-source monitoring system and time series database. Kubecost reads metric from Prometheus and then performs cost allocation calculations and writes the metrics back to Prometheus. The Kubecost front-end reads metrics from Prometheus and shows them on the Kubecost user interface. The architecture is illustrated in the following diagram.
321+
** *Export cost metrics* – Amazon EKS optimized cost monitoring is deployed with Kubecost and Prometheus, which is an open-source monitoring system and time series database. Kubecost reads metric from Prometheus and then performs cost allocation calculations and writes the metrics back to Prometheus. The Kubecost front-end reads metrics from Prometheus and shows them on the Kubecost user interface. The architecture is illustrated in the following diagram.
326322
+
327323
image::images/kubecost-architecture.png[Kubecost architecture,scaledwidth=100%]
328324
+
329325
With https://prometheus.io/[Prometheus] pre-installed, you can write queries to ingest Kubecost data into your current business intelligence system for further analysis. You can also use it as a data source for your current https://grafana.com/[Grafana] dashboard to display Amazon EKS cluster costs that your internal teams are familiar with. To learn more about how to write Prometheus queries, see the https://opencost.io/docs/installation/prometheus/[Prometheus Configuration]``readme`` file on GitHub or use the example Grafana JSON models in the https://github.com/kubecost/cost-analyzer-helm-chart/tree/develop/cost-analyzer[Kubecost Github repository] as references.
330-
* *{aws} Cost and Usage Report integration* – To perform cost allocation calculations for your Amazon EKS cluster, Kubecost retrieves the public pricing information of {aws} services and {aws} resources from the {aws} Price List API. You can also integrate Kubecost with *{aws} Cost and Usage Report* to enhance the accuracy of the pricing information specific to your {aws} account. This information includes enterprise discount programs, reserved instance usage, savings plans, and spot usage. To learn more about how the {aws} Cost and Usage Report integration works, see https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=integrations-aws-cloud-billing-integration[{aws} Cloud Billing Integration] in the Kubecost documentation.
326+
** *{aws} Cost and Usage Report integration* – To perform cost allocation calculations for your Amazon EKS cluster, Kubecost retrieves the public pricing information of {aws} services and {aws} resources from the {aws} Price List API. You can also integrate Kubecost with *{aws} Cost and Usage Report* to enhance the accuracy of the pricing information specific to your {aws} account. This information includes enterprise discount programs, reserved instance usage, savings plans, and spot usage. To learn more about how the {aws} Cost and Usage Report integration works, see https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=integrations-aws-cloud-billing-integration[{aws} Cloud Billing Integration] in the Kubecost documentation.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
include::../attributes.txt[]
2+
3+
[.topic]
4+
[#cost-monitoring-kubecost-dashboard]
5+
= Access Kubecost Dashboard
6+
7+
[#kubecost-prereqs-dashboard]
8+
== Prerequisites
9+
10+
. Make sure the kubecost related Pods' state are "Running".
11+
12+
[source,bash,subs="verbatim,attributes"]
13+
----
14+
kubectl get pods --namespace kubecost
15+
----
16+
17+
[#kubecost-dashboard]
18+
== Access Kubecost Dashboard
19+
20+
. On your device, enable port-forwarding to expose the Kubecost dashboard.
21+
+
22+
[source,bash,subs="verbatim,attributes"]
23+
----
24+
kubectl port-forward deployment/kubecost-cost-analyzer 9090 --namespace kubecost
25+
----
26+
+
27+
Alternatively, you can use the <<aws-load-balancer-controller,{aws} Load Balancer Controller>> to expose Kubecost and use Amazon Cognito for authentication, authorization, and user management. For more information, see link:containers/how-to-use-application-load-balancer-and-amazon-cognito-to-authenticate-users-for-your-kubernetes-web-apps[How to use Application Load Balancer and Amazon Cognito to authenticate users for your Kubernetes web apps,type="blog"].
28+
. On the same device that you completed the previous step on, open a web browser and enter the following address.
29+
+
30+
[source,bash,subs="verbatim,attributes"]
31+
----
32+
http://localhost:9090
33+
----
34+
+
35+
You see the Kubecost Overview page in your browser. It might take 5–10 minutes (or more) for Kubecost to gather metrics, depends on your cluster size. You can see your Amazon EKS spend, including cumulative cluster costs, associated Kubernetes asset costs, and monthly aggregated spend.
36+
+
37+
. To track costs at a cluster level, tag your Amazon EKS resources for billing. For more information, see <<tag-resources-for-billing>>.
38+
39+
40+
* *Cost allocation* – View monthly Amazon EKS costs and cumulative costs for each of your namespaces and other dimensions over the past seven days. This is helpful for understanding which parts of your application are contributing to Amazon EKS spend.
41+
* *Assets* – View the costs of the {aws} infrastructure assets that are associated with your Amazon EKS resources.

latest/ug/cluster-management/cost-monitoring-kubecost.adoc

+11-99
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ include::../attributes.txt[]
22

33
[.topic]
44
[#cost-monitoring-kubecost]
5-
= Install Kubecost and access dashboard
5+
= Install Kubecost
66
:info_titleabbrev: Install Kubecost
77

8-
Amazon EKS supports Kubecost, which you can use to monitor your costs broken down by Kubernetes resources including Pods, nodes, namespaces, and labels. This topic covers installing Kubecost, and accessing the Kubecost dashboard.
8+
Amazon EKS supports Kubecost, which you can use to monitor your costs broken down by Kubernetes resources including Pods, nodes, namespaces, and labels. This topic covers installing Kubecost, and accessing the Kubecost dashboard.
99

1010
Amazon EKS provides an {aws} optimized bundle of Kubecost for cluster cost visibility. You can use your existing {aws} support agreements to obtain support. For more information about the available versions of Kubecost, see <<cost-monitoring-kubecost-bundles>>.
1111

@@ -18,104 +18,16 @@ Kubecost v2 introduces several major new features. <<kubecost-v2,Learn more abou
1818

1919
For more information about Kubecost, see the https://www.ibm.com/docs/en/kubecost/self-hosted/2.x[Kubecost] documentation and <<cost-monitoring-faq, Frequently asked questions>>.
2020

21+
[#kubecost-overview]
22+
== Install Amazon EKS optimized Kubecost bundle
2123

22-
[#kubecost-addon]
23-
== Install Kubecost using Amazon EKS Add-ons
24+
You can use one of the following procedures to install the _Amazon EKS optimized Kubecost bundle_:
2425

25-
[NOTE]
26-
====
27-
Install Kubecost as an Amazon EKS Add-on and benefit from additional features at no additional cost with the _Amazon EKS optimized Kubecost bundle_. For more information, see <<kubecost-v2>>.
28-
====
29-
30-
Amazon EKS Add-ons reduce the complexity of upgrading Kubecost, and managing licenses. EKS Add-ons are integrated with the {aws} marketplace.
31-
32-
. View link:marketplace/seller-profile?id=983de668-2731-4c99-a7e2-74f27d796173[Kubecost in the {aws} Marketplace console,type="marketing"] and subscribe.
33-
. Determine the name of your cluster, and the region. Verify you are logged into the {aws} CLI with sufficient permissions to manage EKS.
34-
. Create the Kubecost addon.
35-
+
36-
[source,bash,subs="verbatim,attributes"]
37-
----
38-
aws eks create-addon --addon-name kubecost_kubecost --cluster-name $YOUR_CLUSTER_NAME --region $AWS_REGION
39-
----
40-
41-
Learn how to <<removing-an-add-on,remove an EKS Add-on>>, such as Kubecost.
42-
43-
[#kubecost-helm]
44-
== Install Kubecost using Helm
45-
46-
* An existing Amazon EKS cluster. To deploy one, see <<getting-started>>.
47-
* The `kubectl` command line tool is installed on your device or {aws} CloudShell. The version can be the same as or up to one minor version earlier or later than the Kubernetes version of your cluster. For example, if your cluster version is `1.29`, you can use `kubectl` version `1.28`, `1.29`, or `1.30` with it. To install or upgrade `kubectl`, see <<install-kubectl>>.
48-
* https://helm.sh/docs/topics/version_skew/#supported-version-skew[Supported Helm versions] on your device or {aws} CloudShell. To install or update Helm, see <<helm>>.
49-
* Cluster version should be `1.21 (or higher)` and `1.31` is officially supported as of v2. Learn more at https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installation-environment#ariaid-title2[Supported Kubernetes versions].
50-
* If your cluster is version `1.23` or later, you must have the <<ebs-csi,Store Kubernetes volumes with Amazon EBS>> installed on your cluster.
51-
52-
. Determine the version of Kubecost to install. You can see the available versions at https://gallery.ecr.aws/kubecost/cost-analyzer[kubecost/cost-analyzer] in the Amazon ECR Public Gallery. For more information about the compatibility of Kubecost versions and Amazon EKS, see the https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installation-environment[Environment Requirements] in the Kubecost documentation.
53-
. Install Kubecost with the following command. Replace [.replaceable]`KUBECOST_VERSION` with the value retrieved from ECR, such as [.replaceable]`1.108.1`.
54-
+
55-
[source,bash,subs="verbatim,attributes"]
56-
----
57-
export KUBECOST_VERSION="1.108.1"
58-
59-
helm upgrade -i kubecost \
60-
oci://public.ecr.aws/kubecost/cost-analyzer \
61-
--version ${KUBECOST_VERSION} \
62-
--namespace kubecost --create-namespace \
63-
-f https://raw.githubusercontent.com/kubecost/cost-analyzer-helm-chart/refs/tags/v${KUBECOST_VERSION}/cost-analyzer/values-eks-cost-monitoring.yaml
64-
----
65-
+
66-
Kubecost releases new versions regularly. You can update your version using https://helm.sh/docs/helm/helm_upgrade/[helm upgrade]. By default, the installation includes a local https://prometheus.io/[Prometheus] server and `kube-state-metrics`. You can customize your deployment to use link:mt/integrating-kubecost-with-amazon-managed-service-for-prometheus[Amazon Managed Service for Prometheus,type="blog"] by following the documentation in link:prometheus/latest/userguide/integrating-kubecost.html[Integrating with Amazon EKS cost monitoring,type="documentation"]. For a list of all other settings that you can configure, see the https://github.com/kubecost/cost-analyzer-helm-chart/blob/develop/cost-analyzer/values-eks-cost-monitoring.yaml[sample configuration file] on GitHub.
67-
68-
+
69-
* You can remove Kubecost from your cluster with the following commands.
70-
+
71-
[source,bash,subs="verbatim,attributes"]
72-
----
73-
helm uninstall kubecost --namespace kubecost
74-
----
75-
+
76-
[source,bash,subs="verbatim,attributes"]
77-
----
78-
kubectl delete namespace kubecost
79-
----
80-
81-
[#kubecost-dashboard]
82-
== Access Kubecost Dashboard
83-
. Make sure the required Pods are running.
84-
85-
[source,bash,subs="verbatim,attributes"]
86-
----
87-
kubectl get pods --namespace kubecost
88-
----
89-
90-
An example output is as follows.
91-
92-
[source,bash,subs="verbatim,attributes"]
93-
----
94-
NAME READY STATUS RESTARTS AGE
95-
kubecost-cost-analyzer-b9788c99f-5vj5b 2/2 Running 0 3h27m
96-
kubecost-kube-state-metrics-99bb8c55b-bn2br 1/1 Running 0 3h27m
97-
kubecost-prometheus-server-7d9967bfc8-9c8p7 2/2 Running 0 3h27m
98-
----
99-
. On your device, enable port-forwarding to expose the Kubecost dashboard.
100-
+
101-
[source,bash,subs="verbatim,attributes"]
102-
----
103-
kubectl port-forward deployment/kubecost-cost-analyzer 9090 --namespace kubecost
104-
----
105-
+
106-
Alternatively, you can use the <<aws-load-balancer-controller,{aws} Load Balancer Controller>> to expose Kubecost and use Amazon Cognito for authentication, authorization, and user management. For more information, see link:containers/how-to-use-application-load-balancer-and-amazon-cognito-to-authenticate-users-for-your-kubernetes-web-apps[How to use Application Load Balancer and Amazon Cognito to authenticate users for your Kubernetes web apps,type="blog"].
107-
. On the same device that you completed the previous step on, open a web browser and enter the following address.
108-
+
109-
[source,bash,subs="verbatim,attributes"]
110-
----
111-
http://localhost:9090
112-
----
113-
+
114-
You see the Kubecost Overview page in your browser. It might take 5–10 minutes for Kubecost to gather metrics. You can see your Amazon EKS spend, including cumulative cluster costs, associated Kubernetes asset costs, and monthly aggregated spend.
115-
+
116-
image::images/kubecost.png[Kubecost dashboard,scaledwidth=100%]
117-
. To track costs at a cluster level, tag your Amazon EKS resources for billing. For more information, see <<tag-resources-for-billing>>.
26+
* Before start, it is recommended to review https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installations-amazon-eks-integration[Kubecost - Architecture Overview] to understand how Kubecost works on Amazon EKS.
27+
* If you are new to Amazon EKS we recommend that you use Helm for the installation because it simplifies the _Amazon EKS optimized Kubecost bundle_ installation. For more information, see https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installations-amazon-eks-integration#ariaid-title3[Deploying Kubecost on an Amazon EKS cluster using Amazon EKS add-on].
28+
* To customize the installation, you might configure your _Amazon EKS optimized Kubecost bundle_ with Helm. For more information, see https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installations-amazon-eks-integration#ariaid-title8[Deploying Kubecost on an Amazon EKS cluster using Helm] in the _Kubecost documentation_.
11829
30+
[#kubecost-access-dashbaard]
31+
== Access Kubecost dashboard
11932

120-
* *Cost allocation* – View monthly Amazon EKS costs and cumulative costs for each of your namespaces and other dimensions over the past seven days. This is helpful for understanding which parts of your application are contributing to Amazon EKS spend.
121-
* *Assets* – View the costs of the {aws} infrastructure assets that are associated with your Amazon EKS resources.
33+
Once the _Amazon EKS optimized Kubecost bundle_ setup done, you should have access to Kubecost dashboard. For more information, see <<cost-monitoring-kubecost-dashboard>>.

latest/ug/cluster-management/cost-monitoring.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ Cost monitoring is an essential aspect of managing your Kubernetes clusters on A
1414

1515
*{aws} Billing split cost allocation data for Amazon EKS* -- This native feature integrates seamlessly with the {aws} Billing Console, allowing you to analyze and allocate costs using the same familiar interface and workflows you use for other {aws} services. With split cost allocation, you can gain insights into your Kubernetes costs directly alongside your other {aws} spend, making it easier to optimize costs holistically across your {aws} environment. You can also leverage existing {aws} Billing features like Cost Categories and Cost Anomaly Detection to further enhance your cost management capabilities. For more information, see link:cur/latest/userguide/split-cost-allocation-data.html[Understanding split cost allocation data,type="documentation"] in the {aws} Billing User Guide.
1616

17-
*Kubecost* -- Amazon EKS supports Kubecost, a Kubernetes cost monitoring tool. Kubecost offers a feature-rich, Kubernetes-native approach to cost monitoring, providing granular cost breakdowns by Kubernetes resources, cost optimization recommendations, and out-of-the-box dashboards and reports. Kubecost also retrieves accurate pricing data by integrating with the {aws} Cost and Usage Report, ensuring you get a precise view of your Amazon EKS costs. Learn how to <<kubecost-addon,Install Kubecost>>.
17+
*Kubecost* -- Amazon EKS supports Kubecost, a Kubernetes cost monitoring tool. Kubecost offers a feature-rich, Kubernetes-native approach to cost monitoring, providing granular cost breakdowns by Kubernetes resources, cost optimization recommendations, and out-of-the-box dashboards and reports. Kubecost also retrieves accurate pricing data by integrating with the {aws} Cost and Usage Report, ensuring you get a precise view of your Amazon EKS costs. Learn how to <<kubecost-overview,Install Kubecost>>.
1818

1919
include::cost-monitoring-aws.adoc[leveloffset=+1]
2020

2121
include::cost-monitoring-kubecost.adoc[leveloffset=+1]
2222

23+
include::cost-monitoring-kubecost-view-dashboard.adoc[leveloffset=+1]
24+
2325
include::cost-monitoring-kubecost-bundles.adoc[leveloffset=+1]

latest/ug/images/kubecost.png

-80.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)