Goal
You want to find out why the EKS API server rejects or queues requests, which client causes it, and how to stop one client from starving the others. Isolating it protects controllers like Karpenter, the AWS Load Balancer Controller and your deploy pipeline.
Server-side or client-side throttling?
These two messages look alike, but they need different fixes:
| Message | Where | Meaning |
|---|---|---|
the server has received too many requests and has asked us to try again later / HTTP 429 | API server | API Priority and Fairness (APF) rejected the request. Its priority level queue was full |
Waited for 1.2s due to client-side throttling, not priority and fairness | Client (client-go) | The client's own QPS/burst limiter. The API server never saw the request |
For client-side throttling, raise the client's QPS and burst settings or make fewer calls. The rest of this post deals with real 429s from the server.
How APF decides
Each request is matched to a FlowSchema (in order of matchingPrecedence, lowest first). The FlowSchema names a PriorityLevelConfiguration. Each priority level gets a share of the server's concurrency (nominalConcurrencyShares) and has queues. When a level's seats are busy and its queues are full, new requests at that level get 429. Other levels are not affected. That is the point: a noisy client can only exhaust its own level.
kubectl get flowschemas
kubectl get prioritylevelconfigurations
The defaults include exempt (system:masters and health checks), system, node-high, leader-election, workload-high, workload-low, global-default and catch-all. Most service accounts end up in workload-low. Users without a better match end up in global-default. One misbehaving operator in workload-low can therefore starve every other workload-low controller.
Step 1: read the APF metrics
kubectl get --raw /metrics | grep -E '^apiserver_flowcontrol_(rejected_requests_total|current_inqueue_requests|current_executing_seats|request_wait_duration_seconds_count)' \
| grep -v ' 0$' | sort | head -40
| Metric | What it tells you |
|---|---|
apiserver_flowcontrol_rejected_requests_total{priority_level,flow_schema,reason} | Requests rejected with 429. reason is queue-full, concurrency-limit or time-out |
apiserver_flowcontrol_current_inqueue_requests | Requests waiting now. Steady non-zero values add latency |
apiserver_flowcontrol_current_executing_seats | Seats in use per priority level |
apiserver_flowcontrol_request_wait_duration_seconds | Time spent queued before running |
Note
EKS runs at least two API server instances behind a load balancer.
/metricsreturns the counters of whichever instance answered. Run the command a few times, or scrape it with Prometheus, before you conclude a level is quiet.
To see which FlowSchema and priority level a request landed in, look at the response headers:
kubectl get pods -A -v=8 2>&1 | grep -i 'X-Kubernetes-PF'
You get X-Kubernetes-Pf-Flowschema-Uid and X-Kubernetes-Pf-Prioritylevel-Uid. Match the UIDs with kubectl get flowschemas -o custom-columns=NAME:.metadata.name,UID:.metadata.uid.
If your RBAC allows the debug endpoint, it shows live queue state per level:
kubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels
Step 2: find the noisy client in audit logs
Turn on the audit control plane log type if it is off. It costs CloudWatch Logs ingestion, so you can switch it off again after the investigation.
aws eks update-cluster-config --name prod --logging '{"clusterLogging":[{"types":["audit"],"enabled":true}]}'
Then run these in CloudWatch Logs Insights on /aws/eks/prod/cluster:
fields @timestamp
| filter @logStream like /kube-apiserver-audit/
| stats count(*) as calls by user.username, userAgent, verb, objectRef.resource
| sort calls desc
| limit 25
Who is getting rejected:
fields @timestamp
| filter @logStream like /kube-apiserver-audit/ and responseStatus.code = 429
| stats count(*) as rejected by user.username, userAgent, objectRef.resource
| sort rejected desc
Expensive cluster-wide lists (no namespace, list verb):
fields @timestamp
| filter @logStream like /kube-apiserver-audit/ and verb = "list" and ispresent(objectRef.resource) and not ispresent(objectRef.namespace)
| stats count(*) as lists by user.username, userAgent, objectRef.resource
| sort lists desc
| limit 20
Usual culprits
| Pattern in the audit log | Typical source | Fix |
|---|---|---|
Thousands of list pods or list secrets cluster-wide | Operator polling instead of using informers; Helm with many releases | Switch to watch/informers; reduce Helm history (--history-max) |
list calls without a limit | Scripts and CI jobs running kubectl get ... -A in a loop | Add --chunk-size, cache results, run less often |
Burst of watch re-establishment after an upgrade | Many controllers reconnecting at once | Expected for a short time. If it persists, check controllers for crash loops |
One user agent with high get rate on configmaps or leases | Custom leader election with a tight loop | Fix the retry period |
| Monitoring agent listing every object kind | Old kube-state-metrics or a security scanner | Upgrade it, limit the resources it collects |
Step 3: isolate the noisy client
The fix is usually in the client, but you need protection while that happens. Create a dedicated priority level with a small share and a FlowSchema that matches only the noisy service account. It then queues against itself instead of against everyone in workload-low.
apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: PriorityLevelConfiguration
metadata:
name: noisy-scanner
spec:
type: Limited
limited:
nominalConcurrencyShares: 5
lendablePercent: 0
limitResponse:
type: Queue
queuing:
queues: 16
handSize: 4
queueLengthLimit: 50
---
apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: FlowSchema
metadata:
name: noisy-scanner
spec:
priorityLevelConfiguration:
name: noisy-scanner
matchingPrecedence: 900
distinguisherMethod:
type: ByUser
rules:
- subjects:
- kind: ServiceAccount
serviceAccount:
name: scanner
namespace: security-tools
resourceRules:
- verbs: ["*"]
apiGroups: ["*"]
resources: ["*"]
clusterScope: true
namespaces: ["*"]
kubectl apply -f noisy-scanner-apf.yaml
kubectl get flowschema noisy-scanner -o jsonpath='{.status.conditions}'
matchingPrecedence: 900 puts it ahead of the default service-accounts schema (precedence 9000) but after the system schemas, so you don't steal traffic from nodes or leader election. Use a different precedence if your cluster's defaults differ. Check kubectl get flowschemas first.
Warning
Don't edit the mandatory
exemptandcatch-allobjects. The API server restores them. The suggested defaults (workload-low,global-defaultand so on) are also auto-updated on upgrade. If you change one, set the annotationapf.kubernetes.io/autoupdate-spec: "false"on it, and record why, because you now own it across upgrades.
Caution
Never put a critical controller (Karpenter, CNI, CoreDNS autoscaler, admission webhooks' own clients) into a small priority level. If it gets 429s, nodes stop scaling or pods stop starting cluster-wide. Check what a FlowSchema matches before you apply it.
Step 4: protect the controllers you depend on
For critical controllers in workload-low, a dedicated FlowSchema pointing them at workload-high gives them more share than bulk workloads:
apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: FlowSchema
metadata:
name: platform-controllers
spec:
priorityLevelConfiguration:
name: workload-high
matchingPrecedence: 800
distinguisherMethod:
type: ByUser
rules:
- subjects:
- kind: ServiceAccount
serviceAccount: {name: karpenter, namespace: kube-system}
- kind: ServiceAccount
serviceAccount: {name: aws-load-balancer-controller, namespace: kube-system}
resourceRules:
- verbs: ["*"]
apiGroups: ["*"]
resources: ["*"]
clusterScope: true
namespaces: ["*"]
Adjust the service account names to your installation.
EKS-specific notes
- EKS scales the control plane on its own based on load. You can't set API server flags such as
--max-requests-inflight, so APF objects are the lever you control. The EKS best practices guide on control plane scaling explains how per-server limits grow as the control plane scales. - Rejections during the first minutes after a version upgrade or control plane scaling event are often watch reconnects. Judge a trend over 15 to 30 minutes.
Prevent it next time
- Scrape
apiserver_flowcontrol_rejected_requests_totalwith Prometheus (or Amazon Managed Service for Prometheus) and alarm on a sustained non-zero rate per priority level. - Review new operators and scanners for informer use and list behaviour before they reach production clusters.
- Keep APF objects in Git with the rest of the cluster add-ons, and re-check
matchingPrecedenceafter each EKS upgrade. - Cap Helm release history and clean up stale CRD objects. Large object counts make every list more expensive.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get