-
Notifications
You must be signed in to change notification settings - Fork 701
Improve docs for Kubecost #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mainline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
include::../attributes.txt[] | ||
|
||
[.topic] | ||
[#cost-monitoring-kubecost-dashboard] | ||
= Access Kubecost Dashboard | ||
|
||
[#kubecost-prereqs-dashboard] | ||
== Prerequisites | ||
|
||
. Make sure the kubecost related Pods' state are "Running". | ||
|
||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
kubectl get pods --namespace kubecost | ||
---- | ||
|
||
[#kubecost-dashboard] | ||
== Access Kubecost Dashboard | ||
|
||
. On your device, enable port-forwarding to expose the Kubecost dashboard. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
kubectl port-forward deployment/kubecost-cost-analyzer 9090 --namespace kubecost | ||
---- | ||
+ | ||
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"]. | ||
. On the same device that you completed the previous step on, open a web browser and enter the following address. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
http://localhost:9090 | ||
---- | ||
+ | ||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be vary if cluster size is relatively large, minor tweak to add |
||
+ | ||
. To track costs at a cluster level, tag your Amazon EKS resources for billing. For more information, see <<tag-resources-for-billing>>. | ||
|
||
|
||
* *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. | ||
* *Assets* – View the costs of the {aws} infrastructure assets that are associated with your Amazon EKS resources. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ include::../attributes.txt[] | |
|
||
[.topic] | ||
[#cost-monitoring-kubecost] | ||
= Install Kubecost and access dashboard | ||
= Install Kubecost | ||
:info_titleabbrev: Install Kubecost | ||
|
||
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. | ||
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. | ||
|
||
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>>. | ||
|
||
|
@@ -18,104 +18,16 @@ Kubecost v2 introduces several major new features. <<kubecost-v2,Learn more abou | |
|
||
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>>. | ||
|
||
[#kubecost-overview] | ||
== Install Amazon EKS optimized Kubecost bundle | ||
|
||
[#kubecost-addon] | ||
== Install Kubecost using Amazon EKS Add-ons | ||
You can use one of the following procedures to install the _Amazon EKS optimized Kubecost bundle_: | ||
|
||
guessi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[NOTE] | ||
==== | ||
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>>. | ||
==== | ||
|
||
Amazon EKS Add-ons reduce the complexity of upgrading Kubecost, and managing licenses. EKS Add-ons are integrated with the {aws} marketplace. | ||
|
||
. View link:marketplace/seller-profile?id=983de668-2731-4c99-a7e2-74f27d796173[Kubecost in the {aws} Marketplace console,type="marketing"] and subscribe. | ||
. Determine the name of your cluster, and the region. Verify you are logged into the {aws} CLI with sufficient permissions to manage EKS. | ||
. Create the Kubecost addon. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
aws eks create-addon --addon-name kubecost_kubecost --cluster-name $YOUR_CLUSTER_NAME --region $AWS_REGION | ||
---- | ||
|
||
Learn how to <<removing-an-add-on,remove an EKS Add-on>>, such as Kubecost. | ||
|
||
[#kubecost-helm] | ||
== Install Kubecost using Helm | ||
|
||
* An existing Amazon EKS cluster. To deploy one, see <<getting-started>>. | ||
* 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>>. | ||
* 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>>. | ||
* 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]. | ||
* 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. | ||
|
||
. 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. | ||
. Install Kubecost with the following command. Replace [.replaceable]`KUBECOST_VERSION` with the value retrieved from ECR, such as [.replaceable]`1.108.1`. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
export KUBECOST_VERSION="1.108.1" | ||
|
||
helm upgrade -i kubecost \ | ||
oci://public.ecr.aws/kubecost/cost-analyzer \ | ||
--version ${KUBECOST_VERSION} \ | ||
--namespace kubecost --create-namespace \ | ||
-f https://github.com/raw/kubecost/cost-analyzer-helm-chart/refs/tags/v${KUBECOST_VERSION}/cost-analyzer/values-eks-cost-monitoring.yaml | ||
---- | ||
+ | ||
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. | ||
|
||
+ | ||
* You can remove Kubecost from your cluster with the following commands. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
helm uninstall kubecost --namespace kubecost | ||
---- | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
kubectl delete namespace kubecost | ||
---- | ||
|
||
[#kubecost-dashboard] | ||
== Access Kubecost Dashboard | ||
. Make sure the required Pods are running. | ||
|
||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
kubectl get pods --namespace kubecost | ||
---- | ||
|
||
An example output is as follows. | ||
|
||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
NAME READY STATUS RESTARTS AGE | ||
kubecost-cost-analyzer-b9788c99f-5vj5b 2/2 Running 0 3h27m | ||
kubecost-kube-state-metrics-99bb8c55b-bn2br 1/1 Running 0 3h27m | ||
kubecost-prometheus-server-7d9967bfc8-9c8p7 2/2 Running 0 3h27m | ||
---- | ||
. On your device, enable port-forwarding to expose the Kubecost dashboard. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
kubectl port-forward deployment/kubecost-cost-analyzer 9090 --namespace kubecost | ||
---- | ||
+ | ||
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"]. | ||
. On the same device that you completed the previous step on, open a web browser and enter the following address. | ||
+ | ||
[source,bash,subs="verbatim,attributes"] | ||
---- | ||
http://localhost:9090 | ||
---- | ||
+ | ||
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. | ||
+ | ||
image::images/kubecost.png[Kubecost dashboard,scaledwidth=100%] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove image here as the image is for v1 whereas the instruction may be v2. |
||
. To track costs at a cluster level, tag your Amazon EKS resources for billing. For more information, see <<tag-resources-for-billing>>. | ||
* 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. | ||
* 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]. | ||
* 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_. | ||
|
||
[#kubecost-access-dashbaard] | ||
== Access Kubecost dashboard | ||
|
||
* *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. | ||
* *Assets* – View the costs of the {aws} infrastructure assets that are associated with your Amazon EKS resources. | ||
Once the _Amazon EKS optimized Kubecost bundle_ setup done, you should have access to Kubecost dashboard. For more information, see <<cost-monitoring-kubecost-dashboard>>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.ibm.com/docs/en/kubecost/self-hosted/2.x?topic=installations-amazon-eks-integration