It’s currently not straightforward for users to know the effective resource requirements for a pod. The formula for this is Max ( Max(initContainers), Sum(Containers)) + pod overhead. This is derived from the fact that init containers run serially and to completion before non-init containers. The effective request for each resource is then the maximum of the largest request for a resource in any init container, and the sum of that resources across all non-init containers.
The introduction of in place pod updates of resource requirement in KEP 1287 further complicates effective resource requirement calculation as Pod.Spec.Containers[i].Resources becomes a desired state field and may not represent the actual resources in use. The KEP notes that:
Schedulers should use the larger of Spec.Containers[i].Resources and Status.ContainerStatuses[i].ResourcesAllocated when considering available space on a node.
We can introduce ContainerUse to represent this value:
ContainerUse(i) = Max(Spec.Containers[i].Resources, Status.ContainerStatuses[i].ResourcesAllocated)