AWS K8s Storage Cost Allocation Enhancements
Overview
The unified cloud-K8s release introduces a significant improvement to Kubernetes storage cost allocation for AWS environments. The enhancement aligns storage cost attribution with real pod-level ownership of persistent volumes, replacing the previous node-level proportional allocation model. The result is a more accurate and meaningful breakdown of storage costs across workloads.
Background
Previously, storage costs for all EBS volumes attached to a node, including root volumes, were distributed across all hosted pods, weighted by pod uptime. This approach did not reflect real usage patterns, especially when a single pod exclusively owns and utilizes a PersistentVolumeClaim (PVC). We refined the storage allocation model to better reflect true ownership and reduce noise caused by irrelevant volume types.
Key Enhancements
- Direct Volume-to-Pod Cost Allocation PVC-backed EBS volumes are now fully allocated to the specific pod that claims them, aligning with the expectation of single-ownership PVCs. This eliminates the previous node-wide cost spreading and provides precise visibility into pod storage costs.
- Root Volume Handling Root EBS volumes (non-PVC volumes) continue to be shared across all pods on the node, as they are typically not meaningful for workload-level cost insights. Due to incomplete visibility of root-volume metrics in Prometheus, this behavior intentionally mirrors the existing implementation.
- Simplification for Non-EBS Storage EFS and other storage types are considered negligible for this stage and are not included in allocation.
- Improved Volume Mapping PVCs are mapped to their actual EBS Volume IDs using newly collected Prometheus metrics. Volumes without a PVC mapping are assumed to be node root volumes and handled with shared allocation.
- Waste Allocation (Deferred) Waste allocation for storage (capacity vs. utilization) is not yet included.
Preconditions
This enhancement applies only when:
- Running in AWS.
- Using prometheus-agent version 0.3.22, this is the Prometheus Agent version in use, which supports the newly required PVC-to-volume metrics; otherwise, volumes are shared between all pods evenly. (and not based on storage PVC)
- Using the Unified-K8s implementation.
If any of these conditions are not met, the system reverts to its previous allocation behavior.
Technical Notes
- Volume cost allocation now supports grouping by volume ownership, rather than node hosting.
- No changes were required to “allocatable” resource handling since storage waste is out of scope for this phase.
- No generic allocation refactor was needed, though future enhancements (e.g., data transfer attribution) may revisit this area.
Updated about 2 hours ago
