Prerequisites

Before you begin, you will need to have the following:

Prometheus

If you do not have prometheus-server installed on your cluster, you can use the installation guide below:
  • Add the chart to deploy prometheus on the cluster.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
  • Install the operator to begin collecting metrics for workloads on the cluster.
helm install prometheus prometheus-community/prometheus --namespace prometheus-system --create-namespace
kubectl wait --for=condition=available --timeout=10m -n prometheus-system deploy/prometheus-server

Obtain an API Key

To run the CostGraph operator, you will need to create an account on costgraph.baselinehq.cloud to obtain an API key.

Setup a plan

Once you obtain an API key, setup a plan to allow the API key to have billing enabled.
Setting up a planYou must have a plan setup for your organization to use the operator. Not doing so will cause the operator to fail on startup.
Free Plan Available For Developers
There’s a free plan available on the One-Time tab to begin using CostGraph without any payment.

Helm configuration

In deploying the CostGraph operator, the charts are available in the GitHub repository costgraph-charts Run the helm command below to import the charts into the repository to begin deploying the operator.
helm repo add costgraph https://baselinehq.github.io/costgraph-charts/
helm repo update

Configuration

CostGraph

Create a configuration file with the helm updates that are required in deploying the package
domain: <your-company-subdomain>
costgraph:
  config:
    costgraph_instance_name: <instance-name>
    prometheus_endpoint: <prometheus-address>
    api_key: <your-api-key>
Using Multiple Cost Centers
If you have an existing CostGraph instance, you can configure replication to that cost center by appending the relevant cluster names to the costgraph_instance_master_domains configuration. You can append multiple clusters to the configuration, this will be the costgraph_instance_name of the instance you want to view costs from.
costgraph:
  config:
    costgraph_instance_master_domains:
      - name: "<cluster-to-replicate-to>"

Expected Utilisation Percentages

If you want to configure expected utilisation percentages for recommendations on the CostGraph instance, you can change it using the following configuration:
costgraph:
  config:
    expected_utilisation_percent:
      cpu: 80
      memory: 80
By default, the expected utilisation is set to 80% for both CPU and Memory. You can change this to your desired value.

Superset

To configure the superset credentials, update the configuration for the superset setting.
costgraph:
  config:
    superset_admin_username: admin
    superset_admin_password: admin

Postgres

Postgres Configuration
Only use this if you have an existing postgres instance or manage a Postgres instance outside Kubernetes eg AWS Aurora etc. If you want to use an existing database instance, add in this configuration
postgres:
  enabled: false
  config:
    postgres_db: postgres
    postgres_user: username
    postgres_password: password
    pg_data_directory: /var/lib/postgresql/data
    postgres_host: db_hostname
    postgres_port: db_port
If you want to have a PVC for the database, set the pvc configuration to true and update the size for the PVC.
This will create a StatefulSet for the database instance and does not directly configure a PVC for the database.
postgres:
    pvc:
      enabled: true
      size: 10Gi

Deployment

Finally deploy the configuration with the updated settings for your CostGraph instance
helm install costgraph costgraph/costgraph -f <values-file>

Post Deployment

In the tabs below, you will find features available to you after the helm deployment is complete and resources are provisioned successfully.
Superset Credentials
Unless modified, the username and password for the superset instance is admin and adminOnce the deployment is complete, you can access the CostGraph dashboard on the domain costgraph.$domain and login with the credentials provided in the configuration file.

Accessing the dashboard

Ensure that the domain is accessible from the network you are connecting from. If you are using a local cluster, you can use the kubectl port-forward command to access the dashboard.
The quickest way to access the dashboard is to use port forwarding. This will forward the port 8088 on your local machine to the port 80 on the CostGraph service.
python -m webbrowser -t http://localhost:8088
kubectl port-forward -n costgraph svc/costgraph 8088:80
You can then access the dashboard on localhost:8088 in your browser.