Skip to content

Commit 2c7d774

Browse files
authored
Merge pull request #28407 from tengqm/fix-links
Fix some links in the concepts section
2 parents 8152a75 + ad93c9a commit 2c7d774

File tree

12 files changed

+182
-120
lines changed

12 files changed

+182
-120
lines changed

content/en/docs/concepts/architecture/controller.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,12 @@ You can run your own controller as a set of Pods,
159159
or externally to Kubernetes. What fits best will depend on what that particular
160160
controller does.
161161

162-
163-
164162
## {{% heading "whatsnext" %}}
165163

166164
* Read about the [Kubernetes control plane](/docs/concepts/overview/components/#control-plane-components)
167165
* Discover some of the basic [Kubernetes objects](/docs/concepts/overview/working-with-objects/kubernetes-objects/)
168166
* Learn more about the [Kubernetes API](/docs/concepts/overview/kubernetes-api/)
169-
* If you want to write your own controller, see [Extension Patterns](/docs/concepts/extend-kubernetes/extend-cluster/#extension-patterns) in Extending Kubernetes.
167+
* If you want to write your own controller, see
168+
[Extension Patterns](/docs/concepts/extend-kubernetes/#extension-patterns)
169+
in Extending Kubernetes.
170+

content/en/docs/concepts/cluster-administration/flow-control.md

Lines changed: 78 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ the `--max-requests-inflight` flag without the API Priority and
3333
Fairness feature enabled.
3434
{{< /caution >}}
3535

36-
37-
3836
<!-- body -->
3937

4038
## Enabling/Disabling API Priority and Fairness
@@ -65,6 +63,7 @@ The command-line flag `--enable-priority-and-fairness=false` will disable the
6563
API Priority and Fairness feature, even if other flags have enabled it.
6664

6765
## Concepts
66+
6867
There are several distinct features involved in the API Priority and Fairness
6968
feature. Incoming requests are classified by attributes of the request using
7069
_FlowSchemas_, and assigned to priority levels. Priority levels add a degree of
@@ -75,12 +74,13 @@ each other, and allows for requests to be queued to prevent bursty traffic from
7574
causing failed requests when the average load is acceptably low.
7675

7776
### Priority Levels
78-
Without APF enabled, overall concurrency in
79-
the API server is limited by the `kube-apiserver` flags
80-
`--max-requests-inflight` and `--max-mutating-requests-inflight`. With APF
81-
enabled, the concurrency limits defined by these flags are summed and then the sum is divided up
82-
among a configurable set of _priority levels_. Each incoming request is assigned
83-
to a single priority level, and each priority level will only dispatch as many
77+
78+
Without APF enabled, overall concurrency in the API server is limited by the
79+
`kube-apiserver` flags `--max-requests-inflight` and
80+
`--max-mutating-requests-inflight`. With APF enabled, the concurrency limits
81+
defined by these flags are summed and then the sum is divided up among a
82+
configurable set of _priority levels_. Each incoming request is assigned to a
83+
single priority level, and each priority level will only dispatch as many
8484
concurrent requests as its configuration allows.
8585

8686
The default configuration, for example, includes separate priority levels for
@@ -90,6 +90,7 @@ requests cannot prevent leader election or actions by the built-in controllers
9090
from succeeding.
9191

9292
### Queuing
93+
9394
Even within a priority level there may be a large number of distinct sources of
9495
traffic. In an overload situation, it is valuable to prevent one stream of
9596
requests from starving others (in particular, in the relatively common case of a
@@ -114,15 +115,18 @@ independent flows will all make progress when total traffic exceeds capacity),
114115
tolerance for bursty traffic, and the added latency induced by queuing.
115116

116117
### Exempt requests
118+
117119
Some requests are considered sufficiently important that they are not subject to
118120
any of the limitations imposed by this feature. These exemptions prevent an
119121
improperly-configured flow control configuration from totally disabling an API
120122
server.
121123

122124
## Defaults
125+
123126
The Priority and Fairness feature ships with a suggested configuration that
124127
should suffice for experimentation; if your cluster is likely to
125-
experience heavy load then you should consider what configuration will work best. The suggested configuration groups requests into five priority
128+
experience heavy load then you should consider what configuration will work
129+
best. The suggested configuration groups requests into five priority
126130
classes:
127131

128132
* The `system` priority level is for requests from the `system:nodes` group,
@@ -180,19 +184,18 @@ If you add the following additional FlowSchema, this exempts those
180184
requests from rate limiting.
181185

182186
{{< caution >}}
183-
184187
Making this change also allows any hostile party to then send
185188
health-check requests that match this FlowSchema, at any volume they
186189
like. If you have a web traffic filter or similar external security
187190
mechanism to protect your cluster's API server from general internet
188191
traffic, you can configure rules to block any health check requests
189192
that originate from outside your cluster.
190-
191193
{{< /caution >}}
192194

193195
{{< codenew file="priority-and-fairness/health-for-strangers.yaml" >}}
194196

195197
## Resources
198+
196199
The flow control API involves two kinds of resources.
197200
[PriorityLevelConfigurations](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#prioritylevelconfiguration-v1beta1-flowcontrol-apiserver-k8s-io)
198201
define the available isolation classes, the share of the available concurrency
@@ -204,6 +207,7 @@ of the same API group, and it has the same Kinds with the same syntax and
204207
semantics.
205208

206209
### PriorityLevelConfiguration
210+
207211
A PriorityLevelConfiguration represents a single isolation class. Each
208212
PriorityLevelConfiguration has an independent limit on the number of outstanding
209213
requests, and limitations on the number of queued requests.
@@ -217,6 +221,7 @@ server by restarting `kube-apiserver` with a different value for
217221
`--max-requests-inflight` (or `--max-mutating-requests-inflight`), and all
218222
PriorityLevelConfigurations will see their maximum allowed concurrency go up (or
219223
down) by the same fraction.
224+
220225
{{< caution >}}
221226
With the Priority and Fairness feature enabled, the total concurrency limit for
222227
the server is set to the sum of `--max-requests-inflight` and
@@ -235,8 +240,8 @@ above the threshold will be queued, with the shuffle sharding and fair queuing t
235240
to balance progress between request flows.
236241

237242
The queuing configuration allows tuning the fair queuing algorithm for a
238-
priority level. Details of the algorithm can be read in the [enhancement
239-
proposal](#whats-next), but in short:
243+
priority level. Details of the algorithm can be read in the
244+
[enhancement proposal](#whats-next), but in short:
240245

241246
* Increasing `queues` reduces the rate of collisions between different flows, at
242247
the cost of increased memory usage. A value of 1 here effectively disables the
@@ -249,15 +254,15 @@ proposal](#whats-next), but in short:
249254
* Changing `handSize` allows you to adjust the probability of collisions between
250255
different flows and the overall concurrency available to a single flow in an
251256
overload situation.
252-
{{< note >}}
253-
A larger `handSize` makes it less likely for two individual flows to collide
254-
(and therefore for one to be able to starve the other), but more likely that
255-
a small number of flows can dominate the apiserver. A larger `handSize` also
256-
potentially increases the amount of latency that a single high-traffic flow
257-
can cause. The maximum number of queued requests possible from a
258-
single flow is `handSize * queueLengthLimit`.
259-
{{< /note >}}
260257

258+
{{< note >}}
259+
A larger `handSize` makes it less likely for two individual flows to collide
260+
(and therefore for one to be able to starve the other), but more likely that
261+
a small number of flows can dominate the apiserver. A larger `handSize` also
262+
potentially increases the amount of latency that a single high-traffic flow
263+
can cause. The maximum number of queued requests possible from a
264+
single flow is `handSize * queueLengthLimit`.
265+
{{< /note >}}
261266

262267
Following is a table showing an interesting collection of shuffle
263268
sharding configurations, showing for each the probability that a
@@ -319,6 +324,7 @@ considered part of a single flow. The correct choice for a given FlowSchema
319324
depends on the resource and your particular environment.
320325

321326
## Diagnostics
327+
322328
Every HTTP response from an API server with the priority and fairness feature
323329
enabled has two extra headers: `X-Kubernetes-PF-FlowSchema-UID` and
324330
`X-Kubernetes-PF-PriorityLevel-UID`, noting the flow schema that matched the request
@@ -356,13 +362,14 @@ poorly-behaved workloads that may be harming system health.
356362
matched the request), `priority_level` (indicating the one to which
357363
the request was assigned), and `reason`. The `reason` label will be
358364
have one of the following values:
359-
* `queue-full`, indicating that too many requests were already
360-
queued,
361-
* `concurrency-limit`, indicating that the
362-
PriorityLevelConfiguration is configured to reject rather than
363-
queue excess requests, or
364-
* `time-out`, indicating that the request was still in the queue
365-
when its queuing time limit expired.
365+
366+
* `queue-full`, indicating that too many requests were already
367+
queued,
368+
* `concurrency-limit`, indicating that the
369+
PriorityLevelConfiguration is configured to reject rather than
370+
queue excess requests, or
371+
* `time-out`, indicating that the request was still in the queue
372+
when its queuing time limit expired.
366373

367374
* `apiserver_flowcontrol_dispatched_requests_total` is a counter
368375
vector (cumulative since server start) of requests that began
@@ -430,14 +437,15 @@ poorly-behaved workloads that may be harming system health.
430437
sample to its histogram, reporting the length of the queue immediately
431438
after the request was added. Note that this produces different
432439
statistics than an unbiased survey would.
433-
{{< note >}}
434-
An outlier value in a histogram here means it is likely that a single flow
435-
(i.e., requests by one user or for one namespace, depending on
436-
configuration) is flooding the API server, and being throttled. By contrast,
437-
if one priority level's histogram shows that all queues for that priority
438-
level are longer than those for other priority levels, it may be appropriate
439-
to increase that PriorityLevelConfiguration's concurrency shares.
440-
{{< /note >}}
440+
441+
{{< note >}}
442+
An outlier value in a histogram here means it is likely that a single flow
443+
(i.e., requests by one user or for one namespace, depending on
444+
configuration) is flooding the API server, and being throttled. By contrast,
445+
if one priority level's histogram shows that all queues for that priority
446+
level are longer than those for other priority levels, it may be appropriate
447+
to increase that PriorityLevelConfiguration's concurrency shares.
448+
{{< /note >}}
441449

442450
* `apiserver_flowcontrol_request_concurrency_limit` is a gauge vector
443451
holding the computed concurrency limit (based on the API server's
@@ -450,12 +458,13 @@ poorly-behaved workloads that may be harming system health.
450458
`priority_level` (indicating the one to which the request was
451459
assigned), and `execute` (indicating whether the request started
452460
executing).
453-
{{< note >}}
454-
Since each FlowSchema always assigns requests to a single
455-
PriorityLevelConfiguration, you can add the histograms for all the
456-
FlowSchemas for one priority level to get the effective histogram for
457-
requests assigned to that priority level.
458-
{{< /note >}}
461+
462+
{{< note >}}
463+
Since each FlowSchema always assigns requests to a single
464+
PriorityLevelConfiguration, you can add the histograms for all the
465+
FlowSchemas for one priority level to get the effective histogram for
466+
requests assigned to that priority level.
467+
{{< /note >}}
459468

460469
* `apiserver_flowcontrol_request_execution_seconds` is a histogram
461470
vector of how long requests took to actually execute, broken down by
@@ -465,14 +474,19 @@ poorly-behaved workloads that may be harming system health.
465474

466475
### Debug endpoints
467476

468-
When you enable the API Priority and Fairness feature, the kube-apiserver serves the following additional paths at its HTTP[S] ports.
477+
When you enable the API Priority and Fairness feature, the `kube-apiserver`
478+
serves the following additional paths at its HTTP[S] ports.
479+
480+
- `/debug/api_priority_and_fairness/dump_priority_levels` - a listing of
481+
all the priority levels and the current state of each. You can fetch like this:
469482

470-
- `/debug/api_priority_and_fairness/dump_priority_levels` - a listing of all the priority levels and the current state of each. You can fetch like this:
471483
```shell
472484
kubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels
473485
```
486+
474487
The output is similar to this:
475-
```
488+
489+
```none
476490
PriorityLevelName, ActiveQueues, IsIdle, IsQuiescing, WaitingRequests, ExecutingRequests,
477491
workload-low, 0, true, false, 0, 0,
478492
global-default, 0, true, false, 0, 0,
@@ -483,12 +497,16 @@ When you enable the API Priority and Fairness feature, the kube-apiserver serves
483497
workload-high, 0, true, false, 0, 0,
484498
```
485499

486-
- `/debug/api_priority_and_fairness/dump_queues` - a listing of all the queues and their current state. You can fetch like this:
500+
- `/debug/api_priority_and_fairness/dump_queues` - a listing of all the
501+
queues and their current state. You can fetch like this:
502+
487503
```shell
488504
kubectl get --raw /debug/api_priority_and_fairness/dump_queues
489505
```
506+
490507
The output is similar to this:
491-
```
508+
509+
```none
492510
PriorityLevelName, Index, PendingRequests, ExecutingRequests, VirtualStart,
493511
workload-high, 0, 0, 0, 0.0000,
494512
workload-high, 1, 0, 0, 0.0000,
@@ -498,25 +516,33 @@ When you enable the API Priority and Fairness feature, the kube-apiserver serves
498516
leader-election, 15, 0, 0, 0.0000,
499517
```
500518

501-
- `/debug/api_priority_and_fairness/dump_requests` - a listing of all the requests that are currently waiting in a queue. You can fetch like this:
519+
- `/debug/api_priority_and_fairness/dump_requests` - a listing of all the requests
520+
that are currently waiting in a queue. You can fetch like this:
521+
502522
```shell
503523
kubectl get --raw /debug/api_priority_and_fairness/dump_requests
504524
```
525+
505526
The output is similar to this:
506-
```
527+
528+
```none
507529
PriorityLevelName, FlowSchemaName, QueueIndex, RequestIndexInQueue, FlowDistingsher, ArriveTime,
508530
exempt, <none>, <none>, <none>, <none>, <none>,
509531
system, system-nodes, 12, 0, system:node:127.0.0.1, 2020-07-23T15:26:57.179170694Z,
510532
```
511533

512-
In addition to the queued requests, the output includes one phantom line for each priority level that is exempt from limitation.
534+
In addition to the queued requests, the output includes one phantom line
535+
for each priority level that is exempt from limitation.
513536

514537
You can get a more detailed listing with a command like this:
538+
515539
```shell
516540
kubectl get --raw '/debug/api_priority_and_fairness/dump_requests?includeRequestDetails=1'
517541
```
542+
518543
The output is similar to this:
519-
```
544+
545+
```none
520546
PriorityLevelName, FlowSchemaName, QueueIndex, RequestIndexInQueue, FlowDistingsher, ArriveTime, UserName, Verb, APIPath, Namespace, Name, APIVersion, Resource, SubResource,
521547
system, system-nodes, 12, 0, system:node:127.0.0.1, 2020-07-23T15:31:03.583823404Z, system:node:127.0.0.1, create, /api/v1/namespaces/scaletest/configmaps,
522548
system, system-nodes, 12, 1, system:node:127.0.0.1, 2020-07-23T15:31:03.594555947Z, system:node:127.0.0.1, create, /api/v1/namespaces/scaletest/configmaps,
@@ -528,4 +554,4 @@ When you enable the API Priority and Fairness feature, the kube-apiserver serves
528554
For background information on design details for API priority and fairness, see
529555
the [enhancement proposal](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1040-priority-and-fairness).
530556
You can make suggestions and feature requests via [SIG API Machinery](https://github.com/kubernetes/community/tree/master/sig-api-machinery)
531-
or the feature's [slack channel](http://kubernetes.slack.com/messages/api-priority-and-fairness).
557+
or the feature's [slack channel](https://kubernetes.slack.com/messages/api-priority-and-fairness).

0 commit comments

Comments
 (0)