Skip to main content

Carbon Costs

Carbon Costs is a cost metric added to both Allocation and Assets dashboards. Carbon Costs are measured in KG CO2e, which is defined by the EPA as:

"Carbon dioxide equivalent or CO2e means the number of metric tons of CO2 emissions with the same global warming potential as one metric ton of another greenhouse gas, and is calculated using Equation A-1 in 40 CFR Part 98."

OpenCost uses carbon coefficient data generated by the Cloud Carbon Footprint to associate estimated carbon costs to disk, node, and network assets based on their runtime. This carbon cost is then distributed to allocations. For more information on how these coefficients are calculated, visit the Cloud Carbon Footprint's methodology page.

Carbon Costs Column

The Carbon Costs column appears alongside other cost metrics in both the Allocation and Assets dashboards, providing visibility into the environmental impact of your cloud resources.

Carbon Costs Dashboard

Enabling Carbon Costs

To begin viewing carbon costs, set the Helm flag carbonEstimates to true in your values.yaml:

kubecostProductConfigs:
carbonEstimates:
enabled: true

Please allow OpenCost approximately ten minutes to derive pricing information. Carbon costs will then begin appearing with other cost metrics on your Allocation and Assets pages.

Carbon Cost Calculation

OpenCost calculates carbon costs by:

  1. Using Cloud Carbon Footprint coefficients to estimate carbon emissions for:

    • Compute resources (nodes)
    • Storage resources (disks)
    • Network resources
  2. Distributing these carbon costs to allocations based on resource usage

  3. Converting the emissions to KG CO2e (Kilograms of Carbon Dioxide Equivalent)

Viewing Carbon Costs

Once enabled, you can view carbon costs:

  1. In the Allocation dashboard:

    • As a column in the cost breakdown table
    • In cost allocation reports
    • Through the API using the /allocation endpoint
  2. In the Assets dashboard:

    • As a column in the assets table
    • In asset reports
    • Through the API using the /assets endpoint

API Integration

Carbon costs are available through the standard OpenCost API endpoints. When querying the API, carbon costs will be included in the response data alongside other cost metrics.

Example API query:

curl -G http://localhost:9003/allocation \
-d window=24h \
-d aggregate=namespace \
-d resolution=1m

The response will include carbon cost data in the format:

{
"code": 200,
"data": [
{
"namespace-name": {
"name": "namespace-name",
"properties": {
"cluster": "cluster-name",
"namespace": "namespace-name"
},
"window": {
"start": "2024-03-19T00:00:00Z",
"end": "2024-03-20T00:00:00Z"
},
"start": "2024-03-19T00:00:00Z",
"end": "2024-03-20T00:00:00Z",
"minutes": 1440,
"cpuCoreHours": 24,
"cpuCost": 0.24,
"ramByteHours": 8589934592,
"ramCost": 0.12,
"carbonCost": 0.45, // Carbon cost in KG CO2e
"totalCost": 0.36,
"loadBalancerCost": 0.00,
"pvCost": 0.00,
"networkCost": 0.00,
"externalCost": 0.00,
"sharedCost": 0.00,
"gpuCost": 0.00,
"gpuCount": 0,
"cpuEfficiency": 1.0,
"ramEfficiency": 1.0,
"totalEfficiency": 1.0
}
}
]
}

Additional Resources

Documentation Distributed under CC BY 4.0.  The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see: Trademark Usage.