# 【kube-apiserver】APF 与 max-in-flight：公平排队、504 与 etcd lag 分列

DevFeed: [【kube-apiserver】APF 与 max-in-flight：公平排队、504 与 etcd lag 分列](<https://devfeed.tech/articles/kube-apiserver-apf-max-in-flight-504-etcd-lag-33968.md>)

Original publisher: [Read original article](<https://quant67.com/post/apiserver/12-apf/12-apf.html>)

Author: Liao Tonglang

Published: 2026-08-28T00:00:00Z

Content type: article

Language: zh

Sources: [土法炼钢 - 系统与基础设施](<https://devfeed.tech/sources/source-4.md>)

Topics: [Kubernetes](<https://devfeed.tech/topics/kubernetes.md>), [API](<https://devfeed.tech/topics/api.md>), [SRE](<https://devfeed.tech/topics/sre.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [apf](<https://devfeed.tech/tags/apf.md>), [api](<https://devfeed.tech/tags/api.md>), [apiserver](<https://devfeed.tech/tags/apiserver.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [etcd](<https://devfeed.tech/tags/etcd.md>), [fairness](<https://devfeed.tech/tags/fairness.md>), [fairqueuing](<https://devfeed.tech/tags/fairqueuing.md>), [flowcontrol](<https://devfeed.tech/tags/flowcontrol.md>), [k8s](<https://devfeed.tech/tags/k8s.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [lag](<https://devfeed.tech/tags/lag.md>), [max-in-flight](<https://devfeed.tech/tags/max-in-flight.md>), [priority](<https://devfeed.tech/tags/priority.md>), [timeout](<https://devfeed.tech/tags/timeout.md>), [v1-30-3](<https://devfeed.tech/tags/v1-30-3.md>)

## AI overview

This article explains how Kubernetes v1.30.3 protects kube-apiserver from overload through API Priority and Fairness (APF) and the older max-in-flight limits. It distinguishes 429 responses, APF queue timeouts that can produce 504 responses before storage is reached, etcd latency, and admission webhook delays, and describes APF's FlowSchema, PriorityLevelConfiguration, fair queuing, and shuffle sharding mechanisms.

## Source excerpt

钉 K8s v1.30.3 的 API Priority and Fairness（APF）：FlowSchema 匹配、PriorityLevelConfiguration 公平排队（SFVR）、与旧 max-in-flight flag 的共存关系；429/timeout/504 在 APF 排队、etcd_request_duration_seconds、Admission Webhook 三轴的分列；pkg/util/flowcontrol 路径；APF 与简单 max-in-flight 的运维复杂度争论。