Skip to content

Commit b6a7ad7

Browse files
authored
Merge pull request #49004 from michellengnx/merged-main-dev-1.32
Merge main branch into dev-1.32
2 parents d13b3ea + baba5e4 commit b6a7ad7

File tree

41 files changed

+2627
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2627
-252
lines changed

content/bn/_index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{% blocks/feature image="flower" id="feature-primary" %}}
1313
[কুবারনেটিস]({{< relref "/docs/concepts/overview/" >}}), K8s নামেও পরিচিত, কনটেইনারাইজড অ্যাপ্লিকেশনের স্বয়ংক্রিয় ডিপ্লয়মেন্ট, স্কেলিং এবং পরিচালনার জন্য একটি ওপেন-সোর্স সিস্টেম।
1414

15-
এটি সহজ ব্যবস্থাপনা এবং আবিষ্কারের জন্য লজিক্যাল ইউনিটে একটি অ্যাপ্লিকেশন তৈরি করে এমন কন্টেইনারগুলিকে গোষ্ঠীভুক্ত করে। কুবারনেটিস [Google-এ প্রোডাকশন ওয়ার্কলোড চালানোর 15 বছরের অভিজ্ঞতার ভিত্তিতে](http://queue.acm.org/detail.cfm?id=2898444) তৈরি করে, কমিউনিটির সেরা ধারণা এবং অনুশীলনের সাথে মিলিত ভাবে।
15+
এটি সহজ ব্যবস্থাপনা এবং আবিষ্কারের জন্য লজিক্যাল ইউনিটে একটি অ্যাপ্লিকেশন তৈরি করে এমন কন্টেইনারগুলিকে গোষ্ঠীভুক্ত করে। কুবারনেটিস [Google-এ প্রোডাকশন ওয়ার্কলোড চালানোর 15 বছরের অভিজ্ঞতার ভিত্তিতে](https://queue.acm.org/detail.cfm?id=2898444) তৈরি করে, কমিউনিটির সেরা ধারণা এবং অনুশীলনের সাথে মিলিত ভাবে।
1616
{{% /blocks/feature %}}
1717

1818
{{% blocks/feature image="scalable" %}}

content/en/blog/_posts/2024-12-11-Kubernetes-v1-32-Release/index.md

Lines changed: 505 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
layout: blog
3+
title: 'Kubernetes v1.32 Adds A New CPU Manager Static Policy Option For Strict CPU Reservation'
4+
draft: true
5+
date: 2024-12-11
6+
slug: cpumanager-strict-cpu-reservation
7+
author: >
8+
[Jing Zhang](https://github.com/jingczhang) (Nokia)
9+
---
10+
11+
In Kubernetes v1.32, after years of community discussion, we are excited to introduce a
12+
`strict-cpu-reservation` option for the [CPU Manager static policy](/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options).
13+
This feature is currently in alpha, with the associated policy hidden by default. You can only use the
14+
policy if you explicitly enable the alpha behavior in your cluster.
15+
16+
17+
## Understanding the feature
18+
19+
The CPU Manager static policy is used to reduce latency or improve performance. The `reservedSystemCPUs` defines an explicit CPU set for OS system daemons and kubernetes system daemons. This option is designed for Telco/NFV type use cases where uncontrolled interrupts/timers may impact the workload performance. you can use this option to define the explicit cpuset for the system/kubernetes daemons as well as the interrupts/timers, so the rest CPUs on the system can be used exclusively for workloads, with less impact from uncontrolled interrupts/timers. More details of this parameter can be found on the [Explicitly Reserved CPU List](/docs/tasks/administer-cluster/reserve-compute-resources/#explicitly-reserved-cpu-list) page.
20+
21+
If you want to protect your system daemons and interrupt processing, the obvious way is to use the `reservedSystemCPUs` option.
22+
23+
However, until the Kubernetes v1.32 release, this isolation was only implemented for guaranteed
24+
pods that made requests for a whole number of CPUs. At pod admission time, the kubelet only
25+
compares the CPU _requests_ against the allocatable CPUs. In Kubernetes, limits can be higher than
26+
the requests; the previous implementation allowed burstable and best-effort pods to use up
27+
the capacity of `reservedSystemCPUs`, which could then starve host OS services of CPU - and we
28+
know that people saw this in real life deployments.
29+
The existing behavior also made benchmarking (for both infrastructure and workloads) results inaccurate.
30+
31+
When this new `strict-cpu-reservation` policy option is enabled, the CPU Manager static policy will not allow any workload to use the reserved system CPU cores.
32+
33+
34+
## Enabling the feature
35+
36+
To enable this feature, you need to turn on both the `CPUManagerPolicyAlphaOptions` feature gate and the `strict-cpu-reservation` policy option. And you need to remove the `/var/lib/kubelet/cpu_manager_state` file if it exists and restart kubelet.
37+
38+
With the following kubelet configuration:
39+
40+
```yaml
41+
kind: KubeletConfiguration
42+
apiVersion: kubelet.config.k8s.io/v1beta1
43+
featureGates:
44+
...
45+
CPUManagerPolicyOptions: true
46+
CPUManagerPolicyAlphaOptions: true
47+
cpuManagerPolicy: static
48+
cpuManagerPolicyOptions:
49+
strict-cpu-reservation: "true"
50+
reservedSystemCPUs: "0,32,1,33,16,48"
51+
...
52+
```
53+
54+
When `strict-cpu-reservation` is not set or set to false:
55+
```console
56+
# cat /var/lib/kubelet/cpu_manager_state
57+
{"policyName":"static","defaultCpuSet":"0-63","checksum":1058907510}
58+
```
59+
60+
When `strict-cpu-reservation` is set to true:
61+
```console
62+
# cat /var/lib/kubelet/cpu_manager_state
63+
{"policyName":"static","defaultCpuSet":"2-15,17-31,34-47,49-63","checksum":4141502832}
64+
```
65+
66+
67+
## Monitoring the feature
68+
69+
You can monitor the feature impact by checking the following CPU Manager counters:
70+
- `cpu_manager_shared_pool_size_millicores`: report shared pool size, in millicores (e.g. 13500m)
71+
- `cpu_manager_exclusive_cpu_allocation_count`: report exclusively allocated cores, counting full cores (e.g. 16)
72+
73+
Your best-effort workloads may starve if the `cpu_manager_shared_pool_size_millicores` count is zero for prolonged time.
74+
75+
We believe any pod that is required for operational purpose like a log forwarder should not run as best-effort, but you can review and adjust the amount of CPU cores reserved as needed.
76+
77+
## Conclusion
78+
79+
Strict CPU reservation is critical for Telco/NFV use cases. It is also a prerequisite for enabling the all-in-one type of deployments where workloads are placed on nodes serving combined control+worker+storage roles.
80+
81+
We want you to start using the feature and looking forward to your feedback.
82+
83+
84+
## Further reading
85+
86+
Please check out the [Control CPU Management Policies on the Node](/docs/tasks/administer-cluster/cpu-management-policies/)
87+
task page to learn more about the CPU Manager, and how it fits in relation to the other node-level resource managers.
88+
89+
90+
## Getting involved
91+
92+
This feature is driven by the [SIG Node](https://github.com/Kubernetes/community/blob/master/sig-node/README.md). If you are interested in helping develop this feature, sharing feedback, or participating in any other ongoing SIG Node projects, please attend the SIG Node meeting for more details.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
layout: blog
3+
title: "Kubernetes v1.32: QueueingHint Brings a New Possibility to Optimize Pod Scheduling"
4+
date: 2024-12-12
5+
slug: scheduler-queueinghint
6+
draft: true
7+
Author: >
8+
[Kensei Nakada](https://github.com/sanposhiho) (Tetrate.io)
9+
---
10+
11+
The Kubernetes [scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/) is the core
12+
component that selects the nodes on which new Pods run. The scheduler processes
13+
these new Pods **one by one**. Therefore, the larger your clusters, the more important
14+
the throughput of the scheduler becomes.
15+
16+
Over the years, the Kubernetes project (and SIG Scheduling in particular) has improved the throughput
17+
of the scheduler in multiple enhancements. This blog post describes a major improvement to the
18+
scheduler in Kubernetes v1.32: a
19+
[scheduling context element](/docs/concepts/scheduling-eviction/scheduling-framework/#extension-points)
20+
named _QueueingHint_. This page provides background knowledge of the scheduler and explains how
21+
QueueingHint improves scheduling throughput.
22+
23+
## Scheduling queue
24+
25+
The scheduler stores all unscheduled Pods in an internal component called the _scheduling queue_.
26+
27+
The scheduling queue consists of the following data structures:
28+
- **ActiveQ**: holds newly created Pods or Pods that are ready to be retried for scheduling.
29+
- **BackoffQ**: holds Pods that are ready to be retried but are waiting for a backoff period to end. The
30+
backoff period depends on the number of unsuccessful scheduling attempts performed by the scheduler on that Pod.
31+
- **Unschedulable Pod Pool**: holds Pods that the scheduler won't attempt to schedule for one of the
32+
following reasons:
33+
- The scheduler previously attempted and was unable to schedule the Pods. Since that attempt, the cluster
34+
hasn't changed in a way that could make those Pods schedulable.
35+
- The Pods are blocked from entering the scheduling cycles by PreEnqueue Plugins,
36+
for example, they have a [scheduling gate](/docs/concepts/scheduling-eviction/pod-scheduling-readiness/#configuring-pod-schedulinggates),
37+
and get blocked by the scheduling gate plugin.
38+
39+
## Scheduling framework and plugins
40+
41+
The Kubernetes scheduler is implemented following the Kubernetes
42+
[scheduling framework](/docs/concepts/scheduling-eviction/scheduling-framework/).
43+
44+
And, all scheduling features are implemented as plugins
45+
(e.g., [Pod affinity](/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
46+
is implemented in the `InterPodAffinity` plugin.)
47+
48+
The scheduler processes pending Pods in phases called _cycles_ as follows:
49+
1. **Scheduling cycle**: the scheduler takes pending Pods from the activeQ component of the scheduling
50+
queue _one by one_. For each Pod, the scheduler runs the filtering/scoring logic from every scheduling plugin. The
51+
scheduler then decides on the best node for the Pod, or decides that the Pod can't be scheduled at that time.
52+
53+
If the scheduler decides that a Pod can't be scheduled, that Pod enters the Unschedulable Pod Pool
54+
component of the scheduling queue. However, if the scheduler decides to place the Pod on a node,
55+
the Pod goes to the binding cycle.
56+
57+
1. **Binding cycle**: the scheduler communicates the node placement decision to the Kubernetes API
58+
server. This operation bounds the Pod to the selected node.
59+
60+
Aside from some exceptions, most unscheduled Pods enter the unschedulable pod pool after each scheduling
61+
cycle. The Unschedulable Pod Pool component is crucial because of how the scheduling cycle processes Pods one by one. If the scheduler had to constantly retry placing unschedulable Pods, instead of offloading those
62+
Pods to the Unschedulable Pod Pool, multiple scheduling cycles would be wasted on those Pods.
63+
64+
## Improvements to retrying Pod scheduling with QueuingHint
65+
66+
Unschedulable Pods only move back into the ActiveQ or BackoffQ components of the scheduling
67+
queue if changes in the cluster might allow the scheduler to place those Pods on nodes.
68+
69+
Prior to v1.32, each plugin registered which cluster changes could solve their failures, an object creation, update, or deletion in the cluster (called _cluster events_),
70+
with `EnqueueExtensions` (`EventsToRegister`),
71+
and the scheduling queue retries a pod with an event that is registered by a plugin that rejected the pod in a previous scheduling cycle.
72+
73+
Additionally, we had an internal feature called `preCheck`, which helped further filtering of events for efficiency, based on Kubernetes core scheduling constraints;
74+
For example, `preCheck` could filter out node-related events when the node status is `NotReady`.
75+
76+
However, we had two issues for those approaches:
77+
- Requeueing with events was too broad, could lead to scheduling retries for no reason.
78+
- A new scheduled Pod _might_ solve the `InterPodAffinity`'s failure, but not all of them do.
79+
For example, if a new Pod is created, but without a label matching `InterPodAffinity` of the unschedulable pod, the pod wouldn't be schedulable.
80+
- `preCheck` relied on the logic of in-tree plugins and was not extensible to custom plugins,
81+
like in issue [#110175](https://github.com/kubernetes/kubernetes/issues/110175).
82+
83+
Here QueueingHints come into play;
84+
a QueueingHint subscribes to a particular kind of cluster event, and make a decision about whether each incoming event could make the Pod schedulable.
85+
86+
For example, consider a Pod named `pod-a` that has a required Pod affinity. `pod-a` was rejected in
87+
the scheduling cycle by the `InterPodAffinity` plugin because no node had an existing Pod that matched
88+
the Pod affinity specification for `pod-a`.
89+
90+
{{< figure src="queueinghint1.svg" alt="A diagram showing the scheduling queue and pod-a rejected by InterPodAffinity plugin" caption="A diagram showing the scheduling queue and pod-a rejected by InterPodAffinity plugin" >}}
91+
92+
`pod-a` moves into the Unschedulable Pod Pool. The scheduling queue records which plugin caused
93+
the scheduling failure for the Pod. For `pod-a`, the scheduling queue records that the `InterPodAffinity`
94+
plugin rejected the Pod.
95+
96+
`pod-a` will never be schedulable until the InterPodAffinity failure is resolved.
97+
There're some scenarios that the failure could be resolved, one example is an existing running pod gets a label update and becomes matching a Pod affinity.
98+
For this scenario, the `InterPodAffinity` plugin's `QueuingHint` callback function checks every Pod label update that occurs in the cluster.
99+
Then, if a Pod gets a label update that matches the Pod affinity requirement of `pod-a`, the `InterPodAffinity`,
100+
plugin's `QueuingHint` prompts the scheduling queue to move `pod-a` back into the ActiveQ or
101+
the BackoffQ component.
102+
103+
{{< figure src="queueinghint2.svg" alt="A diagram showing the scheduling queue and pod-a being moved by InterPodAffinity QueueingHint" caption="A diagram showing the scheduling queue and pod-a being moved by InterPodAffinity QueueingHint" >}}
104+
105+
## QueueingHint's history and what's new in v1.32
106+
107+
At SIG Scheduling, we have been working on the development of QueueingHint since
108+
Kubernetes v1.28.
109+
110+
While QueuingHint isn't user-facing, we implemented the `SchedulerQueueingHints` feature gate as a
111+
safety measure when we originally added this feature. In v1.28, we implemented QueueingHints with a
112+
few in-tree plugins experimentally, and made the feature gate enabled by default.
113+
114+
However, users reported a memory leak, and consequently we disabled the feature gate in a
115+
patch release of v1.28. From v1.28 until v1.31, we kept working on the QueueingHint implementation
116+
within the rest of the in-tree plugins and fixing bugs.
117+
118+
In v1.32, we made this feature enabled by default again. We finished implementing QueueingHints
119+
in all plugins and also identified the cause of the memory leak!
120+
121+
We thank all the contributors who participated in the development of this feature and those who reported and investigated the earlier issues.
122+
123+
## Getting involved
124+
125+
These features are managed by Kubernetes [SIG Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).
126+
127+
Please join us and share your feedback.
128+
129+
## How can I learn more?
130+
131+
- [KEP-4247: Per-plugin callback functions for efficient requeueing in the scheduling queue](https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/4247-queueinghint/README.md)

content/en/blog/_posts/2024-12-12-scheduler-queueinghint/queueinghint1.svg

Lines changed: 4 additions & 0 deletions
Loading

content/en/blog/_posts/2024-12-12-scheduler-queueinghint/queueinghint2.svg

Lines changed: 4 additions & 0 deletions
Loading

content/en/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ Here are some examples of device plugin implementations:
486486
* [Akri](https://github.com/project-akri/akri), which lets you easily expose heterogeneous leaf devices (such as IP cameras and USB devices).
487487
* The [AMD GPU device plugin](https://github.com/ROCm/k8s-device-plugin)
488488
* The [generic device plugin](https://github.com/squat/generic-device-plugin) for generic Linux devices and USB devices
489+
* The [HAMi](https://github.com/Project-HAMi/HAMi) for heterogeneous AI computing virtualization middleware (for example, NVIDIA, Cambricon, Hygon, Iluvatar, MThreads, Ascend, Metax)
489490
* The [Intel device plugins](https://github.com/intel/intel-device-plugins-for-kubernetes) for
490491
Intel GPU, FPGA, QAT, VPU, SGX, DSA, DLB and IAA devices
491492
* The [KubeVirt device plugins](https://github.com/kubevirt/kubernetes-device-plugins) for

0 commit comments

Comments
 (0)