a mechanism to protect API servers against CPU and memory overloads KEP-1040: https://github.com/kubernetes/enhancements/issues/1040 2019/05 Alpha v1.18 2020/03 Beta v1.20 2020/10 GA v1.29 2023/12
NOISY NEIGHBOR BLOCKS CRITICAL REQUESTS Get 100 Pods! Get 600 Secrets! Get 800 Pods! Mr. Priority max-requests-in f light: 4 max-mutating-requests-in f light: 2
based on properties. TWO RESOURCES, FLOW CONTROL AND PRIORITY LEVEL CONFIGURATION, MAKE UP APF RESOURCE OVERVIEW PriorityLevelCon f iguration This resource con f igures the proportion of requests allowed for the priority level.
based on properties. TWO RESOURCES, FLOW CONTROL AND PRIORITY LEVEL CONFIGURATION, MAKE UP APF RESOURCE OVERVIEW PriorityLevelCon f iguration PLC con f igures the proportion of requests allowed for the priority level.
default queues queues kube- scheduler global- default system:kube- scheduler Precedence: 800 All Precedence: 9900 All Precedence: 10000 system:masters Precedence: 1 First small match wins queues
IS UNSUITABLE apiserver_ f lowcontrol_ current_executing_requests apiserver_ f lowcontrol_ current_executing_seats apiserver_ f lowcontrol_ current_limit_seats apiserver_ f lowcontrol_ current_inqueue_requests Request Request Queue
REQUEST DROPPING (429 ERR) Isolate important/noisy requests Allocate more capacity to requests Increase the PLC's concurrency limit, or map the FS to a higher capacity PLC. NOTE: Consider f ixing the noisy workload f irst. Earn more seats means starving others' seats. Add a new FlowSchema (FS) and PriorityLevelCon f iguration (PLC). Then, reduce the capacity of the existing PLC by that amount. ServerCL ServerCL
objects https://github.com/kubernetes/apiserver/blob/release-1.29/pkg/ apis/ f lowcontrol/bootstrap/default.go Mandatory Objects: FS & PLC: exempt & catch-all Suggested Objects (modi f iable): FS: system-nodes, system-leader-election, etc. PLC: system, leader-election, workload-high, etc. NOTE: If the object has apf.kubernetes.io/autoupdate- spec annotation and its value is true, the API server periodically maintains the object.
Before tweaking APF settings, consider f ixing your workload f irst When getting frequent 429 errors due to f low control, review APF-related metrics RECAP
icial Document: Flow Control (v1.29) https://kubernetes.io/docs/concepts/cluster-administration/ f low-control/ Kubernetes API Reference (v1.29 FlowSchema/PriorityLevelCon f iguration v1) https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/ Codebase (b041969) https://github.com/kubernetes/apiserver/tree/release-1.29/pkg/util/ f lowcontrol API Priority and Fairness by Containers from the Couch - YouTube https://www.youtube.com/watch?v=YnPPHBawhE0 Shu ff le Sharding: Massive and Magical Fault Isolation https://aws.amazon.com/blogs/architecture/shu ff le-sharding-massive-and-magical-fault-isolation/