Search…
⌃K
Links

Deploy Kubecost from Red Hat Openshift’s OperatorHub

Overview

The OperatorHub is available via the Red Hat OpenShift Container Platform web console and is the interface that cluster administrators use to discover and install Operators. With one click, an Operator can be pulled from their off-cluster source, installed and subscribed on the cluster, and made ready for engineering teams to self-service manage the product across deployment environments using the Operator Lifecycle Manager (OLM). Kubecost is now available on the Embedded OperatorHub in OpenShift and OKD
This document provides instructions for deploying Kubecost into Red Hat Openshift 4.9.x or higher using Red Hat Openshift platform (OCP) web console. Kubecost's operator on the Embedded OperatorHub in OpenShift and OKD is an alternative to Kubecost Free version. Kubecost's operator uses an Operator pattern to deploy and manage the Kubecost deployment on the Red Hat Openshift platform.
Standard deployment

Prerequisites

  • You need to have an existing OCP cluster version 4.9.x or higher.
  • You have appropriate access to that OpenShift cluster to create a new project and deploy new workloads.

Discover Kubecost operator

  1. 1.
    Log in to your OCP cluster web console.
  2. 2.
    Select Operators > OperatorHub > Enter Kubecost in the search box.
  3. 3.
    Create a namespace named Kubecost:
kubectl create namespace kubecost
Example screenshot:
Discovery

Deploy Kubecost

Step 1: Install Kubecost operator

On the OperatorHub page, find Kubecost, then click install. You will be on the Operator Installation page, which shows all related information. Select your desired version and settings, then click Install
Installation step 1a
The installation takes 1-2 minutes to be completed. A dialog will appear as in the following example screenshot:
Installation step 1b
You can click on View Operators to review the details as in the following screenshot:
Installation step 1b
Kubecost operator is now installed successfully. Next, you can start to install Kubecost using the custom resources definition (CRD)

Step 2: Create a CRD to deploy Kubecost

  • You can customize the CRD definition similarly to the custom values file when deploying with Helm chart.
  • After creating a CRD file, apply it to deploy Kubecost:
kubectl apply -f example-crd.yaml -n kubecost
  • Example CRD to deploy Kubecost on OCP cluster
Click to see code
Kubecost operator will automatically detect the CRD resources and deploy Kubecost to the Kubecost namespace.
To expose Kubecost and access Kubecost dashboard, you can create a route to the service kubecost-cost-analyzer on port 9090 of the kubecost project. You can learn more about how to do it on your OpenShift portal in this LINK
Kubecost will be collecting data; please wait 5-15 minutes for the UI to reflect the resources in the local cluster.

Clean up

You can uninstall Kubecost from your cluster with the following command.
kubectl delete-f example-crd.yaml -n kubecost
You can uninstall Kubecost operator by following these instructions.

Support

For advanced setup or if you have any questions, you can contact us on Slack or email us at [email protected].