3 minute read

Kubecost is now available on Red Hat OpenShift OperatorHub. You can deploy Kubecost on your Red Hat OpenShift cluster in a more native way with just a few clicks.

Kubecost-operator-installation

Overview

Kubecost enables you to have granular visibility into your Kubernetes (K8s) application, starting at the K8s cluster level and going down to the containers level. Kubecost supports all K8s clusters or platforms running on different environments like public cloud, private cloud, or on-premises, including Red Hat OpenShift. You can learn more about the Kubecost installation on Red Hat OpenShift in this previous blog post. Today, we are excited to announce the availability of Kubecost’s operator on Red Hat OpenShift OperatorHub to help you deploy Kubecost on Red Hat Openshift cluster natively and easier.

Operator concept was introduced in 2016 by the CoreOS Linux development team. The operator manages software resources and their components as a software extension. With this launch, you can discover, try and deploy Kubecost’s operator from your Red Hat OpenShift OperatorHub web console with just a few clicks. Then, you can define your Kubecost deployment using Custom Resources Definition (CRD), apply it, and let Kubecost’s operator deploy and manage the lifecycle of Kubecost running inside your Red Hat Openshift cluster.

Discover Kubecost operator

To find Kubecost Operator, you must log in to your Red Hat OpenShift cluster web console as an administrator. Next, on the left panel, navigate to Operators > OperatorHub, then type “Kubecost” in the search bar. Kubecost operator will be listed in the search result as in the following example screenshot:

Discovery

Deploy Kubecost with Kubecost operator

To install the Kubecost operator, you can click on the “Install” button and follow the on-screen instruction with default options. I take less than 2 minutes to install the Kubecost operator. The following example screenshot shows a successful installation of the Kubecost operator:

Kubecost-operator-installation

Once the Kubecost operator is up and running, you can start defining the custom resources definition to allow the Kubecost operator deploys and manages the Kubecost application. You can deploy Kubecost on Red Hat OpenShift cluster in the standard way using the following script:

cat << EOF > kubecost-crd.yaml
apiVersion: charts.kubecost.com/v1alpha1
kind: CostAnalyzer
metadata:
  name: kubecost
spec:
  # Default values copied from <project_dir>/helm-charts/cost-analyzer/values.yaml
  openshiftDeployment: true
  affinity: {}
  awsstore:
    createServiceAccount: false
    useAwsStore: false
  clusterController:
    enabled: false
    image: gcr.io/kubecost1/cluster-controller:v0.1.0
    imagePullPolicy: Always
  extraVolumeMounts: []
  extraVolumes: []
  kubecostProductConfigs:
    clusterName: your-ocp-cluser
  prometheus:
    nodeExporter:
      enabled: false
    serviceAccounts:
      nodeExporter:
        create: false
    kube-state-metrics:
      disabled: true
    server:
      global:
        external_labels:
          cluster_id: your-ocp-cluser
  global:
    additionalLabels: {}
    assetReports:
      enabled: false
      reports:
      - accumulate: false
        aggregateBy: type
        filters:
        - property: cluster
          value: your-ocp-cluser
        title: Example Asset Report 0
        window: today
    grafana:
      domainName: cost-analyzer-grafana.default.svc
      enabled: false
      proxy: false
      scheme: http
    notifications:
      alertmanager:
        enabled: false
        fqdn: http://cost-analyzer-prometheus-server.default.svc
    podAnnotations: {}
    prometheus:
      enabled: true
      fqdn: http://cost-analyzer-prometheus-server.default.svc
    savedReports:
      enabled: false
      reports:
      - accumulate: false
        aggregateBy: namespace
        filters:
        - property: cluster
          value: cluster-one,cluster*
        - property: namespace
          value: kubecost
        idle: separate
        title: Example Saved Report 0
        window: today
      - accumulate: false
        aggregateBy: controllerKind
        filters:
        - property: label
          value: app:cost*,environment:kube*
  EOF
kubectl create ns kubecost
kubectl apply -f kubecost-crd.yaml -n kubecost

You can find more detailed instructions in our documentation at LINK

Clean up

You can run the following command to uninstall Kubecost:

kubectl delete -f kubecost-crd.yaml -n kubecost

To uninstall the Kubecost operator, check this documentation.

Conclusion

In this blog, you have learned how to deploy Kubecost quickly with the Kubecost operator with just a few clicks. You can also check our documentation to learn about how to deploy Kubecost on Red Hat Openshift cluster using Helm Chart, or you can contact us in the following ways if you have questions or feedback.

We’re here to help!

Get in touch with a Kubecost team member to learn more about Kubecost Enterprise or request a custom demonstration.

Join us on Slack if you have questions or feedback, need help, or for general Kubernetes and cloud cost optimization conversation!