Network Traffic Cost Allocation
Last updated
Last updated
This document describes how Kubecost calculates network costs.
Kubecost uses best-effort to allocate network transfer costs to the workloads generating those costs. The level of accuracy has several factors described below.
There are two primary factors when determining how network costs are calculated:
Network costs DaemonSet: Must be enabled in order to view network costs
Cloud integration: Optional, allows for accurate cloud billing information
A default installation of Kubecost will use the onDemand rates for internet egress and proportionally assign those costs by pod using the metric container_network_transmit_bytes_total
. This is not exactly the same as costs obtained via the network costs DaemonSet, but will be approximately similar.
When you enable the network costs DaemonSet, Kubecost has the ability to attribute the network-byte traffic to specific pods. This will allow the most accurate cost distribution, as Kubecost has per-pod metrics for source and destination traffic.
Learn how to enable the network costs DaemonSet in seconds here.
Kubecost uses cloud integration to pull actual cloud provider billing information. Without enabling cloud integration, these prices will be based on public onDemand pricing.
Cloud providers allocate data transfers as line-items on a per-node basis. Kubecost will allocate network transfer costs based on each pod's share of container_network_transmit_bytes_total
of its node.
This will result in a accurate node-based costs. However, it is only estimating the actual pod/application responsible for the network-transfer costs.
Enabling both cloud-integration and the networkCosts DaemonSet allows Kubecost to give the most accurate data transfer costs to each pod.
At this time, there is a minor limitation where Kubecost cannot determine accurate costs for pods that use hostNetwork. These pods, today, will share all costs with the costs with the node.