Kubelet manages eviction, which is carried out at pod-granularity on a node. The kubelet ranks Pods for eviction first by whether or not their usage of the starved resource exceeds requests, then by Priority, and then by the consumption of the starved compute resource relative to the Pods’ scheduling requests.
Of note for Pod Overhead is the comparision of requested resources versus utilization of particular resource. The sum of requests is compared against the sum of container utilization, for each pod.
Eviction is handled by an Evicition Manager.
NewManager is passed a summaryProvider, which is a part of the StatsProvider created for Kubelet. In our case, it should be a New CRI Stats Provider (see ~/go/src/k8s.io/kubernetes/pkg/kubelet/server/stats/summary.go for analyzer?)
A stats_provider is ultimately used to grab stats:
func (p *criStatsProvider) ListPodCPUAndMemoryStats() ([]statsapi.PodStats, error) {
Or, see the code
As is, we are only working at the container level to gather details about the pod behavior. This doesn't take into account any potential resource utilization by the sandbox, the pod, itself. This is non-negligible, especially for sandboxed runtimes, like Kata Containers.
For eviction purposes, utilization statistics should be measured at the pod cgroup, not as a sum of container statistics.
- Currently pretty tied into existing stats provider
- ok to modify container level stats?