Rafay is a SaaS-first Kubernetes Operations Platform (KOP) with enterprise-class scalability, zero-trust security and interoperability for managing applications across public clouds, data centers & edge.
See Rafay documentation to learn more about the platform and how to use it.
This document will walk you through installing Kubecost on a cluster that has been provisioned or imported using the Rafay controller. The steps below describe how to create and use a custom cluster blueprint via the Rafay Web Console. The entire workflow can also be fully automated and embedded into an automation pipeline using the RCTL CLI utility or Rafay REST APIs.
You have already provisioned or imported one or more Kubernetes clusters using the Rafay controller.
Under Integrations:
Select Repositories and create a new repository named kubecost
of type Helm.
Select Create.
Enter the endpoint value of https://kubecost.github.io/cost-analyzer/
.
Select Save.
You'll need to override the default values.yaml file. Create a new file called kubecost-custom-values.yaml with the following content:
Login to the Rafay Web Console and navigate to your Project as an Org Admin or Infrastructure Admin.
Under Infrastructure, select Namespaces and create a new namespace called kubecost
, and select type Wizard.
Select Save & Go to Placement.
Select the cluster(s) that the namespace will be added to. Select Save & Go To Publish.
Select Publish to publish the namespace to the selected cluster(s).
Once the namespace has been published, select Exit.
Under Infrastructure, select Clusters.
Select the kubectl button on the cluster to open a virtual terminal.
Verify that the kubecost
namespace has been created by running the following command:
From the Web Console:
Select Add-ons and Create a new add-on called kubecost.
Select Bring your own.
Select Helm 3 for type.
Select Pull files from repository.
Select Helm for the repository type.
Select kubecost
for the namespace.
Select Select.
Create a new version of the add-on.
Select New Version.
Provide a version name such as v1
.
Select kubecost
for the repository.
Enter cost-analyzer
for the chart name.
Upload the kubecost-custom-values.yaml
file that was previously created.
Select Save Changes.
Once you've created the Kubecost add-on, use it in assembling a custom cluster blueprint. You can add other add-ons to the same custom blueprint.
Under Infrastructure, select Blueprints.
Create a new blueprint and give it a name such as kubecost
.
Select Save.
Create a new version of the blueprint.
Select New Version.
Provide a version name such as v1
.
Under Add-Ons, select the kubecost
Add-on and the version that was previously created.
Select Save Changes.
You may now apply this custom blueprint to a cluster.
Select Options for the target cluster in the Web Console.
Select Update Blueprint and select the kubecost
blueprint and version you created previously.
Select Save and Publish.
This will start the deployment of the add-ons configured in the kubecost
blueprint to the targeted cluster. The blueprint sync process can take a few minutes. Once complete, the cluster will display the current cluster blueprint details and whether the sync was successful or not.
You can optionally verify whether the correct resources have been created on the cluster. Select the kubectl
button on the cluster to open a virtual terminal.
Then, verify the pods in the kubecost
namespace. Run kubectl get pod -n kubecost
, and check that the output is similar to the example below.
In order to access the Kubecost UI, you'll need to enable access to the frontend application using port-forward. To do this, download and use the Kubeconfig
with the KubeCTL CLI (../../accessproxy/kubectl_cli/
).
You can now access the Kubecost UI by visiting http://localhost:9090
in your browser.
You have now successfully created a custom cluster blueprint with the kubecost
add-on and applied to a cluster. Use this blueprint on as many clusters as you require.
You can find Rafay's documentation on Kubecost as well as guides for how to create or import a cluster using the Rafay controller on the Rafay Product Documentation site.