39 lines
1.5 KiB
Markdown
39 lines
1.5 KiB
Markdown
---
|
||
title: "API Server Priority and Fairness"
|
||
type: concept
|
||
tags:
|
||
- Kubernetes
|
||
- EKS
|
||
- API-Server
|
||
- Performance
|
||
- Multi-Tenancy
|
||
sources:
|
||
- ctp-topic-64-scaling-out-with-amazon-eks
|
||
last_updated: 2026-04-28
|
||
---
|
||
|
||
## Definition
|
||
API Server Priority and Fairness(PPF)是 Kubernetes 1.20+ 引入的 API Server 配置特性,通过优先级类别(Priority Class)和并发限制(Flow Schema)管理 API 请求的调度和限流,确保关键工作负载在高负载下的 API 访问稳定性。
|
||
|
||
## Key Mechanisms
|
||
- **Priority Class**:为 API 请求分配优先级(整数越大优先级越高)
|
||
- **Flow Schema**:定义请求匹配规则,将请求路由到对应的 Flow
|
||
- **Concurrency Limit**:每个 Flow 的并发请求数限制
|
||
- **Request Limiting**:超出限制的请求进入等待队列或被拒绝
|
||
|
||
## Why Enable PPF
|
||
- 多租户 EKS 集群中,防止单个租户/工作负载耗尽 API Server 资源
|
||
- 在扩缩容期间(大量 HPA/Controller 并发请求)保护关键 API 调用
|
||
- 提升 API Server 在高负载下的可预测性和稳定性
|
||
|
||
## Configuration
|
||
- 通过 kube-apiserver 启动参数 `--enable-priority-and-fairness=true` 启用
|
||
- Flow Schema 和 Priority Level 通过 kube-apiserver 配置或 admission webhook 管理
|
||
|
||
## Relationship with Scaling
|
||
- 在大规模集群扩缩容时,HPA、Cluster Autoscaler、Custom Controller 等大量并发 API 请求可能压垮 API Server
|
||
- PPF 确保关键扩缩容操作的 API 请求优先处理
|
||
|
||
## Sources
|
||
- [[ctp-topic-64-scaling-out-with-amazon-eks]]
|