Key concepts
This section explains the key Harness Cloud Cost Management (CCM) concepts that you need to know before implementation.
Node Cost
If no cloud connector is configured, node cost is calculated based on the public pricing API of the cloud platform. If there is a cloud connector configured for either AWS or Azure, cost is trued up. GCP will always be based off of public pricing.
☆ NOTE — For ECS clusters, you can replace nodes with container instances and pods with tasks.
Here is an example of how node cost is calculated based on the following node specification:
Operating system | Linux |
Region | us-central1 |
Instance family | n1-standard-4 |
Instance Category | ON_DEMAND |
As per the cloud platform pricing, the per hour price of n1-standard-4 in us-central1 is $0.1900.
Here is the formula:
Cost for 24 hours = 24 * 0.1900 = $4.56.
☆ NOTE — Typically nodes are the same size. If they are running for a full day and are the same size, the cost will be the same.
Pod Cost
Pod cost is a ratio of the cost of the node it is running on. The price is equally distributed among CPU and memory. The following formula is used to calculate the pod cost:
Hourly pod cost = ((podCPU/nodeCPU) * nodeCPUPricePerHour) + ((podMemory/nodeMemory)) * nodeMemoryPricePerHour)
Here is an example of a pod cost calculation:
Pod Resources = (cpuUnits: 1024, memoryMB: 4096)
Node Resource = (cpuUnits: 4096, memoryMB: 15360) n1-standard-4
Node Resource = (cpuUnits: 4096, memoryMB: 15360) n1-standard-4
Pod cost = ((1024/4096) * 0.095 ) + ((4096/15360)) * 0.095) = 0.0490833333
System Cost
System cost is calculated by subtracting the total cost of the node from the allocatable resource cost.
Allocatable on a Kubernetes node is defined as the amount of compute resources that are available for pods. For more information, see Reserve Compute Resources for System Daemons in Kubernetes.
Here is the formula:
System cost = total cost of node - allocatable resource cost
System cost is used while calculating unallocated cost as described below.