<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kubernetes Blog</title>
    <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/</link>
    <description>The Kubernetes blog is used by the project to communicate new features, community reports, and any news that might be relevant to the Kubernetes community.</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language>
    <image>
      <url>https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.png</url>
      <title>The Kubernetes project logo</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/</link>
    </image>
    
    <atom:link href="https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/feed.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Kubernetes v1.34 抢先一览</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/07/28/kubernetes-v1-34-sneak-peek/</link>
      <pubDate>Mon, 28 Jul 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/07/28/kubernetes-v1-34-sneak-peek/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.34 Sneak Peek&#39;
date: 2025-07-28
slug: kubernetes-v1-34-sneak-peek
author: &gt;
  Agustina Barbetta,
  Alejandro Josue Leon Bellido,
  Graziano Casto,
  Melony Qin,
  Dipesh Rawat
--&gt;
&lt;!--
Kubernetes v1.34 is coming at the end of August 2025. 
This release will not include any removal or deprecation, but it is packed with an impressive number of enhancements. 
Here are some of the features we are most excited about in this cycle!  

Please note that this information reflects the current state of v1.34 development and may change before release.
--&gt;
&lt;p&gt;Kubernetes v1.34 将于 2025 年 8 月底发布。
本次发版不会移除或弃用任何特性，但包含了数量惊人的增强特性。
以下列出一些本次发版最令人兴奋的特性！&lt;/p&gt;
&lt;p&gt;请注意，以下内容反映的是 v1.34 当前的开发状态，发布前可能会发生变更。&lt;/p&gt;
&lt;!--
## Featured enhancements of Kubernetes v1.34

The following list highlights some of the notable enhancements likely to be included in the v1.34 release, 
but is not an exhaustive list of all planned changes. 
This is not a commitment and the release content is subject to change.
--&gt;
&lt;h2 id=&#34;kubernetes-v1-34-的重点增强特性&#34;&gt;Kubernetes v1.34 的重点增强特性&lt;/h2&gt;
&lt;p&gt;以下列出了一些可能会包含在 v1.34 版本中的重要增强特性，
但这并不是所有计划更改的详尽列表。
这并不构成承诺，发布内容可能会发生变更。&lt;/p&gt;
&lt;!--
### The core of DRA targets stable

[Dynamic Resource Allocation](/docs/concepts/scheduling-eviction/dynamic-resource-allocation/) (DRA) provides a flexible way to categorize, 
request, and use devices like GPUs or custom hardware in your Kubernetes cluster.
--&gt;
&lt;h3 id=&#34;dra-核心功能趋向稳定&#34;&gt;DRA 核心功能趋向稳定&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/dynamic-resource-allocation/&#34;&gt;动态资源分配&lt;/a&gt;（DRA）
提供了一种灵活的方式来分类、请求和使用集群中的 GPU 或定制硬件等设备。&lt;/p&gt;
&lt;!--
Since the v1.30 release, DRA has been based around claiming devices using _structured parameters_ that are opaque to the core of Kubernetes.
The relevant enhancement proposal, [KEP-4381](https://kep.k8s.io/4381), took inspiration from dynamic provisioning for storage volumes.
DRA with structured parameters relies on a set of supporting API kinds: ResourceClaim, DeviceClass, ResourceClaimTemplate, 
and ResourceSlice API types under `resource.k8s.io`, while extending the `.spec` for Pods with a new `resourceClaims` field.
The core of DRA is targeting graduation to stable in Kubernetes v1.34.
--&gt;
&lt;p&gt;自 v1.30 版本起，DRA 已基于&lt;strong&gt;结构化参数&lt;/strong&gt;来申领设备，这些参数对于 Kubernetes 核心是不可见的。
相关增强提案 &lt;a href=&#34;https://kep.k8s.io/4381&#34;&gt;KEP-4381&lt;/a&gt; 借鉴了存储卷动态制备的思路。
使用结构化参数的 DRA 依赖一组辅助 API 类别：包括 &lt;code&gt;resource.k8s.io&lt;/code&gt; 下的
ResourceClaim、DeviceClass、ResourceClaimTemplate 和 ResourceSlice，
还在 Pod 的 &lt;code&gt;.spec&lt;/code&gt; 中新增了 &lt;code&gt;resourceClaims&lt;/code&gt; 字段。
DRA 的核心功能计划在 Kubernetes v1.34 中进阶至稳定阶段。&lt;/p&gt;
&lt;!--
With DRA, device drivers and cluster admins define device classes that are available for use. 
Workloads can claim devices from a device class within device requests. 
Kubernetes allocates matching devices to specific claims and places the corresponding Pods on nodes that can access the allocated devices. 
This framework provides flexible device filtering using CEL, centralized device categorization, and simplified Pod requests, among other benefits.

Once this feature has graduated, the `resource.k8s.io/v1` APIs will be available by default.
--&gt;
&lt;p&gt;借助 DRA，设备驱动和集群管理员定义可用的设备类。
工作负载可以在设备请求中从设备类申领设备。
Kubernetes 为每个申领分配匹配的设备，并将相关 Pod 安排到可访问所分配设备的节点上。
这种框架提供了使用 CEL 的灵活设备筛选、集中式设备分类和简化的 Pod 请求等优点。&lt;/p&gt;
&lt;p&gt;一旦此特性进入稳定阶段，&lt;code&gt;resource.k8s.io/v1&lt;/code&gt; API 将默认可用。&lt;/p&gt;
&lt;!--
### ServiceAccount tokens for image pull authentication

The [ServiceAccount](/docs/concepts/security/service-accounts/) token integration for `kubelet` credential providers is likely to reach beta and be enabled by default in Kubernetes v1.34. 
This allows the `kubelet` to use these tokens when pulling container images from registries that require authentication.

That support already exists as alpha, and is tracked as part of [KEP-4412](https://kep.k8s.io/4412).
--&gt;
&lt;h3 id=&#34;使用-serviceaccount-令牌进行镜像拉取身份认证&#34;&gt;使用 ServiceAccount 令牌进行镜像拉取身份认证&lt;/h3&gt;
&lt;p&gt;ServiceAccount 令牌与 kubelet 凭据提供程序集成的特性预计将在 Kubernetes v1.34 中进入 Beta 阶段并默认启用。
这将允许 kubelet 在从需要身份认证的镜像仓库中拉取容器镜像时使用这些令牌。&lt;/p&gt;
&lt;p&gt;此特性已作为 Alpha 存在，并由 &lt;a href=&#34;https://kep.k8s.io/4412&#34;&gt;KEP-4412&lt;/a&gt; 跟踪。&lt;/p&gt;
&lt;!--
The existing alpha integration allows the `kubelet` to use short-lived, automatically rotated ServiceAccount tokens (that follow OIDC-compliant semantics) to authenticate to a container image registry. 
Each token is scoped to one associated Pod; the overall mechanism replaces the need for long-lived image pull Secrets.

Adopting this new approach reduces security risks, supports workload-level identity, and helps cut operational overhead. 
It brings image pull authentication closer to modern, identity-aware good practice.
--&gt;
&lt;p&gt;现有的 Alpha 集成允许 kubelet 使用生命期短、自动轮换的 ServiceAccount 令牌
（符合 OIDC 标准）来向容器镜像仓库进行身份认证。
每个令牌与一个 Pod 相关联；整个机制可替代长期存在的镜像拉取 Secret。&lt;/p&gt;
&lt;p&gt;采用这一新方式可以降低安全风险、支持工作负载级身份，并减少运维负担。
它让镜像拉取认证更加贴合现代、具备身份感知的最佳实践。&lt;/p&gt;
&lt;!--
### Pod replacement policy for Deployments

After a change to a [Deployment](/docs/concepts/workloads/controllers/deployment/), terminating pods may stay up for a considerable amount of time and may consume additional resources.
As part of [KEP-3973](https://kep.k8s.io/3973), the `.spec.podReplacementPolicy` field will be introduced (as alpha) for Deployments.

If your cluster has the feature enabled, you&#39;ll be able to select one of two policies:
--&gt;
&lt;h3 id=&#34;deployment-的-pod-替换策略&#34;&gt;Deployment 的 Pod 替换策略&lt;/h3&gt;
&lt;p&gt;对 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/deployment/&#34;&gt;Deployment&lt;/a&gt;
做出变更后，终止中的 Pod 可能会保留较长时间，并消耗额外资源。
作为 &lt;a href=&#34;https://kep.k8s.io/3973&#34;&gt;KEP-3973&lt;/a&gt; 的一部分，&lt;code&gt;.spec.podReplacementPolicy&lt;/code&gt;
字段将以 Alpha 形式引入到 Deployment 中。&lt;/p&gt;
&lt;p&gt;如果你的集群启用了此特性，你可以选择以下两种策略之一：&lt;/p&gt;
&lt;!--
`TerminationStarted`
: Creates new pods as soon as old ones start terminating, resulting in faster rollouts at the cost of potentially higher resource consumption.

`TerminationComplete`
: Waits until old pods fully terminate before creating new ones, resulting in slower rollouts but ensuring controlled resource consumption.
--&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;TerminationStarted&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;一旦旧 Pod 开始终止，立即创建新 Pod，带来更快的上线速度，但资源消耗可能更高。&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;TerminationComplete&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;等待旧 Pod 完全终止后才创建新 Pod，上线速度较慢，但资源消耗控制更好。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
This feature makes Deployment behavior more predictable by letting you choose when new pods should be created during updates or scaling. 
It&#39;s beneficial when working in clusters with tight resource constraints or with workloads with long termination periods. 

It&#39;s expected to be available as an alpha feature and can be enabled using the `DeploymentPodReplacementPolicy` and `DeploymentReplicaSetTerminatingReplicas` feature gates in the API server and kube-controller-manager.
--&gt;
&lt;p&gt;此特性通过让你选择更新或扩缩容期间何时创建新 Pod，从而使 Deployment 行为更可控。
在资源受限的集群或终止时间较长的工作负载中尤为有用。&lt;/p&gt;
&lt;p&gt;预计此特性将作为 Alpha 特性推出，并可通过在 API 服务器和 kube-controller-manager 中启用
&lt;code&gt;DeploymentPodReplacementPolicy&lt;/code&gt; 和 &lt;code&gt;DeploymentReplicaSetTerminatingReplicas&lt;/code&gt; 特性门控启用。&lt;/p&gt;
&lt;!--
### Production-ready tracing for `kubelet` and API Server

To address the longstanding challenge of debugging node-level issues by correlating disconnected logs, 
[KEP-2831](https://kep.k8s.io/2831) provides deep, contextual insights into the `kubelet`.
--&gt;
&lt;h3 id=&#34;kubelet-和-api-服务器的生产级追踪特性&#34;&gt;kubelet 和 API 服务器的生产级追踪特性&lt;/h3&gt;
&lt;p&gt;为了解决通过日志关联进行节点级调试的长期难题，
&lt;a href=&#34;https://kep.k8s.io/2831&#34;&gt;KEP-2831&lt;/a&gt; 为 kubelet 提供了深度上下文可视化能力。&lt;/p&gt;
&lt;!--
This feature instruments critical `kubelet` operations, particularly its gRPC calls to the Container Runtime Interface (CRI), using the vendor-agnostic OpenTelemetry standard. 
It allows operators to visualize the entire lifecycle of events (for example: a Pod startup) to pinpoint sources of latency and errors. 
Its most powerful aspect is the propagation of trace context; the `kubelet` passes a trace ID with its requests to the container runtime, enabling runtimes to link their own spans.
--&gt;
&lt;p&gt;此特性使用供应商中立的 OpenTelemetry 标准，为关键的 kubelet 操作（特别是其对容器运行时接口的 gRPC 调用）做了插桩。
它使运维人员能够可视化整个事件生命周期（例如：Pod 启动）以定位延迟或错误来源。
其强大之处在于传播链路上下文：kubelet 在向容器运行时发送请求时附带链路 ID，使运行时能够链接自身的 Span。&lt;/p&gt;
&lt;!--
This effort is complemented by a parallel enhancement, [KEP-647](https://kep.k8s.io/647), which brings the same tracing capabilities to the Kubernetes API server. 
Together, these enhancements provide a more unified, end-to-end view of events, simplifying the process of pinpointing latency and errors from the control plane down to the node. 
These features have matured through the official Kubernetes release process. 
[KEP-2831](https://kep.k8s.io/2831) was introduced as an alpha feature in v1.25, while [KEP-647](https://kep.k8s.io/647) debuted as alpha in v1.22. 
Both enhancements were promoted to beta together in the v1.27 release. 
Looking forward, Kubelet Tracing ([KEP-2831](https://kep.k8s.io/2831)) and API Server Tracing ([KEP-647](https://kep.k8s.io/647)) are now targeting graduation to stable in the upcoming v1.34 release.
--&gt;
&lt;p&gt;这一工作得到了另一个增强提案 &lt;a href=&#34;https://kep.k8s.io/647&#34;&gt;KEP-647&lt;/a&gt; 的配合，
后者为 Kubernetes API 服务器引入了相同的链路追踪能力。
两者结合提供了从控制面到节点的端到端事件视图，极大简化了定位延迟和错误的过程。
这些特性已在 Kubernetes 正式版本发布流程中逐渐成熟：&lt;br&gt;
&lt;a href=&#34;https://kep.k8s.io/2831&#34;&gt;KEP-2831&lt;/a&gt; 在 v1.25 中以 Alpha 发布，
&lt;a href=&#34;https://kep.k8s.io/647&#34;&gt;KEP-647&lt;/a&gt; 在 v1.22 中首次作为 Alpha 发布，
这两个特性在 v1.27 中一起进阶至 Beta。
展望未来，kubelet 追踪（&lt;a href=&#34;https://kep.k8s.io/2831&#34;&gt;KEP-2831&lt;/a&gt;）和
API 服务器追踪（&lt;a href=&#34;https://kep.k8s.io/647&#34;&gt;KEP-647&lt;/a&gt;）计划在 v1.34 中进入稳定阶段。&lt;/p&gt;
&lt;!--
### `PreferSameZone` and `PreferSameNode` traffic distribution for Services

The `spec.trafficDistribution` field within a Kubernetes [Service](/docs/concepts/services-networking/service/) allows users to express preferences for how traffic should be routed to Service endpoints. 
--&gt;
&lt;h3 id=&#34;service-的-prefersamezone-和-prefersamenode-流量分发&#34;&gt;Service 的 &lt;code&gt;PreferSameZone&lt;/code&gt; 和 &lt;code&gt;PreferSameNode&lt;/code&gt; 流量分发&lt;/h3&gt;
&lt;p&gt;Kubernetes &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/service/&#34;&gt;Service&lt;/a&gt; 的
&lt;code&gt;spec.trafficDistribution&lt;/code&gt; 字段允许用户表达服务端点的流量路由偏好。&lt;/p&gt;
&lt;!--
[KEP-3015](https://kep.k8s.io/3015) deprecates `PreferClose` and introduces two additional values: `PreferSameZone` and `PreferSameNode`. 
`PreferSameZone` is equivalent to the current `PreferClose`. 
`PreferSameNode` prioritizes sending traffic to endpoints on the same node as the client.  

This feature was introduced in v1.33 behind the `PreferSameTrafficDistribution` feature gate. 
It is targeting graduation to beta in v1.34 with its feature gate enabled by default.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://kep.k8s.io/3015&#34;&gt;KEP-3015&lt;/a&gt; 弃用了 &lt;code&gt;PreferClose&lt;/code&gt;，并引入了两个新值：&lt;code&gt;PreferSameZone&lt;/code&gt; 和 &lt;code&gt;PreferSameNode&lt;/code&gt;。
&lt;code&gt;PreferSameZone&lt;/code&gt; 等价于当前的 &lt;code&gt;PreferClose&lt;/code&gt;；&lt;br&gt;
&lt;code&gt;PreferSameNode&lt;/code&gt; 优先将流量发送至与客户端位于同一节点的端点。&lt;/p&gt;
&lt;p&gt;此特性在 v1.33 中引入，受 &lt;code&gt;PreferSameTrafficDistribution&lt;/code&gt; 特性门控控制。
v1.34 中此特性预计将进入 Beta，并默认启用。&lt;/p&gt;
&lt;!--
### Support for KYAML: a Kubernetes dialect of YAML

KYAML aims to be a safer and less ambiguous YAML subset, and was designed specifically
for Kubernetes. Whatever version of Kubernetes you use, you&#39;ll be able use KYAML for writing manifests
and/or Helm charts.
You can write KYAML and pass it as an input to **any** version of `kubectl`,
because all KYAML files are also valid as YAML.
With kubectl v1.34, we expect you&#39;ll also be able to request KYAML output from `kubectl` (as in `kubectl get -o kyaml …`).
If you prefer, you can still request the output in JSON or YAML format.
--&gt;
&lt;h3 id=&#34;支持-kyaml-kubernetes-的-yaml-方言&#34;&gt;支持 KYAML：Kubernetes 的 YAML 方言&lt;/h3&gt;
&lt;p&gt;KYAML 是为 Kubernetes 设计的更安全、更少歧义的 YAML 子集。
无论你使用哪个版本的 Kubernetes，都可以使用 KYAML 编写清单和 Helm 模板。
你可以编写 KYAML 并将其作为输入传递给&lt;strong&gt;任意&lt;/strong&gt;版本的 kubectl，因为所有 KYAML 文件都是合法的 YAML。
在 kubectl v1.34 中，你还可以请求以 KYAML 格式输出（如：&lt;code&gt;kubectl get -o kyaml …&lt;/code&gt;）。
当然，如果你愿意，也可以继续使用 JSON 或 YAML 格式输出。&lt;/p&gt;
&lt;!--
KYAML addresses specific challenges with both YAML and JSON. 
YAML&#39;s significant whitespace requires careful attention to indentation and nesting, 
while its optional string-quoting can lead to unexpected type coercion (for example: [&#34;The Norway Bug&#34;](https://hitchdev.com/strictyaml/why/implicit-typing-removed/)). 
Meanwhile, JSON lacks comment support and has strict requirements for trailing commas and quoted keys.  

[KEP-5295](https://kep.k8s.io/5295) introduces KYAML, which tries to address the most significant problems by:
--&gt;
&lt;p&gt;KYAML 解决了 YAML 和 JSON 的一些具体问题：&lt;br&gt;
YAML 对缩进的敏感性需要你注意空格和嵌套，
而其可选的字符串引号可能导致意外类型转换
（参见 &lt;a href=&#34;https://hitchdev.com/strictyaml/why/implicit-typing-removed/&#34;&gt;“挪威 bug”&lt;/a&gt;）。
与此同时，JSON 不支持注释，且对尾逗号和键的引号有严格要求。&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kep.k8s.io/5295&#34;&gt;KEP-5295&lt;/a&gt; 引入了 KYAML，尝试解决这些主要问题：&lt;/p&gt;
&lt;!--
* Always double-quoting value strings

* Leaving keys unquoted unless they are potentially ambiguous

* Always using `{}` for mappings (associative arrays)

* Always using `[]` for lists
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;所有值字符串始终使用英文双引号&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;键不加英文引号，除非可能产生歧义&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;所有映射使用 &lt;code&gt;{}&lt;/code&gt; 表示（即关联数组）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;所有列表使用 &lt;code&gt;[]&lt;/code&gt; 表示&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
This might sound a lot like JSON, because it is! But unlike JSON, KYAML supports comments, allows trailing commas, and doesn&#39;t require quoted keys.

We&#39;re hoping to see KYAML introduced as a new output format for `kubectl` v1.34.
As with all these features, none of these changes are 100% confirmed; watch this space!
--&gt;
&lt;p&gt;这听起来像 JSON？确实如此！但与 JSON 不同的是，KYAML 支持注释、允许尾逗号，且不强制键加引号。&lt;/p&gt;
&lt;p&gt;我们希望在 kubectl v1.34 中将 KYAML 引入为一种新的输出格式。
如同其他特性一样，这些变更尚未百分百确定，敬请关注！&lt;/p&gt;
&lt;!--
As a format, KYAML is and will remain a **strict subset of YAML**, ensuring that any compliant YAML parser can parse KYAML documents. 
Kubernetes does not require you to provide input specifically formatted as KYAML, and we have no plans to change that.
--&gt;
&lt;p&gt;KYAML 作为一种格式，是 YAML 的&lt;strong&gt;严格子集&lt;/strong&gt;，
这确保任何符合规范的 YAML 解析器都能解析 KYAML 文档。
Kubernetes 并不要求你必须提供 KYAML 格式的输入，也没有这方面的计划。&lt;/p&gt;
&lt;!--
### Fine-grained autoscaling control with HPA configurable tolerance

[KEP-4951](https://kep.k8s.io/4951) introduces a new feature that allows users to configure autoscaling tolerance on a per-HPA basis, 
overriding the default cluster-wide 10% tolerance setting that often proves too coarse-grained for diverse workloads. 
The enhancement adds an optional `tolerance` field to the HPA&#39;s `spec.behavior.scaleUp` and `spec.behavior.scaleDown` sections, 
enabling different tolerance values for scale-up and scale-down operations, 
which is particularly valuable since scale-up responsiveness is typically more critical than scale-down speed for handling traffic surges.
--&gt;
&lt;h3 id=&#34;hpa-支持精细化自动扩缩控制容忍度配置&#34;&gt;HPA 支持精细化自动扩缩控制容忍度配置&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://kep.k8s.io/4951&#34;&gt;KEP-4951&lt;/a&gt; 引入了一项新特性，允许用户在每个 HPA 上配置扩缩容忍度，
以覆盖默认的集群级 10% 容忍度设置，这一默认值对多样化的工作负载来说往往过于粗略。
本次增强为 HPA 的 &lt;code&gt;spec.behavior.scaleUp&lt;/code&gt; 和 &lt;code&gt;spec.behavior.scaleDown&lt;/code&gt; 部分新增了可选的 &lt;code&gt;tolerance&lt;/code&gt; 字段，
使得扩容和缩容操作可以采用不同的容忍值。
这非常有用，因为在应对突发流量时，扩容响应通常比缩容速度更为关键。&lt;/p&gt;
&lt;!--
Released as alpha in Kubernetes v1.33 behind the `HPAConfigurableTolerance` feature gate, this feature is expected to graduate to beta in v1.34.
This improvement helps to address scaling challenges with large deployments, where for scaling in,
a 10% tolerance might mean leaving hundreds of unnecessary Pods running.
Using the new, more flexible approach would enable workload-specific optimization for both
responsive and conservative scaling behaviors.
--&gt;
&lt;p&gt;此特性作为 Alpha 特性，在 Kubernetes v1.33 中引入，并受 &lt;code&gt;HPAConfigurableTolerance&lt;/code&gt; 特性门控控制。
预计将在 v1.34 中进阶为 Beta。
这项改进有助于解决大规模部署中的扩缩容难题，例如在缩容时，10% 的容忍度可能意味着会保留数百个不必要的 Pod。
通过这一更灵活的配置方式，用户可以针对不同工作负载优化扩缩容行为的响应性和保守性。&lt;/p&gt;
&lt;!--
## Want to know more?
New features and deprecations are also announced in the Kubernetes release notes. 
We will formally announce what&#39;s new in [Kubernetes v1.34](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.34.md) as part of the CHANGELOG for that release.

The Kubernetes v1.34 release is planned for **Wednesday 27th August 2025**. Stay tuned for updates!
--&gt;
&lt;h2 id=&#34;想了解更多&#34;&gt;想了解更多？&lt;/h2&gt;
&lt;p&gt;新特性和弃用项也会在 Kubernetes 发布说明中公布。我们将在
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.34.md&#34;&gt;Kubernetes v1.34&lt;/a&gt;
变更日志中正式宣布新增内容。&lt;/p&gt;
&lt;p&gt;Kubernetes v1.34 的计划发布时间为 &lt;strong&gt;2025 年 8 月 27 日（周三）&lt;/strong&gt;。敬请期待更多更新！&lt;/p&gt;
&lt;!--
## Get involved
The simplest way to get involved with Kubernetes is to join one of the many [Special Interest Groups](https://github.com/kubernetes/community/blob/master/sig-list.md) (SIGs) that align with your interests. 
Have something you&#39;d like to broadcast to the Kubernetes community? Share your voice at our weekly [community meeting](https://github.com/kubernetes/community/tree/master/communication), and through the channels below. 
Thank you for your continued feedback and support.
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;参与 Kubernetes 最简单的方式就是加入与你兴趣相关的&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-list.md&#34;&gt;特别兴趣小组（SIG）&lt;/a&gt;。
有想要向社区分享的内容？欢迎在每周的&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/communication&#34;&gt;社区会议&lt;/a&gt;上发声，
或通过以下渠道参与讨论。感谢你一如既往的反馈和支持！&lt;/p&gt;
&lt;!--
* Follow us on Bluesky [@kubernetes.io](https://bsky.app/profile/kubernetes.io) for the latest updates
* Join the community discussion on [Discuss](https://discuss.kubernetes.io/)
* Join the community on [Slack](http://slack.k8s.io/)
* Post questions (or answer questions) on [Server Fault](https://serverfault.com/questions/tagged/kubernetes) or [Stack Overflow](http://stackoverflow.com/questions/tagged/kubernetes)
* Share your Kubernetes [story](https://docs.google.com/a/linuxfoundation.org/forms/d/e/1FAIpQLScuI7Ye3VQHQTwBASrgkjQDSS5TP0g3AXfFhwSM9YpHgxRKFA/viewform)
* Read more about what&#39;s happening with Kubernetes on the [blog](https://kubernetes.io/blog/)
* Learn more about the [Kubernetes Release Team](https://github.com/kubernetes/sig-release/tree/master/release-team)
--&gt;
&lt;ul&gt;
&lt;li&gt;在 Bluesky 上关注我们 &lt;a href=&#34;https://bsky.app/profile/kubernetes.io&#34;&gt;@kubernetes.io&lt;/a&gt;，获取最新动态&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;https://discuss.kubernetes.io/&#34;&gt;Discuss&lt;/a&gt; 上参与社区讨论&lt;/li&gt;
&lt;li&gt;加入 &lt;a href=&#34;http://slack.k8s.io/&#34;&gt;Slack 社区&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;https://serverfault.com/questions/tagged/kubernetes&#34;&gt;Server Fault&lt;/a&gt; 或
&lt;a href=&#34;http://stackoverflow.com/questions/tagged/kubernetes&#34;&gt;Stack Overflow&lt;/a&gt; 上提问或回答问题&lt;/li&gt;
&lt;li&gt;分享你的 Kubernetes &lt;a href=&#34;https://docs.google.com/a/linuxfoundation.org/forms/d/e/1FAIpQLScuI7Ye3VQHQTwBASrgkjQDSS5TP0g3AXfFhwSM9YpHgxRKFA/viewform&#34;&gt;使用故事&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读 Kubernetes &lt;a href=&#34;https://kubernetes.io/blog/&#34;&gt;官方博客&lt;/a&gt;上的更多动态&lt;/li&gt;
&lt;li&gt;了解 &lt;a href=&#34;https://github.com/kubernetes/sig-release/tree/master/release-team&#34;&gt;Kubernetes 发布团队&lt;/a&gt;的更多信息&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>云原生环境中的镜像兼容性</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/25/image-compatibility-in-cloud-native-environments/</link>
      <pubDate>Wed, 25 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/25/image-compatibility-in-cloud-native-environments/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Image Compatibility In Cloud Native Environments&#34;
date: 2025-06-25
draft: false
slug: image-compatibility-in-cloud-native-environments
author: &gt;
  Chaoyi Huang (Huawei),
  Marcin Franczyk (Huawei),
  Vanessa Sochat (Lawrence Livermore National Laboratory)
--&gt;
&lt;!--
In industries where systems must run very reliably and meet strict performance criteria such as telecommunication, high-performance or AI computing, containerized applications often need specific operating system configuration or hardware presence.
It is common practice to require the use of specific versions of the kernel, its configuration, device drivers, or system components.
Despite the existence of the [Open Container Initiative (OCI)](https://opencontainers.org/), a governing community to define standards and specifications for container images, there has been a gap in expression of such compatibility requirements.
The need to address this issue has led to different proposals and, ultimately, an implementation in Kubernetes&#39; [Node Feature Discovery (NFD)](https://kubernetes-sigs.github.io/node-feature-discovery/stable/get-started/index.html).
--&gt;
&lt;p&gt;在电信、高性能或 AI 计算等必须高度可靠且满足严格性能标准的行业中，容器化应用通常需要特定的操作系统配置或硬件支持。
通常的做法是要求使用特定版本的内核、其配置、设备驱动程序或系统组件。
尽管存在&lt;a href=&#34;https://opencontainers.org/&#34;&gt;开放容器倡议 (OCI)&lt;/a&gt; 这样一个定义容器镜像标准和规范的治理社区，
但在表达这种兼容性需求方面仍存在空白。为了解决这一问题，业界提出了多个提案，并最终在 Kubernetes
的&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/stable/get-started/index.html&#34;&gt;节点特性发现 (NFD)&lt;/a&gt; 项目中实现了相关功能。&lt;/p&gt;
&lt;!--
[NFD](https://kubernetes-sigs.github.io/node-feature-discovery/stable/get-started/index.html) is an open source Kubernetes project that automatically detects and reports [hardware and system features](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/customization-guide.html#available-features) of cluster nodes. This information helps users to schedule workloads on nodes that meet specific system requirements, which is especially useful for applications with strict hardware or operating system dependencies.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/stable/get-started/index.html&#34;&gt;NFD&lt;/a&gt;
是一个开源的 Kubernetes 项目，能够自动检测并报告集群节点的&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/customization-guide.html#available-features&#34;&gt;硬件和系统特性&lt;/a&gt;。
这些信息帮助用户将工作负载调度到满足特定系统需求的节点上，尤其适用于具有严格硬件或操作系统依赖的应用。&lt;/p&gt;
&lt;!--
## The need for image compatibility specification

### Dependencies between containers and host OS

A container image is built on a base image, which provides a minimal runtime environment, often a stripped-down Linux userland, completely empty or distroless. When an application requires certain features from the host OS, compatibility issues arise. These dependencies can manifest in several ways:
--&gt;
&lt;h2 id=&#34;the-need-for-image-compatibility-specification&#34;&gt;镜像兼容性规范的需求&lt;/h2&gt;
&lt;h3 id=&#34;容器与主机操作系统之间的依赖关系&#34;&gt;容器与主机操作系统之间的依赖关系&lt;/h3&gt;
&lt;p&gt;容器镜像是基于基础镜像构建的，基础镜像提供了最小的运行时环境，通常是一个精简的 Linux 用户态环境，
有时甚至是完全空白或无发行版的。
当应用需要来自主机操作系统的某些特性时，就会出现兼容性问题。这些依赖可能表现为以下几种形式：&lt;/p&gt;
&lt;!--
- **Drivers**:
  Host driver versions must match the supported range of a library version inside the container to avoid compatibility problems. Examples include GPUs and network drivers.
- **Libraries or Software**:
  The container must come with a specific version or range of versions for a library or software to run optimally in the environment. Examples from high performance computing are MPI, EFA, or Infiniband.
- **Kernel Modules or Features**:
  Specific kernel features or modules must be present. Examples include having support of write protected huge page faults, or the presence of VFIO
- And more…
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;驱动程序&lt;/strong&gt;：
主机上的驱动程序版本必须与容器内的库所支持的版本范围相匹配，以避免兼容性问题，例如 GPU 和网络驱动。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;库或软件&lt;/strong&gt;：
容器必须包含某个库或软件的特定版本或版本范围，才能在目标环境中以最优方式运行。
高性能计算方面的示例包括 MPI、EFA 或 Infiniband。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;内核模块或特性&lt;/strong&gt;：
必须存在特定的内核特性或模块，例如对写入保护巨页错误的支持，或存在对 VFIO 的支持。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以及其他更多形式...&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
While containers in Kubernetes are the most likely unit of abstraction for these needs, the definition of compatibility can extend further to include other container technologies such as Singularity and other OCI artifacts such as binaries from a spack binary cache.
--&gt;
&lt;p&gt;虽然在 Kubernetes 中容器是这些需求最常见的抽象单位，但兼容性的定义可以进一步扩展，包括
Singularity 等其他容器技术以及来自 spack 二进制缓存的二进制文件等 OCI 工件。&lt;/p&gt;
&lt;!--
### Multi-cloud and hybrid cloud challenges

Containerized applications are deployed across various Kubernetes distributions and cloud providers, where different host operating systems introduce compatibility challenges.
Often those have to be pre-configured before workload deployment or are immutable.
For instance, different cloud providers will include different operating systems like:
--&gt;
&lt;h3 id=&#34;多云与混合云的挑战&#34;&gt;多云与混合云的挑战&lt;/h3&gt;
&lt;p&gt;容器化应用被部署在各种 Kubernetes 发行版和云平台上，而不同的主机操作系统带来了兼容性挑战。
这些操作系统通常需要在部署工作负载之前预配置，或者它们是不可变的。
例如，不同云平台会使用不同的操作系统，包括：&lt;/p&gt;
&lt;!--
- **RHCOS/RHEL**
- **Photon OS**
- **Amazon Linux 2**
- **Container-Optimized OS**
- **Azure Linux OS**
- And more...
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;RHCOS/RHEL&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Photon OS&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Amazon Linux 2&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Container-Optimized OS&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Azure Linux OS&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;等等...&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Each OS comes with unique kernel versions, configurations, and drivers, making compatibility a non-trivial issue for applications requiring specific features.
It must be possible to quickly assess a container for its suitability to run on any specific environment.
--&gt;
&lt;p&gt;每种操作系统都具有独特的内核版本、配置和驱动程序，对于需要特定特性的应用来说，兼容性问题并不简单。
因此必须能够快速评估某个容器镜像是否适合在某个特定环境中运行。&lt;/p&gt;
&lt;!--
### Image compatibility initiative

An effort was made within the [Open Containers Initiative Image Compatibility](https://github.com/opencontainers/wg-image-compatibility) working group to introduce a standard for image compatibility metadata.
A specification for compatibility would allow container authors to declare required host OS features, making compatibility requirements discoverable and programmable.
The specification implemented in Kubernetes Node Feature Discovery is one of the discussed proposals.
It aims to:
--&gt;
&lt;h3 id=&#34;镜像兼容性倡议&#34;&gt;镜像兼容性倡议&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/opencontainers/wg-image-compatibility&#34;&gt;OCI 镜像兼容性工作组&lt;/a&gt;正在推动引入一个镜像兼容性元数据的标准。
此规范允许容器作者声明所需的主机操作系统特性，使兼容性需求可以被发现和编程化处理。
目前已在 Kubernetes 的 Node Feature Discovery 中实现了其中一个被讨论的提案，其目标包括：&lt;/p&gt;
&lt;!--
- **Define a structured way to express compatibility in OCI image manifests.**
- **Support a compatibility specification alongside container images in image registries.**
- **Allow automated validation of compatibility before scheduling containers.**

The concept has since been implemented in the Kubernetes Node Feature Discovery project.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;在 OCI 镜像清单中定义一种结构化的兼容性表达方式。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;支持在镜像仓库中将兼容性规范与容器镜像一同存储。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;在容器调度之前实现兼容性自动验证。&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这个理念目前已在 Kubernetes 的 Node Feature Discovery 项目中落地。&lt;/p&gt;
&lt;!--
### Implementation in Node Feature Discovery

The solution integrates compatibility metadata into Kubernetes via NFD features and the [NodeFeatureGroup](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup) API.
This interface enables the user to match containers to nodes based on exposing features of hardware and software, allowing for intelligent scheduling and workload optimization.
--&gt;
&lt;h3 id=&#34;在-node-feature-discovery-中的实现&#34;&gt;在 Node Feature Discovery 中的实现&lt;/h3&gt;
&lt;p&gt;这种解决方案通过 NFD 的特性机制和
&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup&#34;&gt;NodeFeatureGroup&lt;/a&gt;
API 将兼容性元数据集成到 Kubernetes 中。
此接口使用户可以根据硬件和软件暴露的特性将容器与节点进行匹配，从而实现智能调度与工作负载优化。&lt;/p&gt;
&lt;!--
### Compatibility specification

The compatibility specification is a structured list of compatibility objects containing *[Node Feature Groups](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup)*.
These objects define image requirements and facilitate validation against host nodes.
The feature requirements are described by using [the list of available features](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/customization-guide.html#available-features) from the NFD project.
The schema has the following structure:
--&gt;
&lt;h3 id=&#34;兼容性规范&#34;&gt;兼容性规范&lt;/h3&gt;
&lt;p&gt;兼容性规范是一个结构化的兼容性对象列表，包含
&lt;strong&gt;&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup&#34;&gt;Node Feature Groups&lt;/a&gt;&lt;/strong&gt;。
这些对象定义了镜像要求，并支持与主机节点进行验证。特性需求通过
&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/customization-guide.html#available-features&#34;&gt;NFD 项目提供的特性列表&lt;/a&gt;进行描述。此模式的结构如下：&lt;/p&gt;
&lt;!--
- **version** (string) - Specifies the API version.
- **compatibilities** (array of objects) - List of compatibility sets.
  - **rules** (object) - Specifies [NodeFeatureGroup](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup) to define image requirements.
  - **weight** (int, optional) - Node affinity weight.
  - **tag** (string, optional) - Categorization tag.
  - **description** (string, optional) - Short description.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;version&lt;/strong&gt;（字符串）— 指定 API 版本。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;compatibilities&lt;/strong&gt;（对象数组）— 兼容性集合列表。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;rules&lt;/strong&gt;（对象）— 指定
&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/usage/custom-resources.html#nodefeaturegroup&#34;&gt;NodeFeatureGroup&lt;/a&gt;
来定义镜像要求。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;weight&lt;/strong&gt;（整数，可选）— 节点亲和性权重。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt;（字符串，可选）— 分类标记。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;（字符串，可选）— 简短描述。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
An example might look like the following:
--&gt;
&lt;p&gt;示例如下：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;version&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;compatibilities&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;description&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;My image requirements&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;kernel and cpu&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchFeatures&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;feature&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;kernel.loadedmodule&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;vfio-pci&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;feature&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cpu.model&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;vendor_id&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op: In, value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Intel&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;AMD&amp;#34;&lt;/span&gt;]}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;one of available nics&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchAny&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchFeatures&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;feature&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pci.device&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;vendor&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op: In, value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0eee&amp;#34;&lt;/span&gt;]}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;class&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op: In, value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0200&amp;#34;&lt;/span&gt;]}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchFeatures&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;feature&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pci.device&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;vendor&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op: In, value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0fff&amp;#34;&lt;/span&gt;]}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;class&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;op: In, value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0200&amp;#34;&lt;/span&gt;]}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### Client implementation for node validation

To streamline compatibility validation, we implemented a [client tool](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/reference/node-feature-client-reference.html) that allows for node validation based on an image&#39;s compatibility artifact.
In this workflow, the image author would generate a compatibility artifact that points to the image it describes in a registry via the referrers API.
When a need arises to assess the fit of an image to a host, the tool can discover the artifact and verify compatibility of an image to a node before deployment.
The client can validate nodes both inside and outside a Kubernetes cluster, extending the utility of the tool beyond the single Kubernetes use case.
In the future, image compatibility could play a crucial role in creating specific workload profiles based on image compatibility requirements, aiding in more efficient scheduling.
Additionally, it could potentially enable automatic node configuration to some extent, further optimizing resource allocation and ensuring seamless deployment of specialized workloads.
--&gt;
&lt;h3 id=&#34;节点验证的客户端实现&#34;&gt;节点验证的客户端实现&lt;/h3&gt;
&lt;p&gt;为了简化兼容性验证，
我们实现了一个&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/reference/node-feature-client-reference.html&#34;&gt;客户端工具&lt;/a&gt;，
可以根据镜像的兼容性工件进行节点验证。在这个流程中，镜像作者会生成一个兼容性工件，
并通过引用者（Referrs） API 将其指向镜像所在的仓库。当需要评估某个镜像是否适用于某个主机节点时，
此工具可以发现工件并在部署前验证镜像对节点的兼容性。
客户端可以验证 Kubernetes 集群内外的节点，扩大了其应用范围。
未来，镜像兼容性还可能在基于镜像要求创建特定工作负载配置文件中发挥关键作用，有助于提升调度效率。
此外，还可能实现一定程度上的节点自动配置，进一步优化资源分配并确保特种工作负载的顺利部署。&lt;/p&gt;
&lt;!--
### Examples of usage

1. **Define image compatibility metadata**

   A [container image](/docs/concepts/containers/images) can have metadata that describes
   its requirements based on features discovered from nodes, like kernel modules or CPU models.
   The previous compatibility specification example in this article exemplified this use case.
--&gt;
&lt;h3 id=&#34;使用示例&#34;&gt;使用示例&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;定义镜像兼容性元数据&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;一个&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/containers/images&#34;&gt;容器镜像&lt;/a&gt;可以包含元数据，
基于节点所发现的特性（如内核模块或 CPU 型号）描述其需求。
上文所述的兼容性规范示例即体现了这种用法。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. **Attach the artifact to the image**

   The image compatibility specification is stored as an OCI artifact.
   You can attach this metadata to your container image using the [oras](https://oras.land/) tool.
   The registry only needs to support OCI artifacts, support for arbitrary types is not required.
   Keep in mind that the container image and the artifact must be stored in the same registry.
   Use the following command to attach the artifact to the image:
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;将工件挂接到镜像上&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;镜像兼容性规范以 OCI 工件的形式存储。
你可以使用 &lt;a href=&#34;https://oras.land/&#34;&gt;oras&lt;/a&gt; 工具将元数据挂接到你的容器镜像上。
镜像仓库只需支持 OCI 工件，不必支持任意类型。
请注意，容器镜像和工件必须存储在同一个镜像仓库中。
使用以下命令将工件挂接到镜像上：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;oras attach &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\ &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--artifact-type application/vnd.nfd.image-compatibility.v1alpha1 &amp;lt;image-url&amp;gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\ &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;path-to-spec&amp;gt;.yaml:application/vnd.nfd.image-compatibility.spec.v1alpha1+yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. **Validate image compatibility**

   After attaching the compatibility specification, you can validate whether a node meets the
   image&#39;s requirements. This validation can be done using the
   [nfd client](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/reference/node-feature-client-reference.html):

   ```bash
   nfd compat validate-node --image &lt;image-url&gt;
   ```
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;验证镜像兼容性&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在挂接兼容性规范之后，你可以验证某个节点是否满足镜像的运行要求。这种验证可以通过
&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/reference/node-feature-client-reference.html&#34;&gt;nfd 客户端&lt;/a&gt;来完成：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nfd compat validate-node --image &amp;lt;镜像地址&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
4. **Read the output from the client**

   Finally you can read the report generated by the tool or use your own tools to act based on the generated JSON report.

   ![validate-node command output](validate-node-output.png)
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;读取客户端的输出&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;你可以阅读工具生成的报告，也可以使用你自己的工具解析生成的 JSON 报告并做出决策。&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;validate-node 命令输出&#34; src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/25/image-compatibility-in-cloud-native-environments/validate-node-output.png&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Conclusion

The addition of image compatibility to Kubernetes through Node Feature Discovery underscores the growing importance of addressing compatibility in cloud native environments.
It is only a start, as further work is needed to integrate compatibility into scheduling of workloads within and outside of Kubernetes.
However, by integrating this feature into Kubernetes, mission-critical workloads can now define and validate host OS requirements more efficiently.
Moving forward, the adoption of compatibility metadata within Kubernetes ecosystems will significantly enhance the reliability and performance of specialized containerized applications, ensuring they meet the stringent requirements of industries like telecommunications, high-performance computing or any environment that requires special hardware or host OS configuration.
--&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;总结&lt;/h2&gt;
&lt;p&gt;通过 Node Feature Discovery 将镜像兼容性引入 Kubernetes，突显了在云原生环境中解决兼容性问题的重要性。
这只是一个起点，未来仍需进一步将兼容性深度集成到 Kubernetes 内外的工作负载调度中。
然而，借助这一功能，关键任务型工作负载现在可以更高效地定义和验证其对主机操作系统的要求。
展望未来，兼容性元数据在 Kubernetes 生态系统中的广泛采用将显著提升专用容器化应用的可靠性与性能，
确保其能够满足电信、高性能计算等行业对硬件或主机系统配置的严格要求。&lt;/p&gt;
&lt;!--
## Get involved

Join the [Kubernetes Node Feature Discovery](https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/contributing/) project if you&#39;re interested in getting involved with the design and development of Image Compatibility API and tools.
We always welcome new contributors.
--&gt;
&lt;h2 id=&#34;get-involved&#34;&gt;加入我们&lt;/h2&gt;
&lt;p&gt;如果你有兴趣参与镜像兼容性 API 和工具的设计与开发，欢迎加入
&lt;a href=&#34;https://kubernetes-sigs.github.io/node-feature-discovery/v0.17/contributing/&#34;&gt;Kubernetes Node Feature Discovery&lt;/a&gt;
项目。我们始终欢迎新的贡献者加入。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes Slack 变更公告</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/16/changes-to-kubernetes-slack/</link>
      <pubDate>Mon, 16 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/16/changes-to-kubernetes-slack/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Changes to Kubernetes Slack&#34;
date: 2025-06-16
canonicalUrl: https://www.kubernetes.dev/blog/2025/06/16/changes-to-kubernetes-slack-2025/
slug: changes-to-kubernetes-slack
Author: &gt;
  [Josh Berkus](https://github.com/jberkus)
--&gt;
&lt;!--
**UPDATE**: We&#39;ve received notice from Salesforce that our Slack workspace **WILL NOT BE DOWNGRADED** on June 20th. Stand by for more details, but for now, there is no urgency to back up private channels or direct messages.
--&gt;
&lt;p&gt;&lt;strong&gt;更新&lt;/strong&gt;：我们已收到 Salesforce 的通知，我们的 Slack 工作区在 6 月 20 日&lt;strong&gt;不会被降级&lt;/strong&gt;。
请等待更多细节更新，目前&lt;strong&gt;无需紧急备份&lt;/strong&gt;私有频道或私信。&lt;/p&gt;
&lt;!--
~Kubernetes Slack will lose its special status and will be changing into a standard free Slack on June 20, 2025~~. Sometime later this year, our community may move to a new platform. If you are responsible for a channel or private channel, or a member of a User Group, you will need to take some actions as soon as you can.
--&gt;
&lt;p&gt;&lt;del&gt;Kubernetes Slack 将在 6 月 20 日失去原有的专属支持，并转变为标准免费版 Slack&lt;/del&gt;~。
今年晚些时候，我们的社区可能会迁移到新平台。
如果你是频道或私有频道的负责人，又或是用户组的成员，你需要尽快采取一些行动。&lt;/p&gt;
&lt;!--
For the last decade, Slack has supported our project with a free customized enterprise account. They have let us know that they can no longer do so, particularly since our Slack is one of the largest and more active ones on the platform. As such, they will be downgrading it to a standard free Slack while we decide on, and implement, other options.
--&gt;
&lt;p&gt;在过去十年中，Slack 一直通过免费定制企业账户支持我们的项目。
他们已告知我们无法继续提供这种支持，特别是因为我们的 Slack 是平台上最大和最活跃的社区之一。
因此，在我们决定实施其他选项的同时，他们将把我们的账户降级为标准免费版 Slack。&lt;/p&gt;
&lt;!--
On Friday, June 20, we will be subject to the [feature limitations of free Slack](https://slack.com/help/articles/27204752526611-Feature-limitations-on-the-free-version-of-Slack). The primary ones which will affect us will be only retaining 90 days of history, and having to disable several apps and workflows which we are currently using. The Slack Admin team will do their best to manage these limitations.
--&gt;
&lt;p&gt;在 6 月 20 日星期五，我们将受到&lt;a href=&#34;https://slack.com/help/articles/27204752526611-Feature-limitations-on-the-free-version-of-Slack&#34;&gt;免费版 Slack 的功能限制&lt;/a&gt;。
主要影响包括仅保留 90 天的历史记录，以及必须禁用我们当前使用的几个应用程序和工作流。
Slack 管理团队将尽最大努力管理这些限制。&lt;/p&gt;
&lt;!--
Responsible channel owners, members of private channels, and members of User Groups should [take some actions](https://github.com/kubernetes/community/blob/master/communication/slack-migration-faq.md#what-actions-do-channel-owners-and-user-group-members-need-to-take-soon) to prepare for the upgrade and preserve information as soon as possible.
--&gt;
&lt;p&gt;负责的频道所有者、私有频道成员和用户组成员应该&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/communication/slack-migration-faq.md#what-actions-do-channel-owners-and-user-group-members-need-to-take-soon&#34;&gt;采取一些行动&lt;/a&gt;，
以尽快为升级做准备并保存信息。&lt;/p&gt;
&lt;!--
The CNCF Projects Staff have proposed that our community look at migrating to Discord. Because of existing issues where we have been pushing the limits of Slack, they have already explored what a Kubernetes Discord would look like. Discord would allow us to implement new tools and integrations which would help the community, such as GitHub group membership synchronization. The Steering Committee will discuss and decide on our future platform.
--&gt;
&lt;p&gt;CNCF 项目工作人员建议我们的社区考虑迁移到 Discord。
由于在拓展 Slack 功能极限的过程中存在一些问题，他们已经探索过 Kubernetes Discord 会是什么样子。
Discord 将允许我们实现新的工具和集成，以帮助社区，例如 GitHub 组成员身份同步。
指导委员会将讨论并决定我们的未来平台。&lt;/p&gt;
&lt;!--
Please see our [FAQ](https://github.com/kubernetes/community/blob/master/communication/slack-migration-faq.md), and check the [kubernetes-dev mailing list](https://groups.google.com/a/kubernetes.io/g/dev/) and the [#announcements channel](https://kubernetes.slack.com/archives/C9T0QMNG4) for further news. If you have specific feedback on our Slack status join the [discussion on GitHub](https://github.com/kubernetes/community/issues/8490).
--&gt;
&lt;p&gt;请查看我们的&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/communication/slack-migration-faq.md&#34;&gt;常见问题解答&lt;/a&gt;，
并关注 &lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/dev/&#34;&gt;kubernetes-dev 邮件列表&lt;/a&gt;和
&lt;a href=&#34;https://kubernetes.slack.com/archives/C9T0QMNG4&#34;&gt;#announcements 频道&lt;/a&gt;以获取更多新闻。
如果你对我们的 Slack 状态有具体反馈，请加入
&lt;a href=&#34;https://github.com/kubernetes/community/issues/8490&#34;&gt;GitHub 上的讨论&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>通过自定义聚合增强 Kubernetes Event 管理</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/10/enhancing-kubernetes-event-management-custom-aggregation/</link>
      <pubDate>Tue, 10 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/10/enhancing-kubernetes-event-management-custom-aggregation/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Enhancing Kubernetes Event Management with Custom Aggregation&#34;
date: 2025-06-10
draft: false
slug: enhancing-kubernetes-event-management-custom-aggregation
Author: &gt;
  [Rez Moss](https://github.com/rezmoss)
--&gt;
&lt;!--
Kubernetes [Events](/docs/reference/kubernetes-api/cluster-resources/event-v1/) provide crucial insights into cluster operations, but as clusters grow, managing and analyzing these events becomes increasingly challenging. This blog post explores how to build custom event aggregation systems that help engineering teams better understand cluster behavior and troubleshoot issues more effectively.
--&gt;
&lt;p&gt;Kubernetes &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1/&#34;&gt;Event&lt;/a&gt;
提供了集群操作的关键洞察信息，但随着集群的增长，管理和分析这些 Event 变得越来越具有挑战性。
这篇博客文章探讨了如何构建自定义 Event 聚合系统，以帮助工程团队更好地理解集群行为并更有效地解决问题。&lt;/p&gt;
&lt;!--
## The challenge with Kubernetes events

In a Kubernetes cluster, events are generated for various operations - from pod scheduling and container starts to volume mounts and network configurations. While these events are invaluable for debugging and monitoring, several challenges emerge in production environments:
--&gt;
&lt;h2 id=&#34;kubernetes-event-的挑战&#34;&gt;Kubernetes Event 的挑战&lt;/h2&gt;
&lt;p&gt;在 Kubernetes 集群中，从 Pod 调度、容器启动到卷挂载和网络配置，
各种操作都会生成 Event。虽然这些 Event 对于调试和监控非常有价值，
但在生产环境中出现了几个挑战：&lt;/p&gt;
&lt;!--
1. **Volume**: Large clusters can generate thousands of events per minute
2. **Retention**: Default event retention is limited to one hour
3. **Correlation**: Related events from different components are not automatically linked
4. **Classification**: Events lack standardized severity or category classifications
5. **Aggregation**: Similar events are not automatically grouped
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;量&lt;/strong&gt;：大型集群每分钟可以生成数千个 Event&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;保留&lt;/strong&gt;：默认 Event 保留时间限制为一小时&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;关联&lt;/strong&gt;：不同组件的相关 Event 不会自动链接&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;分类&lt;/strong&gt;：Event 缺乏标准化的严重性或类别分类&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;聚合&lt;/strong&gt;：相似的 Event 不会自动分组&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
To learn more about Events in Kubernetes, read the [Event](/docs/reference/kubernetes-api/cluster-resources/event-v1/) API reference.
--&gt;
&lt;p&gt;要了解更多关于 Kubernetes Event 的信息，请阅读
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1/&#34;&gt;Event&lt;/a&gt;
API 参考。&lt;/p&gt;
&lt;!--
## Real-World value

Consider a production environment with tens of microservices where the users report intermittent transaction failures:

**Traditional event aggregation process:** Engineers are wasting hours sifting through thousands of standalone events spread across namespaces. By the time they look into it, the older events have long since purged, and correlating pod restarts to node-level issues is practically impossible.
--&gt;
&lt;h2 id=&#34;现实世界的价值&#34;&gt;现实世界的价值&lt;/h2&gt;
&lt;p&gt;考虑一个拥有数十个微服务的生产环境中，用户报告间歇性事务失败的情况：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;传统的 Event 聚合过程：&lt;/strong&gt; 工程师浪费数小时筛选分散在各个命名空间中的成千上万的独立 Event。
等到他们查看时，较旧的 Event 早已被清除，将 Pod 重启与节点级别问题关联实际上是不可能的。&lt;/p&gt;
&lt;!--
**With its event aggregation in its custom events:** The system groups events across resources, instantly surfacing correlation patterns such as volume mount timeouts before pod restarts. History indicates it occurred during past record traffic spikes, highlighting a storage scalability issue in minutes rather than hours.

The beneﬁt of this approach is that organizations that implement it commonly cut down their troubleshooting time significantly along with increasing the reliability of systems by detecting patterns early.
--&gt;
&lt;p&gt;&lt;strong&gt;在自定义 Event 中使用 Event 聚合器：&lt;/strong&gt; 系统跨资源分组 Event，
即时浮现如卷挂载超时等关联模式，这些模式出现在 Pod 重启之前。
历史记录表明，这发生在过去的流量高峰期间，突显了存储扩缩问题，
在几分钟内而不是几小时内发现问题。&lt;/p&gt;
&lt;p&gt;这种方法的好处是，实施它的组织通常可以显著减少故障排除时间，
并通过早期检测模式来提高系统的可靠性。&lt;/p&gt;
&lt;!--
## Building an Event aggregation system

This post explores how to build a custom event aggregation system that addresses these challenges, aligned to Kubernetes best practices. I&#39;ve picked the Go programming language for my example.
--&gt;
&lt;h2 id=&#34;构建-event-聚合系统&#34;&gt;构建 Event 聚合系统&lt;/h2&gt;
&lt;p&gt;本文探讨了如何构建一个解决这些问题的自定义 Event 聚合系统，
该系统符合 Kubernetes 最佳实践。我选择了 Go 编程语言作为示例。&lt;/p&gt;
&lt;!--
### Architecture overview

This event aggregation system consists of three main components:

1. **Event Watcher**: Monitors the Kubernetes API for new events
2. **Event Processor**: Processes, categorizes, and correlates events
3. **Storage Backend**: Stores processed events for longer retention

Here&#39;s a sketch for how to implement the event watcher:
--&gt;
&lt;h3 id=&#34;架构概述&#34;&gt;架构概述&lt;/h3&gt;
&lt;p&gt;这个 Event 聚合系统由三个主要组件组成：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Event 监视器&lt;/strong&gt;：监控 Kubernetes API 的新 Event&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Event 处理器&lt;/strong&gt;：处理、分类和关联 Event&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;存储后端&lt;/strong&gt;：存储处理过的 Event 以实现更长的保留期&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;以下是实现 Event 监视器的示例代码：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;package&lt;/span&gt; main
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;context&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    metav1 &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;k8s.io/apimachinery/pkg/apis/meta/v1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;k8s.io/client-go/kubernetes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;k8s.io/client-go/rest&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    eventsv1 &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;k8s.io/api/events/v1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; EventWatcher &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    clientset &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;kubernetes.Clientset
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;NewEventWatcher&lt;/span&gt;(config &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;rest.Config) (&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;EventWatcher, &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;error&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    clientset, err &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; kubernetes.&lt;span style=&#34;color:#00a000&#34;&gt;NewForConfig&lt;/span&gt;(config)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; err &lt;span style=&#34;color:#666&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt;, err
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;&amp;amp;&lt;/span&gt;EventWatcher{clientset: clientset}, &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; (w &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;EventWatcher) &lt;span style=&#34;color:#00a000&#34;&gt;Watch&lt;/span&gt;(ctx context.Context) (&lt;span style=&#34;color:#666&#34;&gt;&amp;lt;-&lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;chan&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event, &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;error&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    events &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;make&lt;/span&gt;(&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;chan&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    watcher, err &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; w.clientset.&lt;span style=&#34;color:#00a000&#34;&gt;EventsV1&lt;/span&gt;().&lt;span style=&#34;color:#00a000&#34;&gt;Events&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;).&lt;span style=&#34;color:#00a000&#34;&gt;Watch&lt;/span&gt;(ctx, metav1.ListOptions{})
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; err &lt;span style=&#34;color:#666&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt;, err
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;go&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;defer&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;close&lt;/span&gt;(events)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;select&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;case&lt;/span&gt; event &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;&amp;lt;-&lt;/span&gt;watcher.&lt;span style=&#34;color:#00a000&#34;&gt;ResultChan&lt;/span&gt;():
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; e, ok &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; event.Object.(&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event); ok {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    events &lt;span style=&#34;color:#666&#34;&gt;&amp;lt;-&lt;/span&gt; e
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;&amp;lt;-&lt;/span&gt;ctx.&lt;span style=&#34;color:#00a000&#34;&gt;Done&lt;/span&gt;():
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                watcher.&lt;span style=&#34;color:#00a000&#34;&gt;Stop&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; events, &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### Event processing and classification

The event processor enriches events with additional context and classification:
--&gt;
&lt;h3 id=&#34;event-处理和分类&#34;&gt;Event 处理和分类&lt;/h3&gt;
&lt;p&gt;Event 处理器为 Event 添加额外的上下文和分类：&lt;/p&gt;
&lt;!--
```go
type EventProcessor struct {
    categoryRules []CategoryRule
    correlationRules []CorrelationRule
}

type ProcessedEvent struct {
    Event     *eventsv1.Event
    Category  string
    Severity  string
    CorrelationID string
    Metadata  map[string]string
}

func (p *EventProcessor) Process(event *eventsv1.Event) *ProcessedEvent {
    processed := &amp;ProcessedEvent{
        Event:    event,
        Metadata: make(map[string]string),
    }
    
    // Apply classification rules
    processed.Category = p.classifyEvent(event)
    processed.Severity = p.determineSeverity(event)
    
    // Generate correlation ID for related events
    processed.CorrelationID = p.correlateEvent(event)
    
    // Add useful metadata
    processed.Metadata = p.extractMetadata(event)
    
    return processed
}
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; EventProcessor &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    categoryRules []CategoryRule
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    correlationRules []CorrelationRule
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; ProcessedEvent &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Event     &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Category  &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Severity  &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    CorrelationID &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Metadata  &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;]&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; (p &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;EventProcessor) &lt;span style=&#34;color:#00a000&#34;&gt;Process&lt;/span&gt;(event &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event) &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;ProcessedEvent {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    processed &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;&amp;amp;&lt;/span&gt;ProcessedEvent{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        Event:    event,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        Metadata: &lt;span style=&#34;color:#a2f&#34;&gt;make&lt;/span&gt;(&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;]&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 应用分类规则
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    processed.Category = p.&lt;span style=&#34;color:#00a000&#34;&gt;classifyEvent&lt;/span&gt;(event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    processed.Severity = p.&lt;span style=&#34;color:#00a000&#34;&gt;determineSeverity&lt;/span&gt;(event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 为相关 Event 生成关联 ID
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    processed.CorrelationID = p.&lt;span style=&#34;color:#00a000&#34;&gt;correlateEvent&lt;/span&gt;(event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 添加有用的元数据
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    processed.Metadata = p.&lt;span style=&#34;color:#00a000&#34;&gt;extractMetadata&lt;/span&gt;(event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; processed
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### Implementing Event correlation

One of the key features you could implement is a way of correlating related Events.
Here&#39;s an example correlation strategy:
--&gt;
&lt;h3 id=&#34;实现-event-关联&#34;&gt;实现 Event 关联&lt;/h3&gt;
&lt;p&gt;你可以实现的一个关键特性是关联相关 Event 的方法，这里有一个示例关联策略：&lt;/p&gt;
&lt;!--
```go
func (p *EventProcessor) correlateEvent(event *eventsv1.Event) string {
    // Correlation strategies:
    // 1. Time-based: Events within a time window
    // 2. Resource-based: Events affecting the same resource
    // 3. Causation-based: Events with cause-effect relationships

    correlationKey := generateCorrelationKey(event)
    return correlationKey
}

func generateCorrelationKey(event *eventsv1.Event) string {
    // Example: Combine namespace, resource type, and name
    return fmt.Sprintf(&#34;%s/%s/%s&#34;,
        event.InvolvedObject.Namespace,
        event.InvolvedObject.Kind,
        event.InvolvedObject.Name,
    )
}
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; (p &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;EventProcessor) &lt;span style=&#34;color:#00a000&#34;&gt;correlateEvent&lt;/span&gt;(event &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event) &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 相关策略：
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 1. 基于时间的：时间窗口内的事件
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 2. 基于资源的：影响同一资源的事件
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 3. 基于因果关系的：具有因果关系的事件
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    correlationKey &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;generateCorrelationKey&lt;/span&gt;(event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; correlationKey
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;generateCorrelationKey&lt;/span&gt;(event &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;eventsv1.Event) &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 示例：结合命名空间、资源类型和名称
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Sprintf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;%s/%s/%s&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        event.InvolvedObject.Namespace,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        event.InvolvedObject.Kind,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        event.InvolvedObject.Name,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    )
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Event storage and retention

For long-term storage and analysis, you&#39;ll probably want a backend that supports:
- Efficient querying of large event volumes
- Flexible retention policies
- Support for aggregation queries

Here&#39;s a sample storage interface:
--&gt;
&lt;h2 id=&#34;event-存储和保留&#34;&gt;Event 存储和保留&lt;/h2&gt;
&lt;p&gt;对于长期存储和分析，你可能需要一个支持以下功能的后端：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;大量 Event 的高效查询&lt;/li&gt;
&lt;li&gt;灵活的保留策略&lt;/li&gt;
&lt;li&gt;支持聚合查询&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这里是一个示例存储接口：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; EventStorage &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;interface&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#00a000&#34;&gt;Store&lt;/span&gt;(context.Context, &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;ProcessedEvent) &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;error&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#00a000&#34;&gt;Query&lt;/span&gt;(context.Context, EventQuery) ([]ProcessedEvent, &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;error&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#00a000&#34;&gt;Aggregate&lt;/span&gt;(context.Context, AggregationParams) ([]EventAggregate, &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;error&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; EventQuery &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    TimeRange     TimeRange
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Categories    []&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Severity      []&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    CorrelationID &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Limit         &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;int&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; AggregationParams &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    GroupBy    []&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    TimeWindow &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Metrics    []&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Good practices for Event management

1. **Resource Efficiency**
   - Implement rate limiting for event processing
   - Use efficient filtering at the API server level
   - Batch events for storage operations
--&gt;
&lt;h2 id=&#34;event-管理的良好实践&#34;&gt;Event 管理的良好实践&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;资源效率&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;为 Event 处理实现速率限制&lt;/li&gt;
&lt;li&gt;在 API 服务器级别使用高效的过滤&lt;/li&gt;
&lt;li&gt;对存储操作批量处理 Event&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. **Scalability**
   - Distribute event processing across multiple workers
   - Use leader election for coordination
   - Implement backoff strategies for API rate limits

3. **Reliability**
   - Handle API server disconnections gracefully
   - Buffer events during storage backend unavailability
   - Implement retry mechanisms with exponential backoff
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;扩缩性&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;将 Event 处理分派给多个工作线程&lt;/li&gt;
&lt;li&gt;使用领导者选举进行协调&lt;/li&gt;
&lt;li&gt;实施 API 速率限制的退避策略&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;可靠性&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;优雅地处理 API 服务器断开连接&lt;/li&gt;
&lt;li&gt;在存储后端不可用期间缓冲 Event&lt;/li&gt;
&lt;li&gt;实施带有指数退避的重试机制&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Advanced features

### Pattern detection

Implement pattern detection to identify recurring issues:
--&gt;
&lt;h2 id=&#34;高级特性&#34;&gt;高级特性&lt;/h2&gt;
&lt;h3 id=&#34;模式检测&#34;&gt;模式检测&lt;/h3&gt;
&lt;p&gt;实现模式检测以识别重复出现的问题：&lt;/p&gt;
&lt;!--
```go
type PatternDetector struct {
    patterns map[string]*Pattern
    threshold int
}

func (d *PatternDetector) Detect(events []ProcessedEvent) []Pattern {
    // Group similar events
    groups := groupSimilarEvents(events)
    
    // Analyze frequency and timing
    patterns := identifyPatterns(groups)
    
    return patterns
}

func groupSimilarEvents(events []ProcessedEvent) map[string][]ProcessedEvent {
    groups := make(map[string][]ProcessedEvent)
    
    for _, event := range events {
        // Create similarity key based on event characteristics
        similarityKey := fmt.Sprintf(&#34;%s:%s:%s&#34;,
            event.Event.Reason,
            event.Event.InvolvedObject.Kind,
            event.Event.InvolvedObject.Namespace,
        )
        
        // Group events with the same key
        groups[similarityKey] = append(groups[similarityKey], event)
    }
    
    return groups
}


func identifyPatterns(groups map[string][]ProcessedEvent) []Pattern {
    var patterns []Pattern
    
    for key, events := range groups {
        // Only consider groups with enough events to form a pattern
        if len(events) &lt; 3 {
            continue
        }
        
        // Sort events by time
        sort.Slice(events, func(i, j int) bool {
            return events[i].Event.LastTimestamp.Time.Before(events[j].Event.LastTimestamp.Time)
        })
        
        // Calculate time range and frequency
        firstSeen := events[0].Event.FirstTimestamp.Time
        lastSeen := events[len(events)-1].Event.LastTimestamp.Time
        duration := lastSeen.Sub(firstSeen).Minutes()
        
        var frequency float64
        if duration &gt; 0 {
            frequency = float64(len(events)) / duration
        }
        
        // Create a pattern if it meets threshold criteria
        if frequency &gt; 0.5 { // More than 1 event per 2 minutes
            pattern := Pattern{
                Type:         key,
                Count:        len(events),
                FirstSeen:    firstSeen,
                LastSeen:     lastSeen,
                Frequency:    frequency,
                EventSamples: events[:min(3, len(events))], // Keep up to 3 samples
            }
            patterns = append(patterns, pattern)
        }
    }
    
    return patterns
}
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; PatternDetector &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    patterns &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;]&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;Pattern
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    threshold &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;int&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; (d &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;PatternDetector) &lt;span style=&#34;color:#00a000&#34;&gt;Detect&lt;/span&gt;(events []ProcessedEvent) []Pattern {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 将类似 Event 分组
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    groups &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;groupSimilarEvents&lt;/span&gt;(events)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// Analyze frequency and timing
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;    patterns &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;identifyPatterns&lt;/span&gt;(groups)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; patterns
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;groupSimilarEvents&lt;/span&gt;(events []ProcessedEvent) &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;][]ProcessedEvent {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    groups &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;make&lt;/span&gt;(&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;][]ProcessedEvent)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; _, event &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;range&lt;/span&gt; events {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 根据 Event 特征创建相似性键
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        similarityKey &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Sprintf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;%s:%s:%s&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            event.Event.Reason,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            event.Event.InvolvedObject.Kind,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            event.Event.InvolvedObject.Namespace,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        )
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 用相同的键对 Event 进行分组
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        groups[similarityKey] = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(groups[similarityKey], event)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; groups
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;identifyPatterns&lt;/span&gt;(groups &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;map&lt;/span&gt;[&lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;string&lt;/span&gt;][]ProcessedEvent) []Pattern {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;var&lt;/span&gt; patterns []Pattern
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; key, events &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;range&lt;/span&gt; groups {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 只考虑具有足够 Event 以形成模式的组
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;len&lt;/span&gt;(events) &amp;lt; &lt;span style=&#34;color:#666&#34;&gt;3&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;continue&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 按时间对 Event 进行排序
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        sort.&lt;span style=&#34;color:#00a000&#34;&gt;Slice&lt;/span&gt;(events, &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt;(i, j &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;int&lt;/span&gt;) &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;bool&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; events[i].Event.LastTimestamp.Time.&lt;span style=&#34;color:#00a000&#34;&gt;Before&lt;/span&gt;(events[j].Event.LastTimestamp.Time)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        })
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 计算时间范围和频率
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        firstSeen &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; events[&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;].Event.FirstTimestamp.Time
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        lastSeen &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; events[&lt;span style=&#34;color:#a2f&#34;&gt;len&lt;/span&gt;(events)&lt;span style=&#34;color:#666&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;].Event.LastTimestamp.Time
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        duration &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; lastSeen.&lt;span style=&#34;color:#00a000&#34;&gt;Sub&lt;/span&gt;(firstSeen).&lt;span style=&#34;color:#00a000&#34;&gt;Minutes&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;var&lt;/span&gt; frequency &lt;span style=&#34;color:#0b0;font-weight:bold&#34;&gt;float64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; duration &amp;gt; &lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            frequency = &lt;span style=&#34;color:#a2f&#34;&gt;float64&lt;/span&gt;(&lt;span style=&#34;color:#a2f&#34;&gt;len&lt;/span&gt;(events)) &lt;span style=&#34;color:#666&#34;&gt;/&lt;/span&gt; duration
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 如果满足阈值标准，则创建模式
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; frequency &amp;gt; &lt;span style=&#34;color:#666&#34;&gt;0.5&lt;/span&gt; { &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 每 2 分钟发生超过 1 个事件
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;            pattern &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; Pattern{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                Type:         key,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                Count:        &lt;span style=&#34;color:#a2f&#34;&gt;len&lt;/span&gt;(events),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                FirstSeen:    firstSeen,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                LastSeen:     lastSeen,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                Frequency:    frequency,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                EventSamples: events[:&lt;span style=&#34;color:#a2f&#34;&gt;min&lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#a2f&#34;&gt;len&lt;/span&gt;(events))], &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;// 最多保留 3 个样本
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;&lt;/span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            patterns = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(patterns, pattern)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; patterns
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
With this implementation, the system can identify recurring patterns such as node pressure events, pod scheduling failures, or networking issues that occur with a specific frequency.
--&gt;
&lt;p&gt;通过此实现，系统可以识别诸如节点压力 Event、Pod
调度失败或以特定频率发生的网络问题等重复出现的模式。&lt;/p&gt;
&lt;!--
### Real-time alerts

The following example provides a starting point for building an alerting system based on event patterns. It is not a complete solution but a conceptual sketch to illustrate the approach.
--&gt;
&lt;h3 id=&#34;实时警报&#34;&gt;实时警报&lt;/h3&gt;
&lt;p&gt;以下示例提供了一个基于 Event 模式构建警报系统的基础起点。
它不是一个完整的解决方案，而是一个用于说明方法的概念性草图。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;type&lt;/span&gt; AlertManager &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rules []AlertRule
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    notifiers []Notifier
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;func&lt;/span&gt; (a &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;AlertManager) &lt;span style=&#34;color:#00a000&#34;&gt;EvaluateEvents&lt;/span&gt;(events []ProcessedEvent) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; _, rule &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;range&lt;/span&gt; a.rules {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; rule.&lt;span style=&#34;color:#00a000&#34;&gt;Matches&lt;/span&gt;(events) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            alert &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; rule.&lt;span style=&#34;color:#00a000&#34;&gt;GenerateAlert&lt;/span&gt;(events)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            a.&lt;span style=&#34;color:#00a000&#34;&gt;notify&lt;/span&gt;(alert)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Conclusion

A well-designed event aggregation system can significantly improve cluster observability and troubleshooting capabilities. By implementing custom event processing, correlation, and storage, operators can better understand cluster behavior and respond to issues more effectively.

The solutions presented here can be extended and customized based on specific requirements while maintaining compatibility with the Kubernetes API and following best practices for scalability and reliability.
--&gt;
&lt;h2 id=&#34;结论&#34;&gt;结论&lt;/h2&gt;
&lt;p&gt;一个设计良好的 Event 聚合系统可以显著提高集群的可观测性和故障排查能力。
通过实现自定义的 Event 处理、关联和存储，操作员可以更好地理解集群行为并更有效地响应问题。&lt;/p&gt;
&lt;p&gt;这里介绍的解决方案可以根据具体需求进行扩展和定制，同时保持与
Kubernetes API的兼容性，并遵循可扩展性和可靠性方面的最佳实践。&lt;/p&gt;
&lt;!--
## Next steps

Future enhancements could include:
- Machine learning for anomaly detection
- Integration with popular observability platforms
- Custom event APIs for application-specific events
- Enhanced visualization and reporting capabilities
--&gt;
&lt;h2 id=&#34;下一步&#34;&gt;下一步&lt;/h2&gt;
&lt;p&gt;未来的增强功能可能包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;用于异常检测的机器学习&lt;/li&gt;
&lt;li&gt;与流行的可观测性平台集成&lt;/li&gt;
&lt;li&gt;面向应用 Event 的自定义 Event API&lt;/li&gt;
&lt;li&gt;增强的可视化和报告能力&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For more information on Kubernetes events and custom [controllers](/docs/concepts/architecture/controller/),
refer to the official Kubernetes [documentation](/docs/).
--&gt;
&lt;p&gt;有关 Kubernetes Event 和自定义&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/controller/&#34;&gt;控制器&lt;/a&gt; 的更多信息，
请参阅官方 Kubernetes &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/&#34;&gt;文档&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>介绍 Gateway API 推理扩展</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/</link>
      <pubDate>Thu, 05 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Introducing Gateway API Inference Extension&#34;
date: 2025-06-05
slug: introducing-gateway-api-inference-extension
draft: false
author: &gt;
  Daneyon Hansen (Solo.io),
  Kaushik Mitra (Google),
  Jiaxin Shan (Bytedance),
  Kellen Swain (Google)
--&gt;
&lt;!--
Modern generative AI and large language model (LLM) services create unique traffic-routing challenges
on Kubernetes. Unlike typical short-lived, stateless web requests, LLM inference sessions are often
long-running, resource-intensive, and partially stateful. For example, a single GPU-backed model server
may keep multiple inference sessions active and maintain in-memory token caches.

Traditional load balancers focused on HTTP path or round-robin lack the specialized capabilities needed
for these workloads. They also don’t account for model identity or request criticality (e.g., interactive
chat vs. batch jobs). Organizations often patch together ad-hoc solutions, but a standardized approach
is missing.
--&gt;
&lt;p&gt;现代生成式 AI 和大语言模型（LLM）服务在 Kubernetes 上带来独特的流量路由挑战。
与典型的短生命期的无状态 Web 请求不同，LLM 推理会话通常是长时间运行的、资源密集型的，并且具有一定的状态性。
例如，单个由 GPU 支撑的模型服务器可能会保持多个推理会话处于活跃状态，并保留内存中的令牌缓存。&lt;/p&gt;
&lt;p&gt;传统的负载均衡器注重 HTTP 路径或轮询，缺乏处理这类工作负载所需的专业能力。
传统的负载均衡器通常无法识别模型身份或请求重要性（例如交互式聊天与批处理任务的区别）。
各个组织往往拼凑出临时解决方案，但一直缺乏标准化的做法。&lt;/p&gt;
&lt;!--
## Gateway API Inference Extension

[Gateway API Inference Extension](https://gateway-api-inference-extension.sigs.k8s.io/) was created to address
this gap by building on the existing [Gateway API](https://gateway-api.sigs.k8s.io/), adding inference-specific
routing capabilities while retaining the familiar model of Gateways and HTTPRoutes. By adding an inference
extension to your existing gateway, you effectively transform it into an **Inference Gateway**, enabling you to
self-host GenAI/LLMs with a “model-as-a-service” mindset.
--&gt;
&lt;h2 id=&#34;gateway-api-inference-extension&#34;&gt;Gateway API 推理扩展  &lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/&#34;&gt;Gateway API 推理扩展&lt;/a&gt;正是为了填补这一空白而创建的，
它基于已有的 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/&#34;&gt;Gateway API&lt;/a&gt; 进行构建，
添加了特定于推理的路由能力，同时保留了 Gateway 与 HTTPRoute 的熟悉模型。
通过为现有 Gateway 添加推理扩展，你就能将其转变为一个&lt;strong&gt;推理网关（Inference Gateway）&lt;/strong&gt;，
从而以“模型即服务”的理念自托管 GenAI/LLM 应用。&lt;/p&gt;
&lt;!--
The project’s goal is to improve and standardize routing to inference workloads across the ecosystem. Key
objectives include enabling model-aware routing, supporting per-request criticalities, facilitating safe model
roll-outs, and optimizing load balancing based on real-time model metrics. By achieving these, the project aims
to reduce latency and improve accelerator (GPU) utilization for AI workloads.

## How it works

The design introduces two new Custom Resources (CRDs) with distinct responsibilities, each aligning with a
specific user persona in the AI/ML serving workflow​:
--&gt;
&lt;p&gt;此项目的目标是在整个生态系统中改进并标准化对推理工作负载的路由。
关键目标包括实现模型感知路由、支持逐个请求的重要性区分、促进安全的模型发布，
以及基于实时模型指标来优化负载均衡。为了实现这些目标，此项目希望降低延迟并提高 AI 负载中的加速器（如 GPU）利用率。&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;工作原理  &lt;/h2&gt;
&lt;p&gt;功能设计时引入了两个具有不同职责的全新定制资源（CRD），每个 CRD 对应 AI/ML 服务流程中的一个特定用户角色：&lt;/p&gt;
&lt;!--


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-resource-model.png&#34;
         alt=&#34;Resource Model&#34;/&gt; 
&lt;/figure&gt;
--&gt;


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-resource-model.png&#34;
         alt=&#34;资源模型&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
1. [InferencePool](https://gateway-api-inference-extension.sigs.k8s.io/api-types/inferencepool/)
   Defines a pool of pods (model servers) running on shared compute (e.g., GPU nodes). The platform admin can
   configure how these pods are deployed, scaled, and balanced. An InferencePool ensures consistent resource
   usage and enforces platform-wide policies. An InferencePool is similar to a Service but specialized for AI/ML
   serving needs and aware of the model-serving protocol.

2. [InferenceModel](https://gateway-api-inference-extension.sigs.k8s.io/api-types/inferencemodel/)
   A user-facing model endpoint managed by AI/ML owners. It maps a public name (e.g., &#34;gpt-4-chat&#34;) to the actual
   model within an InferencePool. This lets workload owners specify which models (and optional fine-tuning) they
   want served, plus a traffic-splitting or prioritization policy.
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/api-types/inferencepool/&#34;&gt;InferencePool&lt;/a&gt;
定义了一组在共享计算资源（如 GPU 节点）上运行的 Pod（模型服务器）。
平台管理员可以配置这些 Pod 的部署、扩缩容和负载均衡策略。
InferencePool 确保资源使用情况的一致性，并执行平台级的策略。
InferencePool 类似于 Service，但专为 AI/ML 推理服务定制，能够感知模型服务协议。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/api-types/inferencemodel/&#34;&gt;InferenceModel&lt;/a&gt;
是面向用户的模型端点，由 AI/ML 拥有者管理。
它将一个公共名称（如 &amp;quot;gpt-4-chat&amp;quot;）映射到 InferencePool 内的实际模型。
这使得负载拥有者可以指定要服务的模型（及可选的微调版本），并配置流量拆分或优先级策略。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
In summary, the InferenceModel API lets AI/ML owners manage what is served, while the InferencePool lets platform
operators manage where and how it’s served.
--&gt;
&lt;p&gt;简而言之，InferenceModel API 让 AI/ML 拥有者管理“提供什么服务”，而
InferencePool 则让平台运维人员管理“在哪儿以及如何提供服务”。&lt;/p&gt;
&lt;!--
## Request flow

The flow of a request builds on the Gateway API model (Gateways and HTTPRoutes) with one or more extra inference-aware
steps (extensions) in the middle. Here’s a high-level example of the request flow with the
[Endpoint Selection Extension (ESE)](https://gateway-api-inference-extension.sigs.k8s.io/#endpoint-selection-extension):
--&gt;
&lt;h2 id=&#34;request-flow&#34;&gt;请求流程  &lt;/h2&gt;
&lt;p&gt;请求的处理流程基于 Gateway API 模型（Gateway 和 HTTPRoute），在其中插入一个或多个对推理有感知的步骤（扩展）。
以下是一个使用&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/#endpoint-selection-extension&#34;&gt;端点选择扩展（Endpoint Selection Extension, ESE）&lt;/a&gt;
的高级请求流程示意图：&lt;/p&gt;
&lt;!--


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-request-flow.png&#34;
         alt=&#34;Request Flow&#34;/&gt; 
&lt;/figure&gt;
--&gt;


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-request-flow.png&#34;
         alt=&#34;请求流程&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
1. **Gateway Routing**  
   A client sends a request (e.g., an HTTP POST to /completions). The Gateway (like Envoy) examines the HTTPRoute
   and identifies the matching InferencePool backend.

2. **Endpoint Selection**  
   Instead of simply forwarding to any available pod, the Gateway consults an inference-specific routing extension—
   the Endpoint Selection Extension—to pick the best of the available pods. This extension examines live pod metrics
   (queue lengths, memory usage, loaded adapters) to choose the ideal pod for the request.
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gateway 路由&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;客户端发送请求（例如向 &lt;code&gt;/completions&lt;/code&gt; 发起 HTTP POST）。
Gateway（如 Envoy）会检查 HTTPRoute，并识别出匹配的 InferencePool 后端。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;端点选择&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Gateway 不会简单地将请求转发到任一可用的 Pod，
而是调用一个特定于推理的路由扩展（端点选择扩展）从多个可用 Pod 中选出最优者。
此扩展根据实时 Pod 指标（如队列长度、内存使用量、加载的适配器等）来选择最适合请求的 Pod。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. **Inference-Aware Scheduling**  
   The chosen pod is the one that can handle the request with the lowest latency or highest efficiency, given the
   user’s criticality or resource needs. The Gateway then forwards traffic to that specific pod.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;推理感知调度&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;所选 Pod 是基于用户重要性或资源需求下延迟最低或效率最高者。
随后 Gateway 将流量转发到这个特定的 Pod。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-epp-scheduling.png&#34;
         alt=&#34;Endpoint Extension Scheduling&#34;/&gt; 
&lt;/figure&gt;
--&gt;


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-epp-scheduling.png&#34;
         alt=&#34;端点扩展调度&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
This extra step provides a smarter, model-aware routing mechanism that still feels like a normal single request to
the client. Additionally, the design is extensible—any Inference Gateway can be enhanced with additional inference-specific
extensions to handle new routing strategies, advanced scheduling logic, or specialized hardware needs. As the project
continues to grow, contributors are encouraged to develop new extensions that are fully compatible with the same underlying
Gateway API model, further expanding the possibilities for efficient and intelligent GenAI/LLM routing.
--&gt;
&lt;p&gt;这一额外步骤提供了一种更为智能的模型感知路由机制，但对于客户端来说感觉就像一个普通的请求。
此外，这种设计具有良好的可扩展性，任何推理网关都可以通过添加新的特定于推理的扩展来处理新的路由策略、高级调度逻辑或特定硬件需求。
随着此项目的持续发展，欢迎社区贡献者开发与底层 Gateway API 模型完全兼容的新扩展，进一步拓展高效、智能的 GenAI/LLM 路由能力。&lt;/p&gt;
&lt;!--
## Benchmarks

We evaluated ​this extension against a standard Kubernetes Service for a [vLLM](https://docs.vllm.ai/en/latest/)‐based model
serving deployment. The test environment consisted of multiple H100 (80 GB) GPU pods running vLLM ([version 1](https://blog.vllm.ai/2025/01/27/v1-alpha-release.html))
on a Kubernetes cluster, with 10 Llama2 model replicas. The [Latency Profile Generator (LPG)](https://github.com/AI-Hypercomputer/inference-benchmark)
tool was used to generate traffic and measure throughput, latency, and other metrics. The
[ShareGPT](https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json)
dataset served as the workload, and traffic was ramped from 100 Queries per Second (QPS) up to 1000 QPS.
--&gt;
&lt;h2 id=&#34;benchmarks&#34;&gt;基准测试  &lt;/h2&gt;
&lt;p&gt;我们将此扩展与标准 Kubernetes Service 进行了对比测试，基于
&lt;a href=&#34;https://docs.vllm.ai/en/latest/&#34;&gt;vLLM&lt;/a&gt; 部署模型服务。
测试环境是在 Kubernetes 集群中运行 vLLM（&lt;a href=&#34;https://blog.vllm.ai/2025/01/27/v1-alpha-release.html&#34;&gt;v1&lt;/a&gt;）
的多个 H100（80 GB）GPU Pod，并部署了 10 个 Llama2 模型副本。
本次测试使用了 &lt;a href=&#34;https://github.com/AI-Hypercomputer/inference-benchmark&#34;&gt;Latency Profile Generator (LPG)&lt;/a&gt;
工具生成流量，测量吞吐量、延迟等指标。采用的工作负载数据集为
&lt;a href=&#34;https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json&#34;&gt;ShareGPT&lt;/a&gt;，
流量从 100 QPS 提升到 1000 QPS。&lt;/p&gt;
&lt;!--
### Key results



&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-benchmark.png&#34;
         alt=&#34;Endpoint Extension Scheduling&#34;/&gt; 
&lt;/figure&gt;
--&gt;
&lt;h3 id=&#34;key-results&#34;&gt;主要结果  &lt;/h3&gt;


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/05/introducing-gateway-api-inference-extension/inference-extension-benchmark.png&#34;
         alt=&#34;端点扩展调度&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
- **Comparable Throughput**: Throughout the tested QPS range, the ESE delivered throughput roughly on par with a standard
  Kubernetes Service.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;吞吐量相当&lt;/strong&gt;：在整个测试的 QPS 范围内，ESE 达到的吞吐量基本与标准 Kubernetes Service 持平。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- **Lower Latency**:
  - **Per‐Output‐Token Latency**: The ​ESE showed significantly lower p90 latency at higher QPS (500+), indicating that
  its model-aware routing decisions reduce queueing and resource contention as GPU memory approaches saturation.
  - **Overall p90 Latency**: Similar trends emerged, with the ​ESE reducing end‐to‐end tail latencies compared to the
  baseline, particularly as traffic increased beyond 400–500 QPS.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;延迟更低&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;输出令牌层面的延迟&lt;/strong&gt;：在高负载（QPS 500 以上）时，​ESE 显示了 p90 延迟明显更低，
这表明随着 GPU 显存达到饱和，其模型感知路由决策可以减少排队等待和资源争用。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;整体 p90 延迟&lt;/strong&gt;：出现类似趋势，​ESE 相比基线降低了端到端尾部延迟，特别是在 QPS 超过 400–500 时更明显。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
These results suggest that this extension&#39;s model‐aware routing significantly reduced latency for GPU‐backed LLM
workloads. By dynamically selecting the least‐loaded or best‐performing model server, it avoids hotspots that can
appear when using traditional load balancing methods for large, long‐running inference requests.

## Roadmap

As the Gateway API Inference Extension heads toward GA, planned features include:
--&gt;
&lt;p&gt;这些结果表明，此扩展的模型感知路由显著降低了 GPU 支撑的 LLM 负载的延迟。
此扩展通过动态选择负载最轻或性能最优的模型服务器，避免了传统负载均衡方法在处理较大的、长时间运行的推理请求时会出现的热点问题。&lt;/p&gt;
&lt;h2 id=&#34;roadmap&#34;&gt;路线图  &lt;/h2&gt;
&lt;p&gt;随着 Gateway API 推理扩展迈向 GA（正式发布），计划中的特性包括：&lt;/p&gt;
&lt;!--
1. **Prefix-cache aware load balancing** for remote caches
2. **LoRA adapter pipelines** for automated rollout
3. **Fairness and priority** between workloads in the same criticality band
4. **HPA support** for scaling based on aggregate, per-model metrics
5. **Support for large multi-modal inputs/outputs**
6. **Additional model types** (e.g., diffusion models)
7. **Heterogeneous accelerators** (serving on multiple accelerator types with latency- and cost-aware load balancing)
8. **Disaggregated serving** for independently scaling pools
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;前缀缓存感知负载均衡&lt;/strong&gt;以支持远程缓存&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LoRA 适配器流水线&lt;/strong&gt;方便自动化上线&lt;/li&gt;
&lt;li&gt;同一重要性等级下负载之间的&lt;strong&gt;公平性和优先级&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HPA 支持&lt;/strong&gt;基于聚合的模型层面指标扩缩容&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;支持大规模多模态输入/输出&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;支持额外的模型类型&lt;/strong&gt;（如扩散模型）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;异构加速器&lt;/strong&gt;（支持多个加速器类型，并具备延迟和成本感知的负载均衡）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;解耦式服务架构&lt;/strong&gt;，以独立扩缩资源池&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Summary

By aligning model serving with Kubernetes-native tooling, Gateway API Inference Extension aims to simplify
and standardize how AI/ML traffic is routed. With model-aware routing, criticality-based prioritization, and
more, it helps ops teams deliver the right LLM services to the right users—smoothly and efficiently.
--&gt;
&lt;h2 id=&#34;summary&#34;&gt;总结  &lt;/h2&gt;
&lt;p&gt;通过将模型服务对齐到 Kubernetes 原生工具链，Gateway API 推理扩展致力于简化并标准化 AI/ML 流量的路由方式。
此扩展引入模型感知路由、基于重要性的优先级等能力，帮助运维团队平滑高效地将合适的 LLM 服务交付给合适的用户。&lt;/p&gt;
&lt;!--
**Ready to learn more?** Visit the [project docs](https://gateway-api-inference-extension.sigs.k8s.io/) to dive deeper,
give an Inference Gateway extension a try with a few [simple steps](https://gateway-api-inference-extension.sigs.k8s.io/guides/),
and [get involved](https://gateway-api-inference-extension.sigs.k8s.io/contributing/) if you’re interested in
contributing to the project!
--&gt;
&lt;p&gt;&lt;strong&gt;想进一步学习？&lt;/strong&gt;
参阅&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/&#34;&gt;项目文档&lt;/a&gt;深入学习，
只需&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/guides/&#34;&gt;简单几步&lt;/a&gt;试用推理网关扩展。
如果你想对此项目作贡献，欢迎&lt;a href=&#34;https://gateway-api-inference-extension.sigs.k8s.io/contributing/&#34;&gt;参与其中&lt;/a&gt;！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>先启动边车：如何避免障碍</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/03/start-sidecar-first/</link>
      <pubDate>Tue, 03 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/03/start-sidecar-first/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Start Sidecar First: How To Avoid Snags&#34;
date: 2025-06-03
draft: false
slug: start-sidecar-first
author: Agata Skorupka (The Scale Factory)
--&gt;
&lt;!--
From the [Kubernetes Multicontainer Pods: An Overview blog post](/blog/2025/04/22/multi-container-pods-overview/) you know what their job is, what are the main architectural patterns, and how they are implemented in Kubernetes. The main thing I’ll cover in this article is how to ensure that your sidecar containers start before the main app. It’s more complicated than you might think!
--&gt;
&lt;p&gt;从 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/22/multi-container-pods-overview/&#34;&gt;&amp;quot;Kubernetes 多容器 Pod：概述&amp;quot;博客&lt;/a&gt;中，
你了解了 Pod 的工作方式，Pod 的主要架构模式，以及 Pod 在 Kubernetes 中是如何实现的。
本文主要介绍的是如何确保你的边车容器在主应用之前启动。这比你想象的要复杂得多！&lt;/p&gt;
&lt;!--
## A gentle refresher

I&#39;d just like to remind readers that the [v1.29.0 release of Kubernetes](/blog/2023/12/13/kubernetes-v1-29-release/) added native support for
[sidecar containers](/docs/concepts/workloads/pods/sidecar-containers/), which can now be defined within the `.spec.initContainers` field,
but with `restartPolicy: Always`. You can see that illustrated in the following example Pod manifest snippet:
--&gt;
&lt;h2 id=&#34;简要回顾&#34;&gt;简要回顾&lt;/h2&gt;
&lt;p&gt;我想提醒读者的是，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/13/kubernetes-v1-29-release/&#34;&gt;Kubernetes v1.29.0 版本&lt;/a&gt;增加了对
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/sidecar-containers/&#34;&gt;边车容器&lt;/a&gt;的原生支持，
现在可以在 &lt;code&gt;.spec.initContainers&lt;/code&gt; 字段中定义，但带有 &lt;code&gt;restartPolicy: Always&lt;/code&gt;。
你可以在下面的示例 Pod 清单片段中看到这一点：&lt;/p&gt;
&lt;!--
```yaml
initContainers:
  - name: logshipper
    image: alpine:latest
    restartPolicy: Always # this is what makes it a sidecar container
    command: [&#39;sh&#39;, &#39;-c&#39;, &#39;tail -F /opt/logs.txt&#39;]
    volumeMounts:
    - name: data
        mountPath: /opt
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;logshipper&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;alpine:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 这就是它成为边车容器的原因&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;sh&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;-c&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;tail -F /opt/logs.txt&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMounts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;data&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/opt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
What are the specifics of defining sidecars with a `.spec.initContainers` block, rather than as a legacy multi-container pod with multiple `.spec.containers`?
Well, all `.spec.initContainers` are always launched **before** the main application. If you define Kubernetes-native sidecars, those are terminated **after** the main application. Furthermore, when used with [Jobs](/docs/concepts/workloads/controllers/job/), a sidecar container should still be alive and could potentially even restart after the owning Job is complete; Kubernetes-native sidecar containers do not block pod completion.

To learn more, you can also read the official [Pod sidecar containers tutorial](/docs/tutorials/configuration/pod-sidecar-containers/).
--&gt;
&lt;p&gt;使用 &lt;code&gt;.spec.initContainers&lt;/code&gt; 块定义边车与使用多个 &lt;code&gt;.spec.containers&lt;/code&gt;
定义传统的多容器 Pod 相比，具体有什么不同？
其实，所有 &lt;code&gt;.spec.initContainers&lt;/code&gt; 总是&lt;strong&gt;在&lt;/strong&gt;主应用之前启动。
如果你定义了 Kubernetes 原生的边车容器，这些边车容器将在主应用之后&lt;strong&gt;终止&lt;/strong&gt;。
此外，当与 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/&#34;&gt;Job&lt;/a&gt; 一起使用时，
边车容器仍然保持运行，并且在拥有它的 Job 完成后甚至可能重启；
Kubernetes 原生边车容器不会阻止 Pod 的完成。&lt;/p&gt;
&lt;p&gt;要了解更多，你也可以阅读官方的
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tutorials/configuration/pod-sidecar-containers/&#34;&gt;Pod 边车容器教程&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## The problem

Now you know that defining a sidecar with this native approach will always start it before the main application. From the [kubelet source code](https://github.com/kubernetes/kubernetes/blob/537a602195efdc04cdf2cb0368792afad082d9fd/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L827-L830), it&#39;s visible that this often means being started almost in parallel, and this is not always what an engineer wants to achieve. What I&#39;m really interested in is whether I can delay the start of the main application until the sidecar is not just started, but fully running and ready to serve.
It might be a bit tricky because the problem with sidecars is there’s no obvious success signal, contrary to init containers - designed to run only for a specified period of time. With an init container, exit status 0 is unambiguously &#34;I succeeded&#34;. With a sidecar, there are lots of points at which you can say &#34;a thing is running&#34;.
Starting one container only after the previous one is ready is part of a graceful deployment strategy, ensuring proper sequencing and stability during startup. It’s also actually how I’d expect sidecar containers to work as well, to cover the scenario where the main application is dependent on the sidecar. For example, it may happen that an app errors out if the sidecar isn’t available to serve requests (e.g., logging with DataDog). Sure, one could change the application code (and it would actually be the “best practice” solution), but sometimes they can’t - and this post focuses on this use case.
--&gt;
&lt;h2 id=&#34;问题&#34;&gt;问题&lt;/h2&gt;
&lt;p&gt;现在你知道使用这种原生方法定义边车总是会在主应用之前启动它。
从 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/537a602195efdc04cdf2cb0368792afad082d9fd/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L827-L830&#34;&gt;kubelet 源代码&lt;/a&gt;
可以看出，这通常意味着几乎是并行启动的，而这并不总是工程师想要的结果。
我们真正感兴趣的是，是否可以延迟主应用的启动，直到边车不仅启动而且完全运行并准备好服务。
这可能有点棘手，因为与 Init 容器不同（设计为仅运行指定的时间段），边车没有明显的成功信号。
对于一个 Init 容器，退出状态 0 明确表示“我成功了”。而对于边车容器，
在很多情况下你可以说“某个东西正在运行”。
仅在前一个容器准备好之后才启动另一个容器，这是优雅部署策略的一部分，
确保启动期间的正确排序和稳定性。实际上，这也是我希望边车容器工作的方式，
以覆盖主应用依赖于边车的场景。例如，如果边车不可用于服务请求（例如，使用 DataDog 进行日志记录），
应用程序可能会报错。当然，可以更改应用程序代码（这实际上是“最佳实践”解决方案），
但有时他们不能这样做 - 而本文档关注的就是这种情况。&lt;/p&gt;
&lt;!--
I&#39;ll explain some ways that you might try, and show you what approaches will really work.
--&gt;
&lt;p&gt;我会解释一些你可能尝试的方法，并告诉你哪些方法真的有效。&lt;/p&gt;
&lt;!--
## Readiness probe

To check whether Kubernetes native sidecar delays the start of the main application until the sidecar is ready, let’s simulate a short investigation. Firstly, I’ll simulate a sidecar container which will never be ready by implementing a readiness probe which will never succeed. As a reminder, a [readiness probe](/docs/concepts/configuration/liveness-readiness-startup-probes/) checks if the container is ready to start accepting traffic and therefore, if the pod can be used as a backend for services. 
--&gt;
&lt;h2 id=&#34;就绪性检测&#34;&gt;就绪性检测&lt;/h2&gt;
&lt;p&gt;要检查 Kubernetes 原生边车是否会延迟主应用的启动直到边车准备就绪，
让我们模拟一个简短的调查。首先，我将通过实现一个永远不会成功的就绪探针来模拟一个永远不会准备就绪的边车容器。
提醒一下，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/configuration/liveness-readiness-startup-probes/&#34;&gt;就绪性探针&lt;/a&gt;检查容器是否准备好开始接受流量，
由此判断 Pod 是否可以用于服务的后端。&lt;/p&gt;
&lt;!--
(Unlike standard init containers, sidecar containers can have [probes](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/) so that the kubelet can supervise the sidecar and intervene if there are problems. For example, restarting a sidecar container if it fails a health check.)
--&gt;
&lt;p&gt;（与标准的 Init 容器不同，边车容器可以拥有&lt;a href=&#34;https://kubernetes.io/zh-cn/docs/concepts/configuration/liveness-readiness-startup-probes/&#34;&gt;探针&lt;/a&gt; ，
以便 kubelet 可以监督边车，并在出现问题时进行干预。例如，
如果边车容器未通过健康检查，则重启它。）&lt;/p&gt;
&lt;!--
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
  labels:
    app: myapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp
          image: alpine:latest
          command: [&#34;sh&#34;, &#34;-c&#34;, &#34;sleep 3600&#34;]
      initContainers:
        - name: nginx
          image: nginx:latest
          restartPolicy: Always
          ports:
            - containerPort: 80
              protocol: TCP
          readinessProbe:
            exec:
              command:
              - /bin/sh
              - -c
              - exit 1 # this command always fails, keeping the container &#34;Not Ready&#34;
            periodSeconds: 5
      volumes:
        - name: data
          emptyDir: {}
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;apps/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Deployment&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;replicas&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;alpine:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sh&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sleep 3600&amp;#34;&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ports&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;TCP&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;readinessProbe&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;exec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- /bin/sh&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- exit 1&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 此命令总是失败，导致容器处于&amp;#34;未就绪&amp;#34;状态&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;periodSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;data&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;emptyDir&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The result is:
--&gt;
&lt;p&gt;结果是：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;controlplane $ kubectl get pods -w
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;NAME                    READY   STATUS    RESTARTS   AGE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;myapp-db5474f45-htgw5   1/2     Running   0          9m28s
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;controlplane $ kubectl describe pod myapp-db5474f45-htgw5 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Name:             myapp-db5474f45-htgw5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Namespace:        default
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;(...)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Events:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Type     Reason     Age               From               Message
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  ----     ------     ----              ----               -------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Scheduled  17s               default-scheduler  Successfully assigned default/myapp-db5474f45-htgw5 to node01
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Pulling    16s               kubelet            Pulling image &amp;#34;nginx:latest&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Pulled     16s               kubelet            Successfully pulled image &amp;#34;nginx:latest&amp;#34; in 163ms (163ms including waiting). Image size: 72080558 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Created    16s               kubelet            Created container nginx
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Started    16s               kubelet            Started container nginx
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Pulling    15s               kubelet            Pulling image &amp;#34;alpine:latest&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Pulled     15s               kubelet            Successfully pulled image &amp;#34;alpine:latest&amp;#34; in 159ms (160ms including waiting). Image size: 3652536 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Created    15s               kubelet            Created container myapp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Started    15s               kubelet            Started container myapp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Warning  Unhealthy  1s (x6 over 15s)  kubelet            Readiness probe failed:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
From these logs it’s evident that only one container is ready - and I know it can’t be the sidecar, because I’ve defined it so it’ll never be ready (you can also check container statuses in `kubectl get pod -o json`). I also saw that myapp has been started before the sidecar is ready. That was not the result I wanted to achieve; in this case, the main app container has a hard dependency on its sidecar.
--&gt;
&lt;p&gt;从这些日志中可以明显看出只有一个容器准备就绪 - 我知道这不可能是边车，
因为我将其定义为永远不会准备就绪（你也可以在 &lt;code&gt;kubectl get pod -o json&lt;/code&gt; 中检查容器状态）。
我还看到 myapp 在边车准备就绪之前已经启动。这不是我希望达到的结果；
在这种情况下，主应用容器对它边车有硬依赖。&lt;/p&gt;
&lt;!--
## Maybe a startup probe?

To ensure that the sidecar is ready before the main app container starts, I can define a `startupProbe`. It will delay the start of the main container until the command is successfully executed (returns `0` exit status). If you’re wondering why I’ve added it to my `initContainer`, let’s analyse what happens If I’d added it to myapp container. I wouldn’t have guaranteed the probe would run before the main application code - and this one, can potentially error out without the sidecar being up and running.
--&gt;
&lt;h2 id=&#34;或许是一个启动探针&#34;&gt;或许是一个启动探针？&lt;/h2&gt;
&lt;p&gt;为了确保边车准备就绪后再启动主应用容器，我可以定义一个 &lt;code&gt;startupProbe&lt;/code&gt;。
这将延迟主容器的启动，直到命令成功执行（返回 &lt;code&gt;0&lt;/code&gt; 退出状态）。
如果你想知道为什么我将其添加到我的 &lt;code&gt;initContainer&lt;/code&gt; 中，
让我们分析一下如果我将其添加到 myapp 容器会发生什么。
我不能保证探针会在主应用代码之前运行 - 而这可能会导致错误，尤其是在边车尚未启动和运行时。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;apps/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Deployment&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;replicas&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myapp&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;alpine:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sh&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sleep 3600&amp;#34;&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ports&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;TCP&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;startupProbe&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;httpGet&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;path&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initialDelaySeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;periodSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;30&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;failureThreshold&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;timeoutSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;20&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;data&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;emptyDir&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
This results in 2/2 containers being ready and running, and from events, it can be inferred that the main application started only after nginx had already been started. But to confirm whether it waited for the sidecar readiness, let’s change the `startupProbe` to the exec type of command: 
--&gt;
&lt;p&gt;这导致 2/2 个容器已就绪并运行，从事件中可以推断主应用仅在 nginx 已启动后才开始启动。
但为了确认它是否等待了边车的就绪状态，让我们将 &lt;code&gt;startupProbe&lt;/code&gt; 更改为执行类型命令：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;startupProbe&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;exec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- /bin/sh&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- sleep 15&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
and run `kubectl get pods -w` to watch in real time whether the readiness of both containers only changes after a 15 second delay. Again, events confirm the main application starts after the sidecar.
That means that using the `startupProbe` with a correct `startupProbe.httpGet` request helps to delay the main application start until the sidecar is ready. It’s not optimal, but it works.
--&gt;
&lt;p&gt;并运行 &lt;code&gt;kubectl get pods -w&lt;/code&gt; 以实时观察两个容器的就绪状态是否仅在 15 秒延迟后更改。
再次确认，事件显示主应用在边车之后启动。
这意味着使用带有正确 &lt;code&gt;startupProbe.httpGet&lt;/code&gt; 请求的 &lt;code&gt;startupProbe&lt;/code&gt;
有助于延迟主应用的启动，直到边车准备就绪。这不理想，但它有效。&lt;/p&gt;
&lt;!--
## What about the postStart lifecycle hook?

Fun fact: using the `postStart` lifecycle hook block will also do the job, but I’d have to write my own mini-shell script, which is even less efficient.
--&gt;
&lt;h2 id=&#34;关于-poststart-生命周期钩子&#34;&gt;关于 postStart 生命周期钩子？&lt;/h2&gt;
&lt;p&gt;趣闻：使用 &lt;code&gt;postStart&lt;/code&gt; 生命周期钩子块也可以完成任务，
但我要编写自己的迷你 Shell 脚本，这甚至更低效。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ports&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;TCP&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;lifecycle&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;postStart&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;exec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- /bin/sh&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- |&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            echo &amp;#34;Waiting for readiness at http://localhost:80&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            until curl -sf http://localhost:80; do
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;              echo &amp;#34;Still waiting for http://localhost:80...&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;              sleep 5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            done
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            echo &amp;#34;Service is ready at http://localhost:80&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Liveness probe

An interesting exercise would be to check the sidecar container behavior with a [liveness probe](/docs/concepts/configuration/liveness-readiness-startup-probes/).
A liveness probe behaves and is configured similarly to a readiness probe - only with the difference that it doesn’t affect the readiness of the container but restarts it in case the probe fails. 
--&gt;
&lt;h2 id=&#34;存活探针&#34;&gt;存活探针&lt;/h2&gt;
&lt;p&gt;一个有趣的练习是使用&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/configuration/liveness-readiness-startup-probes/&#34;&gt;存活探针&lt;/a&gt;检查边车容器的行为。
存活探针的配置和行为与就绪探针相似——唯一的区别是它不会影响容器的就绪状态，而是在探针失败时重启容器。&lt;/p&gt;
&lt;!--
```yaml
livenessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - exit 1 # this command always fails, keeping the container &#34;Not Ready&#34;
  periodSeconds: 5
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;livenessProbe&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;exec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- /bin/sh&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- exit 1&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 该命令总是失败，导致容器处于&amp;#34;未就绪&amp;#34;状态&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;periodSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
After adding the liveness probe configured just as the previous readiness probe and checking events of the pod by `kubectl describe pod` it’s visible that the sidecar has a restart count above 0. Nevertheless, the main application is not restarted nor influenced at all, even though I&#39;m aware that (in our imaginary worst-case scenario) it can error out when the sidecar is not there serving requests.
What if I’d used a `livenessProbe` without lifecycle `postStart`? Both containers will be immediately ready: at the beginning, this behavior will not be different from the one without any additional probes since the liveness probe doesn’t affect readiness at all. After a while, the sidecar will begin to restart itself, but it won’t influence the main container.
--&gt;
&lt;p&gt;在添加了配置与之前的就绪探针相同的存活探针，并通过 &lt;code&gt;kubectl describe pod&lt;/code&gt;
检查 Pod 的事件后，可以看到边车的重启次数超过 0。尽管如此，主应用并未受到任何影响或重启，
即使我知道（在我们假想的最坏情况下）当边车不处理请求时，主应用可能会出错。
如果我在没有生命周期 &lt;code&gt;postStart&lt;/code&gt; 的情况下使用 &lt;code&gt;livenessProbe&lt;/code&gt; 会怎样？
两个容器将立即准备就绪：一开始，这种行为不会与没有任何额外探针的情况有任何不同，
因为存活探针完全不影响就绪状态。一段时间后，边车将开始重启自己，但这不会影响主容器。&lt;/p&gt;
&lt;!--
## Findings summary

I’ll summarize the startup behavior in the table below:
--&gt;
&lt;h2 id=&#34;调研总结&#34;&gt;调研总结&lt;/h2&gt;
&lt;p&gt;我将在下表中总结启动行为：&lt;/p&gt;
&lt;!--
| Probe/Hook     | Sidecar starts before the main app?                      | Main app waits for the sidecar to be ready?         | What if the check doesn’t pass?                    |
|----------------|----------------------------------------------------------|-----------------------------------------------------|----------------------------------------------------|
| `readinessProbe` | **Yes**, but it’s almost in parallel (effectively **no**)    | **No**                                                  | Sidecar is not ready; main app continues running   |
| `livenessProbe`  | Yes, but it’s almost in parallel (effectively **no**)    | **No**                                                  | Sidecar is restarted, main app continues running   |
| `startupProbe`   | **Yes**                                                      | **Yes**                                                 | Main app is not started                            |
| postStart      | **Yes**, main app container starts after `postStart` completes | **Yes**, but you have to provide custom logic for that  | Main app is not started                            |
--&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;探针/钩子&lt;/th&gt;
&lt;th&gt;边车在主应用之前启动？&lt;/th&gt;
&lt;th&gt;主应用是否等待边车准备就绪？&lt;/th&gt;
&lt;th&gt;如果检查不通过会发生什么？&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;readinessProbe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;是&lt;/strong&gt;，但几乎是并行的（实际上为 &lt;strong&gt;否&lt;/strong&gt;）&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;否&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;边车未就绪；主应用继续运行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;livenessProbe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;是，但几乎是并行的（实际上为 &lt;strong&gt;否&lt;/strong&gt;）&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;否&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;边车被重启，主应用继续运行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;startupProbe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;是&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;是&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;主应用不会启动&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;postStart&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;是&lt;/strong&gt;，主应用容器在 &lt;code&gt;postStart&lt;/code&gt; 完成后启动&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;是&lt;/strong&gt;，但你必须为此提供自定义逻辑&lt;/td&gt;
&lt;td&gt;主应用不会启动&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!--
To summarize: with sidecars often being a dependency of the main application, you may want to delay the start of the latter until the sidecar is healthy.
The ideal pattern is to start both containers simultaneously and have the app container logic delay at all levels, but it’s not always possible. If that&#39;s what you need, you have to use the right kind of customization to the Pod definition. Thankfully, it’s nice and quick, and you have the recipe ready above.

Happy deploying!
--&gt;
&lt;p&gt;总结：由于边车经常是主应用的依赖项，你可能希望延迟后者启动直到边车健康。&lt;/p&gt;
&lt;p&gt;理想模式是同时启动两个容器，并让应用容器逻辑在所有层面上延迟，但这并不总是可行。
如果你需要这样做，就必须对 Pod 定义使用适当的自定义设置。
值得庆幸的是，这既简单又快速，并且你已经有了上面的解决方案。&lt;/p&gt;
&lt;p&gt;祝部署顺利！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Gateway API v1.3.0：流量复制、CORS、Gateway 合并和重试预算的改进</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/02/gateway-api-v1-3/</link>
      <pubDate>Mon, 02 Jun 2025 09:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/02/gateway-api-v1-3/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Gateway API v1.3.0: Advancements in Request Mirroring, CORS, Gateway Merging, and Retry Budgets&#34;
date: 2025-06-02T09:00:00-08:00
draft: false
slug: gateway-api-v1-3
author: &gt;
  [Candace Holman](https://github.com/candita) (Red Hat)
--&gt;
&lt;p&gt;&lt;img alt=&#34;Gateway API logo&#34; src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/06/02/gateway-api-v1-3/gateway-api-logo.svg&#34;&gt;&lt;/p&gt;
&lt;!--
Join us in the Kubernetes SIG Network community in celebrating the general
availability of [Gateway API](https://gateway-api.sigs.k8s.io/) v1.3.0! We are
also pleased to announce that there are already a number of conformant
implementations to try, made possible by postponing this blog
announcement. Version 1.3.0 of the API was released about a month ago on
April 24, 2025.
--&gt;
&lt;p&gt;加入 Kubernetes SIG Network 社区，共同庆祝 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/&#34;&gt;Gateway API&lt;/a&gt; v1.3.0 正式发布！
我们很高兴地宣布，通过推迟这篇博客的发布，现在已经有了多个符合规范的实现可供试用。
API 1.3.0 版本已于 2025 年 4 月 24 日发布。&lt;/p&gt;
&lt;!--
Gateway API v1.3.0 brings a new feature to the _Standard_ channel
(Gateway API&#39;s GA release channel): _percentage-based request mirroring_, and
introduces three new experimental features: cross-origin resource sharing (CORS)
filters, a standardized mechanism for listener and gateway merging, and retry
budgets.
--&gt;
&lt;p&gt;Gateway API v1.3.0 为 &lt;strong&gt;Standard&lt;/strong&gt; 渠道（Gateway API 的正式发布渠道）带来了一个新功能：&lt;strong&gt;基于百分比的流量复制&lt;/strong&gt;，
并引入了三个新的实验性功能：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;跨源资源共享（CORS）过滤器&lt;/li&gt;
&lt;li&gt;Listener 和 Gateway 合并的标准化机制&lt;/li&gt;
&lt;li&gt;重试预算（Retry Budgets）&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Also see the full
[release notes](https://github.com/kubernetes-sigs/gateway-api/blob/54df0a899c1c5c845dd3a80f05dcfdf65576f03c/CHANGELOG/1.3-CHANGELOG.md)
and applaud the
[v1.3.0 release team](https://github.com/kubernetes-sigs/gateway-api/blob/54df0a899c1c5c845dd3a80f05dcfdf65576f03c/CHANGELOG/1.3-TEAM.md)
next time you see them.
--&gt;
&lt;p&gt;另请查看完整的&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/54df0a899c1c5c845dd3a80f05dcfdf65576f03c/CHANGELOG/1.3-CHANGELOG.md&#34;&gt;发布说明&lt;/a&gt;，
下次见到 &lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/54df0a899c1c5c845dd3a80f05dcfdf65576f03c/CHANGELOG/1.3-TEAM.md&#34;&gt;v1.3.0 发布团队&lt;/a&gt; 时请为他们鼓掌。&lt;/p&gt;
&lt;!--
## Graduation to Standard channel
--&gt;
&lt;h2 id=&#34;graduation-to-standard-channel&#34;&gt;升级至 Standard 渠道&lt;/h2&gt;
&lt;!--
Graduation to the Standard channel is a notable achievement for Gateway API
features, as inclusion in the Standard release channel denotes a high level of
confidence in the API surface and provides guarantees of backward compatibility.
Of course, as with any other Kubernetes API, Standard channel features can continue
to evolve with backward-compatible additions over time, and we (SIG Network)
certainly expect
further refinements and improvements in the future. For more information on how
all of this works, refer to the [Gateway API Versioning Policy](https://gateway-api.sigs.k8s.io/concepts/versioning/).
--&gt;
&lt;p&gt;对于 Gateway API 的功能来说，升级到 Standard 渠道是一个重要的里程碑。
被纳入 Standard 发布渠道表明我们对该 API 接口的稳定性具有高度信心，并且承诺向后兼容。
当然，与任何其他 Kubernetes API 一样， Standard 渠道中的功能仍可通过向后兼容的方式不断演进。
我们（SIG Network）也确实预计未来会有进一步的优化和改进。
有关这一切如何运作的更多信息，请参阅 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/versioning/&#34;&gt;Gateway API 版本控制策略&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Percentage-based request mirroring

Leads: [Lior Lieberman](https://github.com/LiorLieberman),[Jake Bennert](https://github.com/jakebennert)
GEP-3171: [Percentage-Based Request Mirroring](https://github.com/kubernetes-sigs/gateway-api/blob/main/geps/gep-3171/index.md)
--&gt;
&lt;h3 id=&#34;percentage-based-request-mirroring&#34;&gt;基于百分比的流量复制&lt;/h3&gt;
&lt;p&gt;负责人：&lt;a href=&#34;https://github.com/LiorLieberman&#34;&gt;Lior Lieberman&lt;/a&gt;、&lt;a href=&#34;https://github.com/jakebennert&#34;&gt;Jake Bennert&lt;/a&gt;
GEP-3171：&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/geps/gep-3171/index.md&#34;&gt;基于百分比的流量复制&lt;/a&gt;&lt;/p&gt;
&lt;!--
_Percentage-based request mirroring_ is an enhancement to the
existing support for [HTTP request mirroring](https://gateway-api.sigs.k8s.io/guides/http-request-mirroring/), which allows HTTP requests to be duplicated to another backend using the
RequestMirror filter type.  Request mirroring is particularly useful in
blue-green deployment. It can be used to assess the impact of request scaling on
application performance without impacting responses to clients.
--&gt;
&lt;p&gt;&lt;strong&gt;基于百分比的流量复制&lt;/strong&gt;是对现有 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/http-request-mirroring/&#34;&gt;HTTP 流量复制&lt;/a&gt; 支持的增强，
它允许使用 RequestMirror 过滤器类型将 HTTP 请求复制到另一个后端。流量复制在蓝绿部署中特别有用。
它可用于评估流量波动对应用程序性能的影响，而不会影响对客户端的响应。&lt;/p&gt;
&lt;!--
The previous mirroring capability worked on all the requests to a `backendRef`.
Percentage-based request mirroring allows users to specify a subset of requests
they want to be mirrored, either by percentage or fraction. This can be
particularly useful when services are receiving a large volume of requests.
Instead of mirroring all of those requests, this new feature can be used to
mirror a smaller subset of them.
--&gt;
&lt;p&gt;之前的流量复制功能适用于对 &lt;code&gt;backendRef&lt;/code&gt; 的所有请求。基于百分比的流量复制允许用户指定他们想要复制的请求子集，
可以通过百分比或分数来指定。当服务接收大量请求时，这特别有用。这个新功能可以用来复制这些请求中的一小部分，
而不是复制所有请求。&lt;/p&gt;
&lt;!--
Here&#39;s an example with 42% of the requests to &#34;foo-v1&#34; being mirrored to &#34;foo-v2&#34;:
--&gt;
&lt;p&gt;以下是一个示例，将发送到 &amp;quot;foo-v1&amp;quot; 的流量的  42% 复制到 &amp;quot;foo-v2&amp;quot;：&lt;/p&gt;
&lt;!--
```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-filter-mirror
  labels:
    gateway: mirror-gateway
spec:
  parentRefs:
  - name: mirror-gateway
  hostnames:
  - mirror.example
  rules:
  - backendRefs:
    - name: foo-v1
      port: 8080
    filters:
    - type: RequestMirror
      requestMirror:
        backendRef:
          name: foo-v2
          port: 8080
        percent: 42 # This value must be an integer.
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTPRoute&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;http-filter-mirror&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;gateway&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;mirror-gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parentRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;mirror-gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostnames&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- mirror.example&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backendRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;filters&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;RequestMirror&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requestMirror&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backendRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-v2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;percent&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;42&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 此值必须为整数。&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can also configure the partial mirroring using a fraction. Here is an example
with 5 out of every 1000 requests to &#34;foo-v1&#34; being mirrored to &#34;foo-v2&#34;.
--&gt;
&lt;p&gt;你也可以通过调整分数来实现部分流量复制。
以下是一个示例，在发送到 &amp;quot;foo-v1&amp;quot; 的请求中，将每 1000 个中的 5 个复制到 &amp;quot;foo-v2&amp;quot;。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backendRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;filters&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;RequestMirror&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requestMirror&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backendRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-v2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;fraction&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;numerator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;denominator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Additions to Experimental channel
--&gt;
&lt;h2 id=&#34;additions-to-Experimental-channel&#34;&gt;实验渠道的新特性&lt;/h2&gt;
&lt;!--
The Experimental channel is Gateway API&#39;s channel for experimenting with new
features and gaining confidence with them before allowing them to graduate to
standard.  Please note: the experimental channel may include features that are
changed or removed later.
--&gt;
&lt;p&gt;实验渠道（Experimental channel）是 Gateway API 用于试验新功能的渠道，以便在功能成熟之前积累足够信心，
再将其升级为 Standard 渠道功能。
请注意：实验渠道可能包含后续会被更改或移除的功能。&lt;/p&gt;
&lt;!--
Starting in release v1.3.0, in an effort to distinguish Experimental channel
resources from Standard channel resources, any new experimental API kinds have the
prefix &#34;**X**&#34;.  For the same reason, experimental resources are now added to the
API group `gateway.networking.x-k8s.io` instead of `gateway.networking.k8s.io`.
Bear in mind that using new experimental channel resources means they can coexist
with standard channel resources, but migrating these resources to the standard
channel will require recreating them with the standard channel names and API
group (both of which lack the &#34;x-k8s&#34; designator or &#34;X&#34; prefix).
--&gt;
&lt;p&gt;从 v1.3.0 版本开始，为了区分实验渠道资源和 Standard 渠道资源，
所有新的实验性 API 类型都带有 &amp;quot;&lt;strong&gt;X&lt;/strong&gt;&amp;quot; 前缀。
出于同样的原因，实验性资源现在被添加到 API 组 &lt;code&gt;gateway.networking.x-k8s.io&lt;/code&gt;，
而不是 &lt;code&gt;gateway.networking.k8s.io&lt;/code&gt;。
请注意，使用新的实验渠道资源意味着它们可以与 Standard 渠道资源共存，
若要将这些资源迁移到 Standard 渠道，则需要使用 Standard 渠道的名称和 API 组
（两者都不包含 &amp;quot;x-k8s&amp;quot; 标识或 &amp;quot;X&amp;quot; 前缀）来重新创建它们。&lt;/p&gt;
&lt;!--
The v1.3 release introduces two new experimental API kinds: XBackendTrafficPolicy
and XListenerSet.  To be able to use experimental API kinds, you need to install
the Experimental channel Gateway API YAMLs from the locations listed below.
--&gt;
&lt;p&gt;v1.3 版本引入了两个新的实验性 API 类型：XBackendTrafficPolicy 和 XListenerSet。
要使用实验性 API 类型，你需要从下面列出的位置安装实验渠道 Gateway API YAML 文件。&lt;/p&gt;
&lt;!--
### CORS filtering
--&gt;
&lt;h3 id=&#34;cors-filtering&#34;&gt;CORS 过滤&lt;/h3&gt;
&lt;!--
Leads: [Liang Li](https://github.com/liangli), [Eyal Pazz](https://github.com/EyalPazz), [Rob Scott](https://github.com/robscott)

GEP-1767: [CORS Filter](https://github.com/kubernetes-sigs/gateway-api/blob/main/geps/gep-1767/index.md)
--&gt;
&lt;p&gt;负责人：&lt;a href=&#34;https://github.com/liangli&#34;&gt;Liang Li&lt;/a&gt;、&lt;a href=&#34;https://github.com/EyalPazz&#34;&gt;Eyal Pazz&lt;/a&gt;、&lt;a href=&#34;https://github.com/robscott&#34;&gt;Rob Scott&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;GEP-1767：&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/geps/gep-1767/index.md&#34;&gt;CORS 过滤器&lt;/a&gt;&lt;/p&gt;
&lt;!--
Cross-origin resource sharing (CORS) is an HTTP-header based mechanism that allows
a web page to access restricted resources from a server on an origin (domain,
scheme, or port) different from the domain that served the web page. This feature
adds a new HTTPRoute `filter` type, called &#34;CORS&#34;, to configure the handling of
cross-origin requests before the response is sent back to the client.
--&gt;
&lt;p&gt;跨源资源共享（CORS）是一种基于 HTTP Header 的机制，
允许网页从与提供网页的域不同的源（域名、协议或端口）访问受限资源。
此功能添加了一个新的 HTTPRoute &lt;code&gt;filter&lt;/code&gt; 类型，
称为 &amp;quot;CORS&amp;quot;，用于在响应发送回客户端之前配置跨源请求的处理。&lt;/p&gt;
&lt;!--
To be able to use experimental CORS filtering, you need to install the
[Experimental channel Gateway API HTTPRoute yaml](https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml).
--&gt;
&lt;p&gt;要使用实验性 CORS 过滤，你需要安装&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml&#34;&gt;实验渠道 Gateway API HTTPRoute yaml&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Here&#39;s an example of a simple cross-origin configuration:
--&gt;
&lt;p&gt;以下是一个简单的跨源配置示例：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTPRoute&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;http-route-cors&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parentRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;http-gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matches&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;path&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PathPrefix&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/resource/foo&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;filters&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cors&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;CORS&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowOrigins&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- *&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowMethods&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- GET&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- HEAD&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- POST&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowHeaders&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- Accept&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- Accept-Language&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- Content-Language&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- Content-Type&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- Range&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backendRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Service&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;http-route-cors&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
In this case, the Gateway returns an _origin header_ of &#34;*&#34;, which means that the
requested resource can be referenced from any origin, a _methods header_
(`Access-Control-Allow-Methods`) that permits the `GET`, `HEAD`, and `POST`
verbs, and a _headers header_ allowing `Accept`, `Accept-Language`,
`Content-Language`, `Content-Type`, and `Range`.
--&gt;
&lt;p&gt;在这种情况下，Gateway 返回一个 &lt;strong&gt;origin header&lt;/strong&gt; 为 &amp;quot;*&amp;quot;，这意味着请求的资源可以从任何源引用；
一个 &lt;strong&gt;methods header&lt;/strong&gt; （&lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt;）允许 &lt;code&gt;GET&lt;/code&gt;、&lt;code&gt;HEAD&lt;/code&gt; 和 &lt;code&gt;POST&lt;/code&gt; 方法；
此外，还会返回一个 &lt;strong&gt;headers header&lt;/strong&gt; ，允许的字段包括 &lt;code&gt;Accept&lt;/code&gt;、&lt;code&gt;Accept-Language&lt;/code&gt;、
&lt;code&gt;Content-Language&lt;/code&gt;、&lt;code&gt;Content-Type&lt;/code&gt; 和 &lt;code&gt;Range&lt;/code&gt;。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;HTTP/1.1 200 OK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Access-Control-Allow-Origin: *
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Access-Control-Allow-Methods: GET, HEAD, POST
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Access-Control-Allow-Headers: Accept,Accept-Language,Content-Language,Content-Type,Range
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The complete list of fields in the new CORS filter:
* `allowOrigins`
* `allowMethods`
* `allowHeaders`
* `allowCredentials`
* `exposeHeaders`
* `maxAge`

See [CORS protocol](https://fetch.spec.whatwg.org/#http-cors-protocol) for details.
--&gt;
&lt;p&gt;新的 CORS 过滤器中的完整字段列表如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;allowOrigins&lt;/code&gt;：允许的请求来源列表。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;allowMethods&lt;/code&gt;：允许的 HTTP 方法（如 &lt;code&gt;GET&lt;/code&gt;、&lt;code&gt;POST&lt;/code&gt; 等）。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;allowHeaders&lt;/code&gt;：允许携带的请求头字段。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;allowCredentials&lt;/code&gt;：是否允许携带凭据（如 Cookie、Authorization 头等）。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exposeHeaders&lt;/code&gt;：允许客户端访问的响应头字段。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maxAge&lt;/code&gt;：预检请求的缓存持续时间（单位：秒）。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有关详细信息，请参阅 &lt;a href=&#34;https://fetch.spec.whatwg.org/#http-cors-protocol&#34;&gt;CORS 协议&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### XListenerSets (standardized mechanism for Listener and Gateway merging){#XListenerSet}
--&gt;
&lt;h3 id=&#34;XListenerSet&#34;&gt;XListenerSets（Listener 和 Gateway 合并的标准化机制）&lt;/h3&gt;
&lt;!--
Lead: [Dave Protasowski](https://github.com/dprotaso)
--&gt;
&lt;p&gt;负责人：&lt;a href=&#34;https://github.com/dprotaso&#34;&gt;Dave Protasowski&lt;/a&gt;&lt;/p&gt;
&lt;!--
GEP-1713: [ListenerSets - Standard Mechanism to Merge Multiple Gateways](https://github.com/kubernetes-sigs/gateway-api/pull/3213)
--&gt;
&lt;p&gt;GEP-1713：&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/pull/3213&#34;&gt;ListenerSets - 合并多个 Gateway 的标准机制&lt;/a&gt;&lt;/p&gt;
&lt;!--
This release adds a new experimental API kind, XListenerSet, that allows a
shared list of _listeners_ to be attached to one or more parent Gateway(s).  In
addition, it expands upon the existing suggestion that Gateway API implementations
may merge configuration from multiple Gateway objects.  It also:
--&gt;
&lt;p&gt;此版本添加了一个新的实验性 API 类型 XListenerSet，它允许将 &lt;strong&gt;listeners&lt;/strong&gt; 的共享列表附加到一个或多个父 Gateway。
此外，它还扩展了现有的建议，即 Gateway API 实现可以合并来自多个 Gateway 对象的配置。它还包括：&lt;/p&gt;
&lt;!--
- adds a new field `allowedListeners` to the `.spec` of a Gateway. The
`allowedListeners` field defines from which Namespaces to select XListenerSets
that are allowed to attach to that Gateway: Same, All, None, or Selector based.
--&gt;
&lt;ul&gt;
&lt;li&gt;向 Gateway 的 &lt;code&gt;.spec&lt;/code&gt; 添加了一个新字段 &lt;code&gt;allowedListeners&lt;/code&gt;。
&lt;code&gt;allowedListeners&lt;/code&gt; 字段定义了从哪些命名空间选择允许附加到该 Gateway 的 XListenerSets：
Same（同一命名空间）、All（所有命名空间）、None（不允许）、或基于选择器（Selector）的方式。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- increases the previous maximum number (64) of listeners with the addition of
XListenerSets.
--&gt;
&lt;ul&gt;
&lt;li&gt;通过添加 XListenerSets 增加了之前的监听器最大数量（64）。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- allows the delegation of listener configuration, such as TLS, to applications in
other namespaces.
--&gt;
&lt;ul&gt;
&lt;li&gt;允许将监听器配置（如 TLS）委托给其他命名空间中的应用程序。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
To be able to use experimental XListenerSet, you need to install the
[Experimental channel Gateway API XListenerSet yaml](https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.x-k8s.io_xlistenersets.yaml).
--&gt;
&lt;p&gt;要使用实验性 XListenerSet，你需要安装&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.x-k8s.io_xlistenersets.yaml&#34;&gt;实验渠道 Gateway API XListenerSet yaml&lt;/a&gt;。&lt;/p&gt;
&lt;!--
The following example shows a Gateway with an HTTP listener and two child HTTPS
XListenerSets with unique hostnames and certificates.  The combined set of listeners
attached to the Gateway includes the two additional HTTPS listeners in the
XListenerSets that attach to the Gateway.  This example illustrates the
delegation of listener TLS config to application owners in different namespaces
(&#34;store&#34; and &#34;app&#34;).  The HTTPRoute has both the Gateway listener named &#34;foo&#34; and
one XListenerSet listener named &#34;second&#34; as `parentRefs`.
--&gt;
&lt;p&gt;以下示例展示了一个带有 HTTP 监听器和两个子 HTTPS XListenerSets 的 Gateway，
每个 XListenerSet 都有唯一的主机名和证书。
最终附加到该 Gateway 的监听器集合包含这两个附加的 HTTPS &lt;code&gt;XListenerSet&lt;/code&gt; 监听器。
此示例说明了将监听器 TLS 配置委托给不同命名空间（&amp;quot;store&amp;quot; 和 &amp;quot;app&amp;quot;）中的应用程序所有者。
HTTPRoute 同时将名为 &lt;code&gt;&amp;quot;foo&amp;quot;&lt;/code&gt; 的 Gateway 监听器和一个名为 &lt;code&gt;&amp;quot;second&amp;quot;&lt;/code&gt; 的 &lt;code&gt;XListenerSet&lt;/code&gt;
监听器设置为其 &lt;code&gt;parentRefs&lt;/code&gt;。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;prod-external&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;infra&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;gatewayClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowedListeners&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;from&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;All&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;listeners&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostname&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTP&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;---&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.x-k8s.io/v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;XListenerSet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;store&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;store&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parentRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;prod-external&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;listeners&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;first&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostname&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;first.foo.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTPS&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;443&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tls&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Terminate&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;certificateRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Secret&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;group&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;first-workload-cert&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;---&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.x-k8s.io/v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;XListenerSet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parentRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;prod-external&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;listeners&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;second&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostname&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;second.foo.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTPS&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;443&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tls&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Terminate&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;certificateRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Secret&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;group&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;second-workload-cert&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;---&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HTTPRoute&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;httproute-example&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parentRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;XListenerSet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;sectionName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;second&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;parent-gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Gateway&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;sectionName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Each listener in a Gateway must have a unique combination of `port`, `protocol`,
(and `hostname` if supported by the protocol) in order for all listeners to be
**compatible** and not conflicted over which traffic they should receive.
--&gt;
&lt;p&gt;Gateway 中的每个监听器必须具有唯一的 &lt;code&gt;port&lt;/code&gt;、&lt;code&gt;protocol&lt;/code&gt; 组合
（如果协议支持，还包括 &lt;code&gt;hostname&lt;/code&gt;），
以便所有监听器都&lt;strong&gt;兼容&lt;/strong&gt;，并且不会在它们应该接收的流量上发生冲突。&lt;/p&gt;
&lt;!--
Furthermore, implementations can _merge_ separate Gateways into a single set of
listener addresses if all listeners across those Gateways are compatible.  The
management of merged listeners was under-specified in releases prior to v1.3.0.
--&gt;
&lt;p&gt;此外，如果这些 Gateway 上的所有监听器都兼容，实现可以将单独的 Gateway &lt;strong&gt;合并&lt;/strong&gt;为单个监听器地址集。
在 v1.3.0 之前的版本中，合并监听器的管理规范不足。&lt;/p&gt;
&lt;!--
With the new feature, the specification on merging is expanded.  Implementations
must treat the parent Gateways as having the merged list of all listeners from
itself and from attached XListenerSets, and validation of this list of listeners
must behave the same as if the list were part of a single Gateway. Within a single
Gateway, listeners are ordered using the following precedence:
--&gt;
&lt;p&gt;通过新功能，合并规范得到了扩展。实现必须将父 Gateway 视为具有来自自身和附加的 XListenerSets
的所有监听器的合并列表，
并且对该监听器列表的验证行为应与其作为单个 Gateway 的一部分。
在单个 Gateway 内，监听器使用以下优先级排序：&lt;/p&gt;
&lt;!--
1. Single Listeners (not a part of an XListenerSet) first,
--&gt;
&lt;ol&gt;
&lt;li&gt;首先是单个监听器（而不是 XListenerSet 的一部分），&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. Remaining listeners ordered by:
   - object creation time (oldest first), and if two listeners are defined in
   objects that have the same timestamp, then
   - alphabetically based on &#34;{namespace}/{name of listener}&#34;
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;其余监听器按以下顺序排序：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;按对象创建时间排序（最早创建的优先）；&lt;/li&gt;
&lt;li&gt;如果两个监听器所在的对象具有相同的时间戳，
则按照 &lt;code&gt;{namespace}/{监听器名称}&lt;/code&gt; 的字母顺序排序&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### Retry budgets (XBackendTrafficPolicy) {#XBackendTrafficPolicy}
--&gt;
&lt;h3 id=&#34;XBackendTrafficPolicy&#34;&gt;重试预算（Retry budgets）（XBackendTrafficPolicy）&lt;/h3&gt;
&lt;!--
Leads: [Eric Bishop](https://github.com/ericdbishop), [Mike Morris](https://github.com/mikemorris)
--&gt;
&lt;p&gt;负责人：&lt;a href=&#34;https://github.com/ericdbishop&#34;&gt;Eric Bishop&lt;/a&gt;、&lt;a href=&#34;https://github.com/mikemorris&#34;&gt;Mike Morris&lt;/a&gt;&lt;/p&gt;
&lt;!--
GEP-3388: [Retry Budgets](https://gateway-api.sigs.k8s.io/geps/gep-3388)
--&gt;
&lt;p&gt;GEP-3388：&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-3388&#34;&gt;重试预算（Retry budgets）&lt;/a&gt;&lt;/p&gt;
&lt;!--
This feature allows you to configure a _retry budget_ across all endpoints
of a destination Service.  This is used to limit additional client-side retries
after reaching a configured threshold. When configuring the budget, the maximum
percentage of active requests that may consist of retries may be specified, as well as
the interval over which requests will be considered when calculating the threshold
for retries. The development of this specification changed the existing
experimental API kind BackendLBPolicy into a new experimental API kind,
XBackendTrafficPolicy, in the interest of reducing the proliferation of policy
resources that had commonalities.
--&gt;
&lt;p&gt;此功能允许你为目标服务的所有端点配置&lt;strong&gt;重试预算（Retry budgets）&lt;/strong&gt;。
用于在达到配置的阈值后限制额外的客户端重试。
配置预算时，可以指定可能包含重试在内的活动请求的最大百分比，
以及在计算重试阈值时考虑请求的时间间隔。
此规范的开发将现有的实验性 API 类型 BackendLBPolicy 更改为新的实验性 API 类型 XBackendTrafficPolicy，
以减少具有共同点的策略资源的扩散。&lt;/p&gt;
&lt;!--
To be able to use experimental retry budgets, you need to install the
[Experimental channel Gateway API XBackendTrafficPolicy yaml](https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.x-k8s.io_xbackendtrafficpolicies.yaml).
--&gt;
&lt;p&gt;要使用实验性重试预算（Retry budgets），你需要安装&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/config/crd/experimental/gateway.networking.x-k8s.io_xbackendtrafficpolicies.yaml&#34;&gt;实验渠道 Gateway API XBackendTrafficPolicy yaml&lt;/a&gt;。&lt;/p&gt;
&lt;!--
The following example shows an XBackendTrafficPolicy that applies a
`retryConstraint` that represents a budget that limits the retries to a maximum
of 20% of requests, over a duration of 10 seconds, and to a minimum of 3 retries
over 1 second.
--&gt;
&lt;p&gt;以下示例显示了一个 XBackendTrafficPolicy，它应用了一个 &lt;code&gt;retryConstraint&lt;/code&gt; （重试约束），
表示一个 重试预算（Retry budgets） ，将重试限制为最多 20% 的请求，持续时间为 10 秒，
并且在 1 秒内最少重试 3 次。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gateway.networking.x-k8s.io/v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;XBackendTrafficPolicy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;traffic-policy-example&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;retryConstraint&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;budget&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;percent&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;20&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;interval&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;10s&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;minRetryRate&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;count&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;interval&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;1s&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Try it out
--&gt;
&lt;h2 id=&#34;try-it-out&#34;&gt;试用  &lt;/h2&gt;
&lt;!--
Unlike other Kubernetes APIs, you don&#39;t need to upgrade to the latest version of
Kubernetes to get the latest version of Gateway API. As long as you&#39;re running
Kubernetes 1.26 or later, you&#39;ll be able to get up and running with this version
of Gateway API.
--&gt;
&lt;p&gt;与其他 Kubernetes API 不同，你不需要升级到最新版本的 Kubernetes 来获取最新版本的 Gateway API。
只要你运行的是 Kubernetes 1.26 或更高版本，你就可以使用此版本的 Gateway API 启动和运行。&lt;/p&gt;
&lt;!--
To try out the API, follow the [Getting Started Guide](https://gateway-api.sigs.k8s.io/guides/).
As of this writing, four implementations are already conformant with Gateway API
v1.3 experimental channel features. In alphabetical order:
--&gt;
&lt;p&gt;要试用 API，请按照&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/&#34;&gt;入门指南&lt;/a&gt;操作。
截至本文撰写时，已有四个实现符合 Gateway API v1.3 实验渠道功能。按字母顺序排列：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/airlock/microgateway/releases/tag/4.6.0&#34;&gt;Airlock Microgateway 4.6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/cilium/cilium&#34;&gt;Cilium main&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/envoyproxy/gateway/releases/tag/v1.4.0&#34;&gt;Envoy Gateway v1.4.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://istio.io&#34;&gt;Istio 1.27-dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved
--&gt;
&lt;h2 id=&#34;get-involved&#34;&gt;参与其中  &lt;/h2&gt;
&lt;!--
Wondering when a feature will be added?  There are lots of opportunities to get
involved and help define the future of Kubernetes routing APIs for both ingress
and service mesh.
--&gt;
&lt;p&gt;想知道何时会添加功能？有很多机会参与并帮助定义 Kubernetes API 路由的未来，包括 Ingress 和服务网格。&lt;/p&gt;
&lt;!--
* Check out the [user guides](https://gateway-api.sigs.k8s.io/guides) to see what use-cases can be addressed.
* Try out one of the [existing Gateway controllers](https://gateway-api.sigs.k8s.io/implementations/).
* Or [join us in the community](https://gateway-api.sigs.k8s.io/contributing/)
and help us build the future of Gateway API together!
--&gt;
&lt;ul&gt;
&lt;li&gt;查看&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides&#34;&gt;用户指南&lt;/a&gt;了解可以解决哪些用例。&lt;/li&gt;
&lt;li&gt;试用&lt;a href=&#34;https://gateway-api.sigs.k8s.io/implementations/&#34;&gt;现有的 Gateway 控制器&lt;/a&gt;之一。&lt;/li&gt;
&lt;li&gt;或者&lt;a href=&#34;https://gateway-api.sigs.k8s.io/contributing/&#34;&gt;加入我们的社区&lt;/a&gt;，
帮助我们共同构建 Gateway API 的未来！&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The maintainers would like to thank _everyone_ who&#39;s contributed to Gateway
API, whether in the form of commits to the repo, discussion, ideas, or general
support. We could never have made this kind of progress without the support of
this dedicated and active community.
--&gt;
&lt;p&gt;维护者衷心感谢&lt;strong&gt;所有&lt;/strong&gt;为 Gateway API 做出贡献的人，无论是通过提交代码、讨论、想法还是提供其他支持。
没有这个充满热情和活力的社区，我们永远无法取得如此进展。&lt;/p&gt;
&lt;!--
## Related Kubernetes blog articles
--&gt;
&lt;h2 id=&#34;related-kubernetes-blog-articles&#34;&gt;相关 Kubernetes 博客文章  &lt;/h2&gt;
&lt;!--
* [Gateway API v1.2: WebSockets, Timeouts, Retries, and More](/blog/2024/11/21/gateway-api-v1-2/)
  (November 2024)
* [Gateway API v1.1: Service mesh, GRPCRoute, and a whole lot more](/blog/2024/05/09/gateway-api-v1-1/)
  (May 2024)
* [New Experimental Features in Gateway API v1.0](/blog/2023/11/28/gateway-api-ga/)
  (November 2023)
* [Gateway API v1.0: GA Release](/blog/2023/10/31/gateway-api-ga/)
  (October 2023)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2024/11/21/gateway-api-v1-2/&#34;&gt;Gateway API v1.2：WebSockets、超时、重试等&lt;/a&gt;
（2024 年 11 月）&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/09/gateway-api-v1-1/&#34;&gt;Gateway API v1.1：服务网格、GRPCRoute 和更多变化&lt;/a&gt;
（2024 年 5 月）&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2023/11/28/gateway-api-ga/&#34;&gt;Gateway API v1.0 中的新实验功能&lt;/a&gt;
（2023 年 11 月）&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/31/gateway-api-ga/&#34;&gt;Gateway API v1.0：正式发布（GA）&lt;/a&gt;
（2023 年 10 月）&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：原地调整 Pod 资源特性升级为 Beta</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/16/kubernetes-v1-33-in-place-pod-resize-beta/</link>
      <pubDate>Fri, 16 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/16/kubernetes-v1-33-in-place-pod-resize-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: In-Place Pod Resize Graduated to Beta&#34;
slug: kubernetes-v1-33-in-place-pod-resize-beta
date: 2025-05-16T10:30:00-08:00
author: &#34;Tim Allclair (Google)&#34;
--&gt;
&lt;!--
On behalf of the Kubernetes project, I am excited to announce that the **in-place Pod resize** feature (also known as In-Place Pod Vertical Scaling), first introduced as alpha in Kubernetes v1.27, has graduated to **Beta** and will be enabled by default in the Kubernetes v1.33 release! This marks a significant milestone in making resource management for Kubernetes workloads more flexible and less disruptive.
--&gt;
&lt;p&gt;代表 Kubernetes 项目，我很高兴地宣布，&lt;strong&gt;原地 Pod 调整大小&lt;/strong&gt;特性（也称为原地 Pod 垂直缩放），
在 Kubernetes v1.27 中首次引入为 Alpha 版本，现在已升级为 &lt;strong&gt;Beta&lt;/strong&gt; 版本，
并将在 Kubernetes v1.33 发行版中默认启用！
这标志着 Kubernetes 工作负载的资源管理变得更加灵活和不那么具有干扰性的一个重要里程碑。&lt;/p&gt;
&lt;!--
## What is in-place Pod resize?

Traditionally, changing the CPU or memory resources allocated to a container required restarting the Pod. While acceptable for many stateless applications, this could be disruptive for stateful services, batch jobs, or any workloads sensitive to restarts.
--&gt;
&lt;h2 id=&#34;what-is-in-place-pod-resize&#34;&gt;什么是原地 Pod 调整大小？  &lt;/h2&gt;
&lt;p&gt;传统上，更改分配给容器的 CPU 或内存资源需要重启 Pod。
虽然这对于许多无状态应用来说是可以接受的，
但这对于有状态服务、批处理作业或任何对重启敏感的工作负载可能会造成干扰。&lt;/p&gt;
&lt;!--
In-place Pod resizing allows you to change the CPU and memory requests and limits assigned to containers within a *running* Pod, often without requiring a container restart.
--&gt;
&lt;p&gt;原地 Pod 调整大小允许你更改&lt;strong&gt;运行中&lt;/strong&gt;的 Pod 内容器的 CPU
和内存请求及限制，通常无需重启容器。&lt;/p&gt;
&lt;!--
Here&#39;s the core idea:
* The `spec.containers[*].resources` field in a Pod specification now represents the *desired* resources and is mutable for CPU and memory.
* The `status.containerStatuses[*].resources` field reflects the *actual* resources currently configured on a running container.
* You can trigger a resize by updating the desired resources in the Pod spec via the new `resize` subresource.
--&gt;
&lt;p&gt;核心思想如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pod 规约中的 &lt;code&gt;spec.containers[*].resources&lt;/code&gt; 字段现在代表&lt;strong&gt;期望的&lt;/strong&gt;资源，并且对于 CPU 和内存是可变更的。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;status.containerStatuses[*].resources&lt;/code&gt; 字段反映当前运行容器上已配置的&lt;strong&gt;实际&lt;/strong&gt;资源。&lt;/li&gt;
&lt;li&gt;你可以通过新的 &lt;code&gt;resize&lt;/code&gt; 子资源更新 Pod 规约中的期望资源来触发调整大小。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
You can try it out on a v1.33 Kubernetes cluster by using kubectl to edit a Pod (requires `kubectl` v1.32+):
--&gt;
&lt;p&gt;你可以在 v1.33 的 Kubernetes 集群上使用 kubectl 编辑
Pod 来尝试（需要 v1.32+ 的 kubectl）：&lt;/p&gt;
&lt;!--
```shell
kubectl edit pod &lt;pod-name&gt; --subresource resize
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl edit pod &amp;lt;Pod 名称&amp;gt; --subresource resize
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
For detailed usage instructions and examples, please refer to the official Kubernetes documentation:
[Resize CPU and Memory Resources assigned to Containers](/docs/tasks/configure-pod-container/resize-container-resources/).
--&gt;
&lt;p&gt;有关详细使用说明和示例，请参阅官方 Kubernetes 文档：
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/resize-container-resources/&#34;&gt;调整分配给容器的 CPU 和内存资源&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Why does in-place Pod resize matter?

Kubernetes still excels at scaling workloads horizontally (adding or removing replicas), but in-place Pod resizing unlocks several key benefits for vertical scaling:
--&gt;
&lt;h2 id=&#34;why-does-in-place-pod-resize-matter&#34;&gt;为什么原地 Pod 调整大小很重要？  &lt;/h2&gt;
&lt;p&gt;Kubernetes 在水平扩缩工作负载（添加或移除副本）方面仍然表现出色，但原地
Pod 调整大小为垂直扩缩解锁了几个关键优势：&lt;/p&gt;
&lt;!--
* **Reduced Disruption:** Stateful applications, long-running batch jobs, and sensitive workloads can have their resources adjusted without suffering the downtime or state loss associated with a Pod restart.
* **Improved Resource Utilization:** Scale down over-provisioned Pods without disruption, freeing up resources in the cluster. Conversely, provide more resources to Pods under heavy load without needing a restart.
* **Faster Scaling:** Address transient resource needs more quickly. For example Java applications often need more CPU during startup than during steady-state operation. Start with higher CPU and resize down later.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;减少干扰：&lt;/strong&gt; 有状态应用、长时间运行的批处理作业和敏感工作负载可以在不经历
Pod 重启相关的停机或状态丢失的情况下调整资源。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;改进资源利用率：&lt;/strong&gt; 无需中断即可缩小过度配置的 Pod，从而释放集群中的资源。
相反，在重负载下的 Pod 可以在不重启的情况下获得更多的资源。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;更快的扩缩：&lt;/strong&gt; 更快速地解决瞬时资源需求。例如，Java
应用在启动期间通常比在稳定状态下需要更多的 CPU。
可以开始时使用更高的 CPU 配置，然后在之后调整减小。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## What&#39;s changed between Alpha and Beta?

Since the alpha release in v1.27, significant work has gone into maturing the feature, improving its stability, and refining the user experience based on feedback and further development. Here are the key changes:
--&gt;
&lt;h2 id=&#34;whats-changed-between-alpha-and-beta&#34;&gt;从 Alpha 到 Beta 有哪些变化？  &lt;/h2&gt;
&lt;p&gt;自从 v1.27 的 Alpha 版本发布以来，为了完善此特性、
提高其稳定性并根据反馈和进一步开发优化用户体验，已经进行了大量工作。
以下是关键变化：&lt;/p&gt;
&lt;!--
### Notable user-facing changes

* **`resize` Subresource:** Modifying Pod resources must now be done via the Pod&#39;s `resize` subresource (`kubectl patch pod &lt;name&gt; --subresource resize ...`). `kubectl` versions v1.32+ support this argument.
* **Resize Status via Conditions:** The old `status.resize` field is deprecated. The status of a resize operation is now exposed via two Pod conditions:
    * `PodResizePending`: Indicates the Kubelet cannot grant the resize immediately (e.g., `reason: Deferred` if temporarily unable, `reason: Infeasible` if impossible on the node).
    * `PodResizeInProgress`: Indicates the resize is accepted and being applied. Errors encountered during this phase are now reported in this condition&#39;s message with `reason: Error`.
* **Sidecar Support:** Resizing &lt;a class=&#39;glossary-tooltip&#39; title=&#39;在 Pod 的整个生命期内保持运行的辅助容器。&#39; data-toggle=&#39;tooltip&#39; data-placement=&#39;top&#39; href=&#39;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/sidecar-containers/&#39; target=&#39;_blank&#39; aria-label=&#39;sidecar containers&#39;&gt;sidecar containers&lt;/a&gt; in-place is now supported.
--&gt;
&lt;h3 id=&#34;显著的用户可感知的变化&#34;&gt;显著的用户可感知的变化&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;resize&lt;/code&gt; 子资源：&lt;/strong&gt; 修改 Pod 资源现在必须通过 Pod 的 &lt;code&gt;resize&lt;/code&gt;
子资源进行（&lt;code&gt;kubectl patch pod &amp;lt;name&amp;gt; --subresource resize ...&lt;/code&gt;）。
kubectl 版本 v1.32+ 支持此参数。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;通过状况显示调整大小状态：&lt;/strong&gt; 旧的 &lt;code&gt;status.resize&lt;/code&gt; 字段已被弃用。
调整大小操作的状态现在通过两个 Pod 状况暴露：
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PodResizePending&lt;/code&gt;：表示 kubelet 无法立即批准调整大小
（例如，如果暂时不能，则 &lt;code&gt;reason: Deferred&lt;/code&gt;；如果在节点上不可能，则 &lt;code&gt;reason: Infeasible&lt;/code&gt;）。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PodResizeInProgress&lt;/code&gt;：表示调整大小已被接受并正在应用。
在此阶段遇到的错误现在会在此状况的消息中报告为 &lt;code&gt;reason: Error&lt;/code&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;支持边车容器：&lt;/strong&gt; 现在支持对&lt;a class=&#39;glossary-tooltip&#39; title=&#39;在 Pod 的整个生命期内保持运行的辅助容器。&#39; data-toggle=&#39;tooltip&#39; data-placement=&#39;top&#39; href=&#39;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/sidecar-containers/&#39; target=&#39;_blank&#39; aria-label=&#39;边车容器&#39;&gt;边车容器&lt;/a&gt;进行原地调整大小。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### Stability and reliability enhancements

* **Refined Allocated Resources Management:** The allocation management logic with the Kubelet was significantly reworked, making it more consistent and robust. The changes eliminated whole classes of bugs, and greatly improved the reliability of in-place Pod resize.
--&gt;
&lt;h3 id=&#34;稳定性和可靠性增强&#34;&gt;稳定性和可靠性增强&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;改进的已分配资源管理：&lt;/strong&gt; 对 Kubelet 的分配管理逻辑进行了重大重新设计，
使其更加一致和稳健。这些更改消除了很多种错误，并大大提高了原地 Pod 调整大小的可靠性。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* **Improved Checkpointing &amp; State Tracking:** A more robust system for tracking &#34;allocated&#34; and &#34;actuated&#34; resources was implemented, using new checkpoint files (`allocated_pods_state`, `actuated_pods_state`) to reliably manage resize state across Kubelet restarts and handle edge cases where runtime-reported resources differ from requested ones. Several bugs related to checkpointing and state restoration were fixed. Checkpointing efficiency was also improved.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;改进的检查点操作和状态跟踪操作：&lt;/strong&gt; 实现了更健壮的系统来跟踪“已分配”和“已执行”的资源，
使用新的检查点文件（&lt;code&gt;allocated_pods_state&lt;/code&gt;，&lt;code&gt;actuated_pods_state&lt;/code&gt;）以可靠地管理
kubelet 重启时的调整大小状态，并处理运行时报告的资源与请求的资源不同的边缘情况。
修复了几个与检查点和状态恢复相关的错误。还提高了检查点的效率。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* **Faster Resize Detection:** Enhancements to the Kubelet&#39;s Pod Lifecycle Event Generator (PLEG) allow the Kubelet to respond to and complete resizes much more quickly.
* **Enhanced CRI Integration:** A new `UpdatePodSandboxResources` CRI call was added to better inform runtimes and plugins (like NRI) about Pod-level resource changes.
* **Numerous Bug Fixes:** Addressed issues related to systemd cgroup drivers, handling of containers without limits, CPU minimum share calculations, container restart backoffs, error propagation, test stability, and more.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;更快的调整大小检测：&lt;/strong&gt; 对 kubelet 的 Pod 生命周期事件生成器（PLEG）进行了增强，
使 kubelet 能够更快地响应并完成大小调整。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;增强的 CRI 集成：&lt;/strong&gt; 添加了新的 &lt;code&gt;UpdatePodSandboxResources&lt;/code&gt; CRI 调用，
以更好地通知运行时和插件（如 NRI）有关 Pod 级别的资源变化。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;众多 Bug 修复：&lt;/strong&gt; 解决了与 systemd CGroup 驱动程序、未设资源限制的容器的处理、CPU
最小份额计算、容器重启退避、错误传播、测试稳定性等相关的问题。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## What&#39;s next?

Graduating to Beta means the feature is ready for broader adoption, but development doesn&#39;t stop here! Here&#39;s what the community is focusing on next:
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;接下来是什么？  &lt;/h2&gt;
&lt;p&gt;晋升为 Beta 意味着该特性已经准备好被更广泛地采用，但开发工作并不会止步于此！
以下是社区接下来的关注重点：&lt;/p&gt;
&lt;!--
* **Stability and Productionization:** Continued focus on hardening the feature, improving performance, and ensuring it is robust for production environments.
* **Addressing Limitations:** Working towards relaxing some of the current limitations noted in the documentation, such as allowing memory limit decreases.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;稳定性和产品化：&lt;/strong&gt; 持续关注增强特性，提升性能，并确保它在生产环境中足够稳健。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;解决限制：&lt;/strong&gt; 致力于解除文档中提到的一些当前限制，例如允许降低内存限制值。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* **[VerticalPodAutoscaler](/docs/concepts/workloads/autoscaling/#scaling-workloads-vertically) (VPA) Integration:** Work to enable VPA to leverage in-place Pod resize is already underway. A new `InPlaceOrRecreate` update mode will allow it to attempt non-disruptive resizes first, or fall back to recreation if needed. This will allow users to benefit from VPA&#39;s recommendations with significantly less disruption.
* **User Feedback:** Gathering feedback from users adopting the beta feature is crucial for prioritizing further enhancements and addressing any uncovered issues or bugs.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/autoscaling/#scaling-workloads-vertically&#34;&gt;垂直 Pod 自动扩缩&lt;/a&gt;（VPA）集成：&lt;/strong&gt;
此任务正在进行，为的是使 VPA 能够利用原地 Pod 重新调整大小。一个新的 &lt;strong&gt;InPlaceOrRecreate&lt;/strong&gt;
更新模式将允许它首先尝试非干扰性的重新调整大小，或者在需要时回退到重建。
这将使用户能够受益于 VPA 的建议，并显著减少干扰。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;用户反馈：&lt;/strong&gt; 收集采用 Beta 版特性的用户反馈，对于优先处理后续的增强特性以及解决发现的任何问题或错误至关重要。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Getting started and providing feedback

With the `InPlacePodVerticalScaling` feature gate enabled by default in v1.33, you can start experimenting with in-place Pod resizing right away!

Refer to the [documentation](/docs/tasks/configure-pod-container/resize-container-resources/) for detailed guides and examples.
--&gt;
&lt;h2 id=&#34;getting-started-and-providing-feedback&#34;&gt;开始使用并提供反馈  &lt;/h2&gt;
&lt;p&gt;随着 &lt;strong&gt;InPlacePodVerticalScaling&lt;/strong&gt; 特性门控在 v1.33 中默认启用，
你可以立即开始尝试原地 Pod 资源调整大小！&lt;/p&gt;
&lt;p&gt;参考&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/resize-container-resources/&#34;&gt;文档&lt;/a&gt;获取详细的指南和示例。&lt;/p&gt;
&lt;!--
As this feature moves through Beta, your feedback is invaluable. Please report any issues or share your experiences via the standard Kubernetes communication channels (GitHub issues, mailing lists, Slack). You can also review the [KEP-1287: In-place Update of Pod Resources](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources) for the full in-depth design details.

We look forward to seeing how the community leverages in-place Pod resize to build more efficient and resilient applications on Kubernetes!
--&gt;
&lt;p&gt;随着此特性从 Beta 阶段逐步推进，你的反馈是无价的。请通过 Kubernetes
标准沟通渠道（GitHub Issues、邮件列表、Slack）报告任何问题或分享你的经验。
你也可以查看
&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources&#34;&gt;KEP-1287: In-place Update of Pod Resources&lt;/a&gt;
以获取完整的深入设计细节。&lt;/p&gt;
&lt;p&gt;我们期待看到社区如何利用原地 Pod 调整大小来构建更高效、弹性更好的 Kubernetes 应用！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.33：Job 的 SuccessPolicy 进阶至 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/15/kubernetes-1-33-jobs-success-policy-goes-ga/</link>
      <pubDate>Thu, 15 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/15/kubernetes-1-33-jobs-success-policy-goes-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.33: Job&#39;s SuccessPolicy Goes GA&#34;
date: 2025-05-15T10:30:00-08:00
slug: kubernetes-1-33-jobs-success-policy-goes-ga
authors: &gt;
  [Yuki Iwai](https://github.com/tenzen-y) (CyberAgent, Inc)
--&gt;
&lt;!--
On behalf of the Kubernetes project, I&#39;m pleased to announce that Job _success policy_ has graduated to General Availability (GA) as part of the v1.33 release.
--&gt;
&lt;p&gt;我代表 Kubernetes 项目组，很高兴地宣布在 v1.33 版本中，Job 的&lt;strong&gt;成功策略&lt;/strong&gt;已进阶至 GA（正式发布）。&lt;/p&gt;
&lt;!--
## About Job&#39;s Success Policy

In batch workloads, you might want to use leader-follower patterns like [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface),
in which the leader controls the execution, including the followers&#39; lifecycle.
--&gt;
&lt;h2 id=&#34;about-jobs-success-policy&#34;&gt;关于 Job 的成功策略  &lt;/h2&gt;
&lt;p&gt;在批处理工作负载中，你可能希望使用类似
&lt;a href=&#34;https://zh.wikipedia.org/zh-cn/%E8%A8%8A%E6%81%AF%E5%82%B3%E9%81%9E%E4%BB%8B%E9%9D%A2&#34;&gt;MPI（消息传递接口）&lt;/a&gt;
的领导者跟随者（leader-follower）模式，其中领导者控制执行过程，包括跟随者的生命周期。&lt;/p&gt;
&lt;!--
In this case, you might want to mark it as succeeded
even if some of the indexes failed. Unfortunately, a leader-follower Kubernetes Job that didn&#39;t use a success policy, in most cases, would have to require **all** Pods to finish successfully
for that Job to reach an overall succeeded state.

For Kubernetes Jobs, the API allows you to specify the early exit criteria using the `.spec.successPolicy`
field (you can only use the `.spec.successPolicy` field for an [indexed Job](/docs/concept/workloads/controllers/job/#completion-mode)).
Which describes a set of rules either using a list of succeeded indexes for a job, or defining a minimal required size of succeeded indexes.
--&gt;
&lt;p&gt;在这种情况下，即使某些索引失败了，你也可能希望将 Job 标记为成功。
然而，在没有使用成功策略的情况下，Kubernetes 中的领导者跟随者
Job 通常必须要求&lt;strong&gt;所有&lt;/strong&gt; Pod 成功完成，整个 Job 才会被视为成功。&lt;/p&gt;
&lt;p&gt;对于 Kubernetes Job，API 允许你通过 &lt;code&gt;.spec.successPolicy&lt;/code&gt; 字段指定提前退出的条件
（你只能将此字段用于&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concept/workloads/controllers/job/#completion-mode&#34;&gt;带索引的 Job&lt;/a&gt;）。
此字段通过使用已成功的索引列表或定义成功索引的最小数量来描述一组规则。&lt;/p&gt;
&lt;!--
This newly stable field is especially valuable for scientific simulation, AI/ML and High-Performance Computing (HPC) batch workloads.
Users in these areas often run numerous experiments and may only need a specific number to complete successfully, rather than requiring all of them to succeed. 
In this case, the leader index failure is the only relevant Job exit criteria, and the outcomes for individual follower Pods are handled
only indirectly via the status of the leader index.
Moreover, followers do not know when they can terminate themselves.
--&gt;
&lt;p&gt;这个全新的稳定字段对科学仿真、AI/ML 和高性能计算（HPC）等批处理工作负载特别有价值。
这些领域的用户通常会运行大量实验，而他们可能只需要其中一部分成功完成，而不需要全部成功。
在这种情况下，领导者索引失败是对应 Job 的唯一重要退出条件，个别跟随者 Pod
的结果仅通过领导者索引的状态间接被处理。此外，跟随者自身并不知道何时可以终止。&lt;/p&gt;
&lt;!--
After Job meets any __Success Policy__, the Job is marked as succeeded, and all Pods are terminated including the running ones.

## How it works

The following excerpt from a Job manifest, using `.successPolicy.rules[0].succeededCount`, shows an example of
using a custom success policy:
--&gt;
&lt;p&gt;一旦 Job 满足任一&lt;strong&gt;成功策略&lt;/strong&gt;，此 Job 就会被标记为成功，并终止所有 Pod，包括正在运行的 Pod。&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;工作原理  &lt;/h2&gt;
&lt;p&gt;以下是使用 &lt;code&gt;.successPolicy.rules[0].succeededCount&lt;/code&gt; 的 Job 清单片段，
这是一个自定义成功策略的例子：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parallelism&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completionMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Indexed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;successPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;succeededCount&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Here, the Job is marked as succeeded when one index succeeded regardless of its number.
Additionally, you can constrain index numbers against `succeededCount` in `.successPolicy.rules[0].succeededCount`
as shown below:
--&gt;
&lt;p&gt;在这里，只要有任意一个索引成功，Job 就会被标记为成功，而不管具体是哪个索引。
此外，你还可以基于 &lt;code&gt;.successPolicy.rules[0].succeededCount&lt;/code&gt; 限制索引编号，如下所示：&lt;/p&gt;
&lt;!--
```yaml
parallelism: 10
completions: 10
completionMode: Indexed
successPolicy:
  rules:
  - succeededIndexes: 0 # index of the leader Pod
    succeededCount: 1
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parallelism&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completionMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Indexed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;successPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;succeededIndexes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 领导者 Pod 的索引&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;succeededCount&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
This example shows that the Job will be marked as succeeded once a Pod with a specific index (Pod index 0) has succeeded.

Once the Job either reaches one of the `successPolicy` rules, or achieves its `Complete` criteria based on `.spec.completions`,
the Job controller within kube-controller-manager adds the `SuccessCriteriaMet` condition to the Job status.
After that, the job-controller initiates cleanup and termination of Pods for Jobs with `SuccessCriteriaMet` condition.
Eventually, Jobs obtain `Complete` condition when the job-controller finished cleanup and termination.
--&gt;
&lt;p&gt;这个例子表示，只要具有特定索引（Pod 索引 0）的 Pod 成功，整个 Job 就会被标记为成功。&lt;/p&gt;
&lt;p&gt;一旦 Job 满足任一条 &lt;code&gt;successPolicy&lt;/code&gt; 规则，或根据 &lt;code&gt;.spec.completions&lt;/code&gt; 达到其 &lt;code&gt;Complete&lt;/code&gt; 条件，
kube-controller-manager 中的 Job 控制器就会向 Job 状态添加 &lt;code&gt;SuccessCriteriaMet&lt;/code&gt; 状况。
之后，job-controller 会为具有 &lt;code&gt;SuccessCriteriaMet&lt;/code&gt; 状况的 Job 发起 Pod 的清理和终止。
当 job-controller 完成清理和终止后，Job 会获得 &lt;code&gt;Complete&lt;/code&gt; 状况。&lt;/p&gt;
&lt;!--
## Learn more

- Read the documentation for
  [success policy](/docs/concepts/workloads/controllers/job/#success-policy).
- Read the KEP for the [Job success/completion policy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3998-job-success-completion-policy)
--&gt;
&lt;h2 id=&#34;learn-more&#34;&gt;了解更多   &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;阅读关于&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#success-policy&#34;&gt;成功策略的文档&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读关于 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3998-job-success-completion-policy&#34;&gt;Job 成功/完成策略的 KEP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved

This work was led by the Kubernetes
[batch working group](https://github.com/kubernetes/community/tree/master/wg-batch)
in close collaboration with the
[SIG Apps](https://github.com/kubernetes/community/tree/master/sig-apps) community.

If you are interested in working on new features in the space I recommend
subscribing to our [Slack](https://kubernetes.slack.com/messages/wg-batch)
channel and attending the regular community meetings.
--&gt;
&lt;h2 id=&#34;get-involved&#34;&gt;加入我们  &lt;/h2&gt;
&lt;p&gt;这项工作由 Kubernetes 的
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-batch&#34;&gt;Batch Working Group（批处理工作组）&lt;/a&gt;牵头，并与
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps&#34;&gt;SIG Apps&lt;/a&gt; 社区密切协作。&lt;/p&gt;
&lt;p&gt;如果你对此领域的新特性开发感兴趣，推荐你订阅我们的
&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-batch&#34;&gt;Slack 频道&lt;/a&gt;，并参加定期举行的社区会议。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：容器生命周期更新</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/14/kubernetes-v1-33-updates-to-container-lifecycle/</link>
      <pubDate>Wed, 14 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/14/kubernetes-v1-33-updates-to-container-lifecycle/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Updates to Container Lifecycle&#34;
date: 2025-05-14T10:30:00-08:00
slug: kubernetes-v1-33-updates-to-container-lifecycle
author: &gt;
  Sreeram Venkitesh (DigitalOcean)
--&gt;
&lt;!--
Kubernetes v1.33 introduces a few updates to the lifecycle of containers. The Sleep action for container lifecycle hooks now supports a zero sleep duration (feature enabled by default).
There is also alpha support for customizing the stop signal sent to containers when they are being terminated.
--&gt;
&lt;p&gt;Kubernetes v1.33 引入了对容器生命周期的一些更新。
容器生命周期回调的 Sleep 动作现在支持零睡眠时长（特性默认启用）。
同时还为定制发送给终止中的容器的停止信号提供了 Alpha 级别支持。&lt;/p&gt;
&lt;!--
This blog post goes into the details of these new aspects of the container lifecycle, and how you can use them.
--&gt;
&lt;p&gt;这篇博客文章深入介绍了容器生命周期的这些新内容，以及如何使用它们。&lt;/p&gt;
&lt;!--
## Zero value for Sleep action

Kubernetes v1.29 introduced the `Sleep` action for container PreStop and PostStart Lifecycle hooks. The Sleep action lets your containers pause for a specified duration after the container is started or before it is terminated. This was needed to provide a straightforward way to manage graceful shutdowns. Before the Sleep action, folks used to run the `sleep` command using the exec action in their container lifecycle hooks. If you wanted to do this you&#39;d need to have the binary for the `sleep` command in your container image. This is difficult if you&#39;re using third party images. 
--&gt;
&lt;h2 id=&#34;sleep-动作的零值&#34;&gt;Sleep 动作的零值&lt;/h2&gt;
&lt;p&gt;Kubernetes v1.29 引入了容器 PreStop 和 PostStart 生命周期回调的 &lt;code&gt;Sleep&lt;/code&gt; 动作。
Sleep 动作允许你的容器在启动后或终止前暂停指定的时长。这为管理优雅关闭提供了一种直接的方法。
在 Sleep 动作之前，人们常使用生命周期回调中的 exec 动作运行 &lt;code&gt;sleep&lt;/code&gt; 命令。
如果你想这样做，则需要在你的容器镜像中包含 &lt;code&gt;sleep&lt;/code&gt; 命令的二进制文件。
如果你使用第三方镜像，这可能会比较困难。&lt;/p&gt;
&lt;!--
The sleep action when it was added initially didn&#39;t have support for a sleep duration of zero seconds. The `time.Sleep` which the Sleep action uses under the hood supports a duration of zero seconds. Using a negative or a zero value for the sleep returns immediately, resulting in a no-op. We wanted the same behaviour with the sleep action. This support for the zero duration was later added in v1.32, with the `PodLifecycleSleepActionAllowZero` feature gate.
--&gt;
&lt;p&gt;最初添加 Sleep 动作时，并不支持零秒的睡眠时间。
然而，&lt;code&gt;time.Sleep&lt;/code&gt;（Sleep 动作底层使用的机制）是支持零秒的持续时间的。
使用负值或零值进行睡眠会立即返回，导致无操作。我们希望 Sleep 动作也有相同的行为。
后来在 v1.32 中通过&lt;strong&gt;特性门控&lt;/strong&gt; &lt;code&gt;PodLifecycleSleepActionAllowZero&lt;/code&gt; 添加了这种对零持续时间的支持。&lt;/p&gt;
&lt;!--
The `PodLifecycleSleepActionAllowZero` feature gate has graduated to beta in v1.33, and is now enabled by default.
The original Sleep action for `preStop` and `postStart` hooks is been enabled by default, starting from Kubernetes v1.30.
With a cluster running Kubernetes v1.33, you are able to set a
zero duration for sleep lifecycle hooks. For a cluster with default configuration, you don&#39;t need 
to enable any feature gate to make that possible.
--&gt;
&lt;p&gt;&lt;code&gt;PodLifecycleSleepActionAllowZero&lt;/code&gt; 特性门控在 v1.33 中已升级到 Beta 阶段，并且现在默认启用。
从 Kubernetes v1.30 开始，&lt;code&gt;preStop&lt;/code&gt; 和 &lt;code&gt;postStart&lt;/code&gt; 回调的原始 Sleep 动作默认情况下已启用。
使用运行 Kubernetes v1.33 的集群时，你可以为 Sleep 生命周期钩子设置零持续时间。
对于采用默认配置的集群，你无需启用任何特性门控即可实现这一点。&lt;/p&gt;
&lt;!--
## Container stop signals

Container runtimes such as containerd and CRI-O honor a `StopSignal` instruction in the container image definition. This can be used to specify a custom stop signal
that the runtime will used to terminate containers based on that image.
Stop signal configuration was not originally part of the Pod API in Kubernetes.
Until Kubernetes v1.33, the only way to override the stop signal for containers was by rebuilding your container image with the new custom stop signal
(for example, specifying `STOPSIGNAL` in a `Containerfile` or `Dockerfile`).
--&gt;
&lt;h2 id=&#34;容器停止信号&#34;&gt;容器停止信号&lt;/h2&gt;
&lt;p&gt;容器运行时如 containerd 和 CRI-O 支持容器镜像定义中的 &lt;code&gt;StopSignal&lt;/code&gt; 指令。
这可以用来指定一个自定义的停止信号，运行时将使用该信号来终止基于此镜像的容器。
停止信号配置最初并不是 Kubernetes Pod API 的一部分。
直到 Kubernetes v1.33，覆盖容器停止信号的唯一方法是通过使用新的自定义停止信号重建容器镜像
（例如，在 &lt;code&gt;Containerfile&lt;/code&gt; 或 &lt;code&gt;Dockerfile&lt;/code&gt; 中指定 &lt;code&gt;STOPSIGNAL&lt;/code&gt;）。&lt;/p&gt;
&lt;!--
The `ContainerStopSignals` feature gate which is newly added in Kubernetes v1.33 adds stop signals to the Kubernetes API. This allows users to specify a custom stop signal in the container spec. Stop signals are added to the API as a new lifecycle along with the existing PreStop and PostStart lifecycle handlers. In order to use this feature, we expect the Pod to have the operating system specified with `spec.os.name`. This is enforced so that we can cross-validate the stop signal against the operating system and make sure that the containers in the Pod are created with a valid stop signal for the operating system the Pod is being scheduled to. For Pods scheduled on Windows nodes, only `SIGTERM` and `SIGKILL` are allowed as valid stop signals. Find the full list of signals supported in Linux nodes [here](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L2985-L3053).
--&gt;
&lt;p&gt;&lt;code&gt;ContainerStopSignals&lt;/code&gt; 特性门控是 Kubernetes v1.33 新增的，
它将停止信号添加到了 Kubernetes API。这允许用户在容器规格中指定自定义的停止信号。
停止信号作为新生命周期加入 API，连同现有的 PreStop 和 PostStart 生命周期处理器一起使用。
要使用这个特性，Pod 需要用 &lt;code&gt;spec.os.name&lt;/code&gt; 指定操作系统。这是为了能对操作系统进行停止信号的交叉验证，
确保 Pod 中的容器是以适合其调度操作系统的有效停止信号创建的。对于调度到 Windows 节点上的 Pod，
仅允许 &lt;code&gt;SIGTERM&lt;/code&gt; 和 &lt;code&gt;SIGKILL&lt;/code&gt; 作为有效的停止信号。
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L2985-L3053&#34;&gt;这里&lt;/a&gt;可以找到
Linux 节点支持的完整信号列表。&lt;/p&gt;
&lt;!--
### Default behaviour

If a container has a custom stop signal defined in its lifecycle, the container runtime would use the signal defined in the lifecycle to kill the container, given that the container runtime also supports custom stop signals. If there is no custom stop signal defined in the container lifecycle, the runtime would fallback to the stop signal defined in the container image. If there is no stop signal defined in the container image, the default stop signal of the runtime would be used. The default signal is `SIGTERM` for both containerd and CRI-O.
--&gt;
&lt;h3 id=&#34;默认行为&#34;&gt;默认行为&lt;/h3&gt;
&lt;p&gt;如果容器在其生命周期中定义了自定义停止信号，那么只要容器运行时也支持自定义停止信号，
容器运行时就会使用生命周期中定义的信号来终止容器。如果容器生命周期中没有定义自定义停止信号，
运行时将回退到容器镜像中定义的停止信号。如果在容器镜像中也没有定义停止信号，
将会使用运行时的默认停止信号。对于 containerd 和 CRI-O，默认信号都是 &lt;code&gt;SIGTERM&lt;/code&gt;。&lt;/p&gt;
&lt;!--
### Version skew

For the feature to work as intended, both the versions of Kubernetes and the container runtime should support container stop signals. The changes to the Kuberentes API and kubelet are available in alpha stage from v1.33, which can be enabled with the `ContainerStopSignals` feature gate. The container runtime implementations for containerd and CRI-O are still a work in progress and will be rolled out soon.
--&gt;
&lt;h3 id=&#34;版本偏差&#34;&gt;版本偏差&lt;/h3&gt;
&lt;p&gt;为了使该特性按预期工作，Kubernetes 和容器运行时的版本都应支持容器停止信号。
对 Kubernetes API 和 kubelet 的更改从 v1.33 开始进入 Alpha 阶段，
可以通过启用 &lt;code&gt;ContainerStopSignals&lt;/code&gt; 特性门控来使用。
containerd 和 CRI-O 的容器运行时实现仍在进行中，不久将会发布。&lt;/p&gt;
&lt;!--
### Using container stop signals

To enable this feature, you need to turn on the `ContainerStopSignals` feature gate in both the kube-apiserver and the kubelet. Once you have nodes where the feature gate is turned on, you can create Pods with a StopSignal lifecycle and a valid OS name like so:
--&gt;
&lt;h3 id=&#34;使用容器停止信号&#34;&gt;使用容器停止信号&lt;/h3&gt;
&lt;p&gt;要启用此特性，你需要在 kube-apiserver 和 kubelet 中打开 &lt;code&gt;ContainerStopSignals&lt;/code&gt; 特性门控。
一旦你在节点上启用了特性门控，就可以创建带有 StopSignal 生命周期和有效操作系统名称的 Pod，如下所示：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;os&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;linux&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;nginx:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;lifecycle&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;stopSignal&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;SIGUSR1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Do note that the `SIGUSR1` signal in this example can only be used if the container&#39;s Pod is scheduled to a Linux node. Hence we need to specify `spec.os.name` as `linux` to be able to use the signal. You will only be able to configure `SIGTERM` and `SIGKILL` signals if the Pod is being scheduled to a Windows node. You cannot specify a `containers[*].lifecycle.stopSignal` if the `spec.os.name` field is nil or unset either.
--&gt;
&lt;p&gt;请注意，此示例中的 &lt;code&gt;SIGUSR1&lt;/code&gt; 信号仅在容器的 Pod 被调度到 Linux 节点时才能使用。
因此，我们需要指定 &lt;code&gt;spec.os.name&lt;/code&gt; 为 &lt;code&gt;linux&lt;/code&gt; 才能使用该信号。
如果 Pod 被调度到 Windows 节点，则你只能配置 &lt;code&gt;SIGTERM&lt;/code&gt; 和 &lt;code&gt;SIGKILL&lt;/code&gt; 信号。
此外，如果 &lt;code&gt;spec.os.name&lt;/code&gt; 字段为 nil 或未设置，你也不能指定 &lt;code&gt;containers[*].lifecycle.stopSignal&lt;/code&gt;。&lt;/p&gt;
&lt;!--
## How do I get involved?

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 reach out to us!
--&gt;
&lt;h2 id=&#34;我如何参与&#34;&gt;我如何参与？&lt;/h2&gt;
&lt;p&gt;此特性由 &lt;a href=&#34;https://github.com/Kubernetes/community/blob/master/sig-node/README.md&#34;&gt;SIG Node&lt;/a&gt;
推动。如果你有兴趣帮助开发此特性、分享反馈或参与任何其他正在进行的 SIG Node 项目，请联系我们！&lt;/p&gt;
&lt;!--
You can reach SIG Node by several means:
- Slack: [#sig-node](https://kubernetes.slack.com/messages/sig-node)
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-node)
- [Open Community Issues/PRs](https://github.com/kubernetes/community/labels/sig%2Fnode)

You can also contact me directly:
- GitHub: @sreeram-venkitesh
- Slack: @sreeram.venkitesh
--&gt;
&lt;p&gt;你可以通过几种方式联系 SIG Node：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Slack：&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-node&#34;&gt;#sig-node&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-node&#34;&gt;邮件列表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/labels/sig%2Fnode&#34;&gt;开放社区 Issues/PRs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;你也可以直接联系我：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub：@sreeram-venkitesh&lt;/li&gt;
&lt;li&gt;Slack：@sreeram.venkitesh&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：Job 逐索引的回退限制进阶至 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/13/kubernetes-v1-33-jobs-backoff-limit-per-index-goes-ga/</link>
      <pubDate>Tue, 13 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/13/kubernetes-v1-33-jobs-backoff-limit-per-index-goes-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Job&#39;s Backoff Limit Per Index Goes GA&#34;
date: 2025-05-13T10:30:00-08:00
slug: kubernetes-v1-33-jobs-backoff-limit-per-index-goes-ga
author: &gt;
  [Michał Woźniak](https://github.com/mimowo) (Google)
--&gt;
&lt;!--
In Kubernetes v1.33, the _Backoff Limit Per Index_ feature reaches general
availability (GA). This blog describes the Backoff Limit Per Index feature and
its benefits.
--&gt;
&lt;p&gt;在 Kubernetes v1.33 中，&lt;strong&gt;逐索引的回退限制&lt;/strong&gt;特性进阶至 GA（正式发布）。本文介绍此特性及其优势。&lt;/p&gt;
&lt;!--
## About backoff limit per index

When you run workloads on Kubernetes, you must consider scenarios where Pod
failures can affect the completion of your workloads. Ideally, your workload
should tolerate transient failures and continue running.

To achieve failure tolerance in a Kubernetes Job, you can set the
`spec.backoffLimit` field. This field specifies the total number of tolerated
failures.
--&gt;
&lt;h2 id=&#34;about-backoff-limit-per-index&#34;&gt;关于逐索引的回退限制  &lt;/h2&gt;
&lt;p&gt;当你在 Kubernetes 上运行工作负载时，必须考虑 Pod 失效可能影响工作负载完成的场景。
理想情况下，你的工作负载应该能够容忍短暂的失效并继续运行。&lt;/p&gt;
&lt;p&gt;为了在 Kubernetes Job 中容忍失效，你可以设置 &lt;code&gt;spec.backoffLimit&lt;/code&gt; 字段。
此字段指定容忍的失效总数。&lt;/p&gt;
&lt;!--
However, for workloads where every index is considered independent, like
[embarassingly parallel](https://en.wikipedia.org/wiki/Embarrassingly_parallel)
workloads - the `spec.backoffLimit` field is often not flexible enough.
For example, you may choose to run multiple suites of integration tests by
representing each suite as an index within an [Indexed Job](/docs/tasks/job/indexed-parallel-processing-static/).
In that setup, a fast-failing index  (test suite) is likely to consume your
entire budget for tolerating Pod failures, and you might not be able to run the
other indexes.
--&gt;
&lt;p&gt;但是，对于每个索引都被视为独立单元的工作负载，
比如&lt;a href=&#34;https://zh.wikipedia.org/zh-cn/%E8%BF%87%E6%98%93%E5%B9%B6%E8%A1%8C&#34;&gt;过易并行&lt;/a&gt;的工作负载，
&lt;code&gt;spec.backoffLimit&lt;/code&gt; 字段通常不够灵活。例如，你可以选择运行多个继承测试套件，
将每个套件作为&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/job/indexed-parallel-processing-static/&#34;&gt;带索引的 Job&lt;/a&gt;内的某个索引。
在这种情况下，快速失效的索引（测试套件）很可能消耗你全部的 Pod 失效容忍预算，你可能无法运行其他索引的 Pod。&lt;/p&gt;
&lt;!--
In order to address this limitation, Kubernetes introduced _backoff limit per index_,
which allows you to control the number of retries per index.

## How backoff limit per index works

To use Backoff Limit Per Index for Indexed Jobs, specify the number of tolerated
Pod failures per index with the `spec.backoffLimitPerIndex` field. When you set
this field, the Job executes all indexes by default.
--&gt;
&lt;p&gt;为了解决这一限制，Kubernetes 引入了&lt;strong&gt;逐索引的回退限制&lt;/strong&gt;，允许你控制逐索引的重试次数。&lt;/p&gt;
&lt;h2 id=&#34;how-backoff-limit-per-index-works&#34;&gt;逐索引回退限制的工作原理  &lt;/h2&gt;
&lt;p&gt;要在带索引的 Job 中使用逐索引的回退限制，可以通过 &lt;code&gt;spec.backoffLimitPerIndex&lt;/code&gt;
字段指定每个索引允许的 Pod 失效次数。当你设置此字段后，Job 默认将执行所有索引。&lt;/p&gt;
&lt;!--
Additionally, to fine-tune the error handling:
* Specify the cap on the total number of failed indexes by setting the
  `spec.maxFailedIndexes` field. When the limit is exceeded the entire Job is
  terminated.
* Define a short-circuit to detect a failed index by using the `FailIndex` action in the
  [Pod Failure Policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy)
  mechanism.
--&gt;
&lt;p&gt;另外，你可以通过以下方式微调错误处理：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;通过设置 &lt;code&gt;spec.maxFailedIndexes&lt;/code&gt; 字段，指定失效索引总数的上限。超过此限制时，整个 Job 会被终止。&lt;/li&gt;
&lt;li&gt;通过 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失效策略&lt;/a&gt;机制中的
&lt;code&gt;FailIndex&lt;/code&gt; 动作定义短路来检测失效的索引。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
When the number of tolerated failures is exceeded, the Job marks that index as
failed and lists it in the Job&#39;s `status.failedIndexes` field.

### Example

The following Job spec snippet is an example of how to combine backoff limit per
index with the _Pod Failure Policy_ feature:
--&gt;
&lt;p&gt;当超过容忍的失效次数时，Job 会将该索引标记为失效，并在 Job 的 &lt;code&gt;status.failedIndexes&lt;/code&gt; 字段中列出该索引。&lt;/p&gt;
&lt;h3 id=&#34;示例&#34;&gt;示例&lt;/h3&gt;
&lt;p&gt;下面的 Job 规约片段展示了如何将逐索引的回退限制与 &lt;strong&gt;Pod 失效策略&lt;/strong&gt;特性结合使用：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parallelism&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completionMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Indexed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backoffLimitPerIndex&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;maxFailedIndexes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podFailurePolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;action&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Ignore&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;onPodConditions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;DisruptionTarget&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;action&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;FailIndex&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;onExitCodes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;42&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
In this example, the Job handles Pod failures as follows:

- Ignores any failed Pods that have the built-in
  [disruption condition](/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions),
  called `DisruptionTarget`. These Pods don&#39;t count towards Job backoff limits.
- Fails the index corresponding to the failed Pod if any of the failed Pod&#39;s
  containers finished with the exit code 42 - based on the matching &#34;FailIndex&#34;
  rule.
--&gt;
&lt;p&gt;在此例中，Job 对 Pod 失效的处理逻辑如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;忽略具有内置&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions&#34;&gt;干扰状况&lt;/a&gt;
（称为 &lt;code&gt;DisruptionTarget&lt;/code&gt;）的失效 Pod。这些 Pod 不计入 Job 的回退限制。&lt;/li&gt;
&lt;li&gt;如果失效的 Pod 中任何容器的退出码是 42，则基于匹配的 &lt;code&gt;FailIndex&lt;/code&gt; 规则，将对应的索引标记为失效。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Retries the first failure of any index, unless the index failed due to the
  matching `FailIndex` rule.
- Fails the entire Job if the number of failed indexes exceeded 5 (set by the
  `spec.maxFailedIndexes` field).
--&gt;
&lt;ul&gt;
&lt;li&gt;除非索引因匹配的 &lt;code&gt;FailIndex&lt;/code&gt; 规则失效，否则会重试该索引的首次失效。&lt;/li&gt;
&lt;li&gt;如果失效索引数量超过 5 个（由 &lt;code&gt;spec.maxFailedIndexes&lt;/code&gt; 设置），则整个 Job 失效。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Learn more

- Read the blog post on the closely related feature of Pod Failure Policy [Kubernetes 1.31: Pod Failure Policy for Jobs Goes GA](/blog/2024/08/19/kubernetes-1-31-pod-failure-policy-for-jobs-goes-ga/)
- For a hands-on guide to using Pod failure policy, including the use of FailIndex, see
  [Handling retriable and non-retriable pod failures with Pod failure policy](/docs/tasks/job/pod-failure-policy/)
- Read the documentation for
  [Backoff limit per index](/docs/concepts/workloads/controllers/job/#backoff-limit-per-index) and
  [Pod failure policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy)
- Read the KEP for the [Backoff Limits Per Index For Indexed Jobs](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3850-backoff-limits-per-index-for-indexed-jobs)
--&gt;
&lt;h2 id=&#34;进一步了解&#34;&gt;进一步了解&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;阅读与 Pod 失效策略密切相关的博客文章：&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/19/kubernetes-1-31-pod-failure-policy-for-jobs-goes-ga/&#34;&gt;Kubernetes 1.31：Job 的 Pod 失效策略进阶至 GA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;查看包含 FailIndex 用法在内的 Pod 失效策略实操指南：
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/job/pod-failure-policy/&#34;&gt;使用 Pod 失效策略处理可重试和不可重试的 Pod 失效&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#backoff-limit-per-index&#34;&gt;逐索引的回退限制&lt;/a&gt;和
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失效策略&lt;/a&gt;等文档&lt;/li&gt;
&lt;li&gt;查阅 KEP：&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3850-backoff-limits-per-index-for-indexed-jobs&#34;&gt;带索引的 Job 的逐索引回退限制&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved

This work was sponsored by the Kubernetes
[batch working group](https://github.com/kubernetes/community/tree/master/wg-batch)
in close collaboration with the
[SIG Apps](https://github.com/kubernetes/community/tree/master/sig-apps) community.

If you are interested in working on new features in the space we recommend
subscribing to our [Slack](https://kubernetes.slack.com/messages/wg-batch)
channel and attending the regular community meetings.
--&gt;
&lt;h2 id=&#34;get-involved&#34;&gt;参与此工作  &lt;/h2&gt;
&lt;p&gt;这项工作由 Kubernetes &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-batch&#34;&gt;Batch Working Group（批处理工作组）&lt;/a&gt;负责，且与
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps&#34;&gt;SIG Apps&lt;/a&gt; 社区密切协作。&lt;/p&gt;
&lt;p&gt;如果你有兴趣参与此领域的新特性开发，建议订阅我们的
&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-batch&#34;&gt;Slack 频道&lt;/a&gt;，并参加定期社区会议。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：镜像拉取策略终于按你的预期工作了！</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/12/kubernetes-v1-33-ensure-secret-pulled-images-alpha/</link>
      <pubDate>Mon, 12 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/12/kubernetes-v1-33-ensure-secret-pulled-images-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Image Pull Policy the way you always thought it worked!&#34;
date:  2025-05-12T10:30:00-08:00
slug: kubernetes-v1-33-ensure-secret-pulled-images-alpha
author: &gt;
  [Ben Petersen](https://github.com/benjaminapetersen) (Microsoft),
  [Stanislav Láznička](https://github.com/stlaz) (Microsoft)
--&gt;
&lt;!--
## Image Pull Policy the way you always thought it worked!

Some things in Kubernetes are surprising, and the way `imagePullPolicy` behaves might
be one of them. Given Kubernetes is all about running pods, it may be peculiar
to learn that there has been a caveat to restricting pod access to authenticated images for
over 10 years in the form of [issue 18787](https://github.com/kubernetes/kubernetes/issues/18787)!
It is an exciting release when you can resolve a ten-year-old issue.
--&gt;
&lt;h2 id=&#34;镜像拉取策略终于按你的预期工作了&#34;&gt;镜像拉取策略终于按你的预期工作了！&lt;/h2&gt;
&lt;p&gt;Kubernetes 中有些东西让人感到奇怪，&lt;code&gt;imagePullPolicy&lt;/code&gt; 的行为就是其中之一。
Kubernetes 作为一个专注于运行 Pod 的平台，居然在限制 Pod 访问经认证的镜像方面，存在一个长达十余年的问题，
详见 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/18787&#34;&gt;Issue 18787&lt;/a&gt;！
v1.33 解决了这个十年前的老问题，这真是一个有纪念意义的版本。&lt;/p&gt;

&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&lt;h4 class=&#34;alert-heading&#34;&gt;说明：&lt;/h4&gt;&lt;!--
Throughout this blog post, the term &#34;pod credentials&#34; will be used often. In this context,
the term generally encapsulates the authentication material that is available to a pod
to authenticate a container image pull.
--&gt;
&lt;p&gt;在本博文中，“Pod 凭据”这个术语将被频繁使用。
在这篇博文的上下文中，这一术语通常指的是 Pod 拉取容器镜像时可用于身份认证的认证材料。&lt;/p&gt;&lt;/div&gt;

&lt;!--
## IfNotPresent, even if I&#39;m not supposed to have it

The gist of the problem is that the `imagePullPolicy: IfNotPresent` strategy has done
precisely what it says, and nothing more. Let&#39;s set up a scenario. To begin, *Pod A* in *Namespace X* is scheduled to *Node 1* and requires *image Foo* from a private repository.
For it&#39;s image pull authentication material, the pod references *Secret 1* in its `imagePullSecrets`. *Secret 1* contains the necessary credentials to pull from the private repository. The Kubelet will utilize the credentials from *Secret 1* as supplied by *Pod A*
and it will pull *container image Foo* from the registry.  This is the intended (and secure)
behavior.
--&gt;
&lt;h2 id=&#34;ifnotpresent-即使我本不该有这个镜像&#34;&gt;IfNotPresent：即使我本不该有这个镜像&lt;/h2&gt;
&lt;p&gt;问题的本质在于，&lt;code&gt;imagePullPolicy: IfNotPresent&lt;/code&gt; 策略正如其字面意义所示，仅此而已。
我们来设想一个场景：&lt;strong&gt;Pod A&lt;/strong&gt; 运行在 &lt;strong&gt;Namespace X&lt;/strong&gt; 中，被调度到 &lt;strong&gt;Node 1&lt;/strong&gt;，
此 Pod 需要从某个私有仓库拉取&lt;strong&gt;镜像 Foo&lt;/strong&gt;。此 Pod 在 &lt;code&gt;imagePullSecrets&lt;/code&gt; 中引用
&lt;strong&gt;Secret 1&lt;/strong&gt; 来作为镜像拉取认证材料。&lt;strong&gt;Secret 1&lt;/strong&gt; 包含从私有仓库拉取镜像所需的凭据。
kubelet 将使用 &lt;strong&gt;Pod A&lt;/strong&gt; 提供的 &lt;strong&gt;Secret 1&lt;/strong&gt; 来拉取 &lt;strong&gt;镜像 Foo&lt;/strong&gt;，这是预期的（也是安全的）行为。&lt;/p&gt;
&lt;!--
But now things get curious. If *Pod B* in *Namespace Y* happens to also be scheduled to *Node 1*, unexpected (and potentially insecure) things happen. *Pod B* may reference the same private image, specifying the `IfNotPresent` image pull policy. *Pod B* does not reference *Secret 1*
(or in our case, any secret) in its `imagePullSecrets`. When the Kubelet tries to run the pod, it honors the `IfNotPresent` policy. The Kubelet sees that the *image Foo* is already present locally, and will provide *image Foo* to *Pod B*. *Pod B* gets to run the image even though it did not provide credentials authorizing it to pull the image in the first place.
--&gt;
&lt;p&gt;但现在情况变得奇怪了。如果 &lt;strong&gt;Namespace Y&lt;/strong&gt; 中的 &lt;strong&gt;Pod B&lt;/strong&gt; 也被调度到 &lt;strong&gt;Node 1&lt;/strong&gt;，就会出现意外（甚至是不安全）的情况。
&lt;strong&gt;Pod B&lt;/strong&gt; 可以引用同一个私有镜像，指定 &lt;code&gt;IfNotPresent&lt;/code&gt; 镜像拉取策略。
&lt;strong&gt;Pod B&lt;/strong&gt; 未在其 &lt;code&gt;imagePullSecrets&lt;/code&gt; 中引用 &lt;strong&gt;Secret 1&lt;/strong&gt;（甚至未引用任何 Secret）。
当 kubelet 尝试运行此 Pod 时，它会采用 &lt;code&gt;IfNotPresent&lt;/code&gt; 策略。
kubelet 发现本地已存在&lt;strong&gt;镜像 Foo&lt;/strong&gt;，会将&lt;strong&gt;镜像 Foo&lt;/strong&gt; 提供给 &lt;strong&gt;Pod B&lt;/strong&gt;。
即便 &lt;strong&gt;Pod B&lt;/strong&gt; 一开始并未提供授权拉取镜像的凭据，却依然能够运行此镜像。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/12/kubernetes-v1-33-ensure-secret-pulled-images-alpha/ensure_secret_image_pulls.svg&#34;
         alt=&#34;Illustration of the process of two pods trying to access a private image, the first one with a pull secret, the second one without it&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Using a private image pulled by a different pod&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/12/kubernetes-v1-33-ensure-secret-pulled-images-alpha/ensure_secret_image_pulls.svg&#34;
         alt=&#34;两个 Pod 尝试访问某个私有镜像的过程示意图，第一个 Pod 有拉取 Secret，第二个没有&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;使用由另一个 Pod 拉取的私有镜像&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
While `IfNotPresent` should not pull *image Foo* if it is already present
on the node, it is an incorrect security posture to allow all pods scheduled
to a node to have access to previously pulled private image. These pods were never
authorized to pull the image in the first place.
--&gt;
&lt;p&gt;虽然 &lt;code&gt;IfNotPresent&lt;/code&gt; 不应在节点上已存在&lt;strong&gt;镜像 Foo&lt;/strong&gt; 的情况下再拉取此镜像，
但允许将所有 Pod 调度到有权限访问之前已拉取私有镜像的节点上，这从安全态势讲是不正确的做法。
因为这些 Pod 从开始就未被授权拉取此镜像。&lt;/p&gt;
&lt;!--
## IfNotPresent, but only if I am supposed to have it

In Kubernetes v1.33, we - SIG Auth and SIG Node - have finally started to address this (really old) problem and getting the verification right! The basic expected behavior is not changed. If
an image is not present, the Kubelet will attempt to pull the image. The credentials each pod supplies will be utilized for this task. This matches behavior prior to 1.33.
--&gt;
&lt;h2 id=&#34;ifnotpresent-但前提是我有权限&#34;&gt;IfNotPresent：但前提是我有权限&lt;/h2&gt;
&lt;p&gt;在 Kubernetes v1.33 中，SIG Auth 和 SIG Node 终于开始修复这个（非常古老的）难题，并经过验证可行！
基本的预期行为没有变。如果某镜像不存在，kubelet 会尝试拉取此镜像。
利用每个 Pod 提供的凭据来完成此拉取任务。这与 v1.33 之前的行为相匹配。&lt;/p&gt;
&lt;!--
If the image is present, then the behavior of the Kubelet changes. The Kubelet will now
verify the pod&#39;s credentials before allowing the pod to use the image.

Performance and service stability have been a consideration while revising the feature.
Pods utilizing the same credential will not be required to re-authenticate. This is
also true when pods source credentials from the same Kubernetes Secret object, even
when the credentials are rotated.
--&gt;
&lt;p&gt;但如果镜像存在，kubelet 的行为就变了。
kubelet 现在先要验证 Pod 的凭据，然后才会允许 Pod 使用镜像。&lt;/p&gt;
&lt;p&gt;在修缮此特性时，我们也考虑到了性能和服务稳定性。
如果多个 Pod 使用相同的凭据，则无需重复认证。
即使这些 Pod 使用的是相同的 Kubernetes Secret 对象（即便其凭据已轮换），也同样适用。&lt;/p&gt;
&lt;!--
## Never pull, but use if authorized

The `imagePullPolicy: Never` option does not fetch images. However, if the
container image is already present on the node, any pod attempting to use the private
image will be required to provide credentials, and those credentials require verification.

Pods utilizing the same credential will not be required to re-authenticate.
Pods that do not supply credentials previously used to successfully pull an
image will not be allowed to use the private image.
--&gt;
&lt;h2 id=&#34;never-永不拉取-但使用前仍需鉴权&#34;&gt;Never：永不拉取，但使用前仍需鉴权&lt;/h2&gt;
&lt;p&gt;采用 &lt;code&gt;imagePullPolicy: Never&lt;/code&gt; 选项时，不会获取镜像。
但如果节点上已存在此容器镜像，任何尝试使用此私有镜像的 Pod 都需要提供凭据，并且这些凭据需要经过验证。&lt;/p&gt;
&lt;p&gt;使用相同凭据的 Pod 无需重新认证。未提供之前已成功拉取镜像所用凭据的 Pod，将不允许使用此私有镜像。&lt;/p&gt;
&lt;!--
## Always pull, if authorized

The `imagePullPolicy: Always` has always worked as intended. Each time an image
is requested, the request goes to the registry and the registry will perform an authentication
check.

In the past, forcing the `Always` image pull policy via pod admission was the only way to ensure
that your private container images didn&#39;t get reused by other pods on nodes which already pulled the images.
--&gt;
&lt;h2 id=&#34;always-鉴权通过后始终拉取&#34;&gt;Always：鉴权通过后始终拉取&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;imagePullPolicy: Always&lt;/code&gt; 一直以来都能按预期工作。
每次某镜像被请求时，请求会流转到镜像仓库，镜像仓库将执行身份认证检查。&lt;/p&gt;
&lt;p&gt;过去，为了确保你的私有容器镜像不会被节点上已拉取过镜像的其他 Pod 重复使用，
通过 Pod 准入来强制执行 &lt;code&gt;Always&lt;/code&gt; 镜像拉取策略是唯一的方式。&lt;/p&gt;
&lt;!--
Fortunately, this was somewhat performant. Only the image manifest was pulled, not the image. However, there was still a cost and a risk. During a new rollout, scale up, or pod restart, the image registry that provided the image MUST be available for the auth check, putting the image registry in the critical path for stability of services running inside of the cluster.
--&gt;
&lt;p&gt;幸运的是，这个过程相对高效：仅拉取镜像清单，而不是镜像本体。
但这依然带来代价与风险。每当发布新版本、扩容或重启 Pod 时，
提供镜像的镜像仓库必须可以接受认证检查，从而将镜像仓库放到关键路径中确保集群中所运行的服务的稳定性。&lt;/p&gt;
&lt;!--
## How it all works

The feature is based on persistent, file-based caches that are present on each of
the nodes. The following is a simplified description of how the feature works.
For the complete version, please see [KEP-2535](https://kep.k8s.io/2535).
--&gt;
&lt;h2 id=&#34;工作原理&#34;&gt;工作原理&lt;/h2&gt;
&lt;p&gt;此特性基于每个节点上存在的持久化文件缓存。以下简要说明了此特性的工作原理。
完整细节请参见 &lt;a href=&#34;https://kep.k8s.io/2535&#34;&gt;KEP-2535&lt;/a&gt;。&lt;/p&gt;
&lt;!--
The process of requesting an image for the first time goes like this:
  1. A pod requesting an image from a private registry is scheduled to a node.
  2. The image is not present on the node.
  3. The Kubelet makes a record of the intention to pull the image.
  4. The Kubelet extracts credentials from the Kubernetes Secret referenced by the pod
     as an image pull secret, and uses them to pull the image from the private registry.
--&gt;
&lt;p&gt;首次请求某镜像的流程如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;请求私有仓库中某镜像的 Pod 被调度到某节点。&lt;/li&gt;
&lt;li&gt;此镜像在节点上不存在。&lt;/li&gt;
&lt;li&gt;kubelet 记录一次拉取镜像的意图。&lt;/li&gt;
&lt;li&gt;kubelet 从 Pod 引用的 Kubernetes Secret 中提取凭据作为镜像拉取 Secret，并使用这些凭据从私有仓库拉取镜像。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
  1. After the image has been successfully pulled, the Kubelet makes a record of
     the successful pull. This record includes details about credentials used
     (in the form of a hash) as well as the Secret from which they originated.
  2. The Kubelet removes the original record of intent.
  3. The Kubelet retains the record of successful pull for later use.
--&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;镜像已成功拉取后，kubelet 会记录这次成功的拉取。
记录包括所使用的凭据细节（哈希格式）以及构成这些凭据的原始 Secret。&lt;/li&gt;
&lt;li&gt;kubelet 移除原始意图记录。&lt;/li&gt;
&lt;li&gt;kubelet 保留成功拉取的记录供后续使用。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
When future pods scheduled to the same node request the previously pulled private image:
  1. The Kubelet checks the credentials that the new pod provides for the pull.
  2. If the hash of these credentials, or the source Secret of the credentials match
     the hash or source Secret which were recorded for a previous successful pull,
     the pod is allowed to use the previously pulled image.
  3. If the credentials or their source Secret are not found in the records of
     successful pulls for that image, the Kubelet will attempt to use
     these new credentials to request a pull from the remote registry, triggering
     the authorization flow.
--&gt;
&lt;p&gt;当以后调度到同一节点的 Pod 请求之前拉取过的私有镜像：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;kubelet 检查新 Pod 为拉取镜像所提供的凭据。&lt;/li&gt;
&lt;li&gt;如果这些凭据的哈希或其源 Secret 与之前成功拉取记录的哈希或源 Secret 相匹配，则允许此 Pod 使用之前拉取的镜像。&lt;/li&gt;
&lt;li&gt;如果在该镜像的成功拉取记录中找不到这些凭据或其源 Secret，则
kubelet 将尝试使用这些新的凭据从远程仓库进行拉取，同时触发认证流程。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Try it out

In Kubernetes v1.33 we shipped the alpha version of this feature. To give it a spin,
enable the `KubeletEnsureSecretPulledImages` feature gate for your 1.33 Kubelets.

You can learn more about the feature and additional optional configuration on the
[concept page for Images](/docs/concepts/containers/images/#ensureimagepullcredentialverification)
in the official Kubernetes documentation.
--&gt;
&lt;h2 id=&#34;试用&#34;&gt;试用&lt;/h2&gt;
&lt;p&gt;在 Kubernetes v1.33 中，我们发布了此特性的 Alpha 版本。
要想试用，在 kubelet v1.33 上启用 &lt;code&gt;KubeletEnsureSecretPulledImages&lt;/code&gt; 特性门控。&lt;/p&gt;
&lt;p&gt;你可以在 Kubernetes
官方文档中的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/containers/images/#ensureimagepullcredentialverification&#34;&gt;镜像概念页&lt;/a&gt;中了解此特性和更多可选配置的细节。&lt;/p&gt;
&lt;!--
## What&#39;s next?

In future releases we are going to:
1. Make this feature work together with [Projected service account tokens for Kubelet image credential providers](https://kep.k8s.io/4412) which adds a new, workload-specific source of image pull credentials.
1. Write a benchmarking suite to measure the performance of this feature and assess the impact of
   any future changes.
1. Implement an in-memory caching layer so that we don&#39;t need to read files for each image
   pull request.
1. Add support for credential expirations, thus forcing previously validated credentials to
   be re-authenticated.
--&gt;
&lt;h2 id=&#34;下一步工作&#34;&gt;下一步工作&lt;/h2&gt;
&lt;p&gt;在未来的版本中，我们将：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;使此特性与 &lt;a href=&#34;https://kep.k8s.io/4412&#34;&gt;kubelet 镜像凭据提供程序的投射服务账号令牌&lt;/a&gt;协同工作，
后者能够添加新的、特定于工作负载的镜像拉取凭据源。&lt;/li&gt;
&lt;li&gt;编写基准测试套件，以评估此特性的性能并衡量后续变更的影响。&lt;/li&gt;
&lt;li&gt;实现内存中的缓存层，因此我们不需要为每个镜像拉取请求都读取文件。&lt;/li&gt;
&lt;li&gt;添加对凭据过期的支持，从而强制重新认证之前已验证过的凭据。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## How to get involved

[Reading KEP-2535](https://kep.k8s.io/2535) is a great way to understand these changes in depth.

If you are interested in further involvement, reach out to us on the [#sig-auth-authenticators-dev](https://kubernetes.slack.com/archives/C04UMAUC4UA) channel
on Kubernetes Slack (for an invitation, visit [https://slack.k8s.io/](https://slack.k8s.io/)).
You are also welcome to join the bi-weekly [SIG Auth meetings](https://github.com/kubernetes/community/blob/master/sig-auth/README.md#meetings),
held every other Wednesday.
--&gt;
&lt;h2 id=&#34;如何参与&#34;&gt;如何参与&lt;/h2&gt;
&lt;p&gt;阅读 &lt;a href=&#34;https://kep.k8s.io/2535&#34;&gt;KEP-2535&lt;/a&gt; 是深入理解这些变更的绝佳方式。&lt;/p&gt;
&lt;p&gt;如果你想进一步参与，可以加入 Kubernetes Slack 频道
&lt;a href=&#34;https://kubernetes.slack.com/archives/C04UMAUC4UA&#34;&gt;#sig-auth-authenticators-dev&lt;/a&gt;
（如需邀请链接，请访问 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;https://slack.k8s.io/&lt;/a&gt;）。
欢迎你参加每隔一周在星期三举行的 &lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-auth/README.md#meetings&#34;&gt;SIG Auth 双周例会&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：流式 List 响应</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/09/kubernetes-v1-33-streaming-list-responses/</link>
      <pubDate>Fri, 09 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/09/kubernetes-v1-33-streaming-list-responses/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Streaming List responses&#34;
date: 2025-05-09T10:30:00-08:00
slug: kubernetes-v1-33-streaming-list-responses
author: &gt;
  Marek Siarkowicz (Google),
  Wei Fu (Microsoft)
--&gt;
&lt;!--
Managing Kubernetes cluster stability becomes increasingly critical as your infrastructure grows. One of the most challenging aspects of operating large-scale clusters has been handling List requests that fetch substantial datasets - a common operation that could unexpectedly impact your cluster&#39;s stability.

Today, the Kubernetes community is excited to announce a significant architectural improvement: streaming encoding for List responses.
--&gt;
&lt;p&gt;随着基础设施的增长，管理 Kubernetes 集群的稳定性变得愈发重要。
在大规模集群的运维中，最具挑战性的操作之一就是处理获取大量数据集的 List 请求。
List 请求是一种常见的操作，却可能意外影响集群的稳定性。&lt;/p&gt;
&lt;p&gt;今天，Kubernetes 社区非常高兴地宣布一项重大的架构改进：对 List 响应启用流式编码。&lt;/p&gt;
&lt;!--
## The problem: unnecessary memory consumption with large resources

Current API response encoders just serialize an entire response into a single contiguous memory and perform one [ResponseWriter.Write](https://pkg.go.dev/net/http#ResponseWriter.Write) call to transmit data to the client. Despite HTTP/2&#39;s capability to split responses into smaller frames for transmission, the underlying HTTP server continues to hold the complete response data as a single buffer. Even as individual frames are transmitted to the client, the memory associated with these frames cannot be freed incrementally.
--&gt;
&lt;h2 id=&#34;问题-大型资源导致的不必要内存消耗&#34;&gt;问题：大型资源导致的不必要内存消耗&lt;/h2&gt;
&lt;p&gt;当前的 API 响应编码器会将整个响应序列化为一个连续的内存块，并通过一次
&lt;a href=&#34;https://pkg.go.dev/net/http#ResponseWriter.Write&#34;&gt;ResponseWriter.Write&lt;/a&gt;
调用将数据发送给客户端。尽管 HTTP/2 能够将响应拆分为较小的帧进行传输，
但底层的 HTTP 服务器仍然会将完整的响应数据保存在一个单一缓冲区中。
即使这些帧被逐步传输到客户端，与这些帧关联的内存也无法被逐步释放。&lt;/p&gt;
&lt;!--
When cluster size grows, the single response body can be substantial - like hundreds of megabytes in size. At large scale, the current approach becomes particularly inefficient, as it prevents incremental memory release during transmission. Imagining that when network congestion occurs, that large response body’s memory block stays active for tens of seconds or even minutes. This limitation leads to unnecessarily high and prolonged memory consumption in the kube-apiserver process. If multiple large List requests occur simultaneously, the cumulative memory consumption can escalate rapidly, potentially leading to an Out-of-Memory (OOM) situation that compromises cluster stability.
--&gt;
&lt;p&gt;随着集群规模的扩大，单个响应体可能非常庞大，可能达到几百兆字节。
在大规模环境下，当前的方式显得特别低效，因为它使得系统无法在传输过程中逐步释放内存。
想象一下，如果网络发生拥堵，那么大型响应体的内存块会持续占用数十秒甚至几分钟。
这一局限性导致 kube-apiserver 进程出现不必要的高内存占用，持续时间也很长。
如果多个大型 List 请求同时发生，累计的内存消耗可能迅速飙升，最终可能触发
OOM（内存溢出）事件，从而危及集群稳定性。&lt;/p&gt;
&lt;!--
The encoding/json package uses sync.Pool to reuse memory buffers during serialization. While efficient for consistent workloads, this mechanism creates challenges with sporadic large List responses. When processing these large responses, memory pools expand significantly. But due to sync.Pool&#39;s design, these oversized buffers remain reserved after use. Subsequent small List requests continue utilizing these large memory allocations, preventing garbage collection and maintaining persistently high memory consumption in the kube-apiserver even after the initial large responses complete.
--&gt;
&lt;p&gt;&lt;code&gt;encoding/json&lt;/code&gt; 包在序列化时使用了 &lt;code&gt;sync.Pool&lt;/code&gt; 来复用内存缓冲区。
这对于一致的工作负载来说是高效的，但在处理偶发性的大型 List 响应时却带来了新的挑战。
在处理这些大型响应时，内存池会迅速膨胀。而由于 &lt;code&gt;sync.Pool&lt;/code&gt; 的设计特性，
这些膨胀后的缓冲区在使用后仍然会保留。后续的小型 List 请求继续使用这些大型内存分配，
导致垃圾回收无法生效，使得 kube-apiserver 在处理完大型响应后仍然保持较高的内存占用。&lt;/p&gt;
&lt;!--
Additionally, [Protocol Buffers](https://github.com/protocolbuffers/protocolbuffers.github.io/blob/c14731f55296f8c6367faa4f2e55a3d3594544c6/content/programming-guides/techniques.md?plain=1#L39) are not designed to handle large datasets. But it’s great for handling **individual** messages within a large data set. This highlights the need for streaming-based approaches that can process and transmit large collections incrementally rather than as monolithic blocks.
--&gt;
&lt;p&gt;此外，&lt;a href=&#34;https://github.com/protocolbuffers/protocolbuffers.github.io/blob/c14731f55296f8c6367faa4f2e55a3d3594544c6/content/programming-guides/techniques.md?plain=1#L39&#34;&gt;Protocol Buffers（协议缓冲）&lt;/a&gt;
并不适合处理大型数据集。但它非常适合处理大型数据集中的&lt;strong&gt;单个&lt;/strong&gt;消息。
这凸显出采用基于流式处理方式的必要性，这种方式可以逐步处理和传输大型集合，而不是一次性处理整个数据块。&lt;/p&gt;
&lt;!--
&gt; _As a general rule of thumb, if you are dealing in messages larger than a megabyte each, it may be time to consider an alternate strategy._
&gt;
&gt; _From https://protobuf.dev/programming-guides/techniques/_
--&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;一个通用的经验法则是：如果你处理的消息每个都大于一兆字节，那么可能需要考虑替代策略。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;引自：https://protobuf.dev/programming-guides/techniques/&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
## Streaming encoder for List responses

The streaming encoding mechanism is specifically designed for List responses, leveraging their common well-defined collection structures. The core idea focuses exclusively on the **Items** field within collection structures, which represents the bulk of memory consumption in large responses. Rather than encoding the entire **Items** array as one contiguous memory block, the new streaming encoder processes and transmits each item individually, allowing memory to be freed progressively as frame or chunk is transmitted. As a result, encoding items one by one significantly reduces the memory footprint required by the API server.
--&gt;
&lt;h2 id=&#34;list-响应的流式编码器&#34;&gt;List 响应的流式编码器&lt;/h2&gt;
&lt;p&gt;流式编码机制是专门为 List 响应设计的，它利用了这类响应通用且定义良好的集合结构。
核心思想是聚焦于集合结构中的 &lt;strong&gt;Items&lt;/strong&gt; 字段，此字段在大型响应中占用了大部分内存。
新的流式编码器不再将整个 &lt;strong&gt;Items&lt;/strong&gt; 数组编码为一个连续的内存块，而是逐个处理并传输每个 Item，
从而在传输每个帧或数据块后可以逐步释放内存。逐项编码显著减少了 API 服务器所需的内存占用。&lt;/p&gt;
&lt;!--
With Kubernetes objects typically limited to 1.5 MiB (from ETCD), streaming encoding keeps memory consumption predictable and manageable regardless of how many objects are in a List response. The result is significantly improved API server stability, reduced memory spikes, and better overall cluster performance - especially in environments where multiple large List operations might occur simultaneously.
--&gt;
&lt;p&gt;考虑到 Kubernetes 对象通常限制在 1.5 MiB（由 ETCD 限制），流式编码可使内存占用更加可预测和易于管理，
无论 List 响应中包含多少个对象。其结果是大幅提升了 API 服务器的稳定性，减少了内存峰值，
并改善了整体集群性能，尤其是在同时发生多个大型 List 操作的环境下更是如此。&lt;/p&gt;
&lt;!--
To ensure perfect backward compatibility, the streaming encoder validates Go struct tags rigorously before activation, guaranteeing byte-for-byte consistency with the original encoder. Standard encoding mechanisms process all fields except **Items**, maintaining identical output formatting throughout. This approach seamlessly supports all Kubernetes List types—from built-in **\*List** objects to Custom Resource **UnstructuredList** objects - requiring zero client-side modifications or awareness that the underlying encoding method has changed.
--&gt;
&lt;p&gt;为了确保完全向后兼容，流式编码器在启用前会严格验证 Go 结构体标签，确保与原始编码器在字节级别上保持一致。
标准编码机制仍然会处理除 &lt;strong&gt;Items&lt;/strong&gt; 外的所有字段，从而保持输出格式的一致性。
这种方法无缝支持所有 Kubernetes 的 List 类型（从内置的 &lt;strong&gt;*List&lt;/strong&gt; 对象到自定义资源的 &lt;strong&gt;UnstructuredList&lt;/strong&gt; 对象）
客户端无需任何修改，也无需感知底层的编码方式是否已发生变化。&lt;/p&gt;
&lt;!--
## Performance gains you&#39;ll notice

*   **Reduced Memory Consumption:** Significantly lowers the memory footprint of the API server when handling large **list** requests,
    especially when dealing with **large resources**.
*   **Improved Scalability:** Enables the API server to handle more concurrent requests and larger datasets without running out of memory.
*   **Increased Stability:** Reduces the risk of OOM kills and service disruptions.
*   **Efficient Resource Utilization:** Optimizes memory usage and improves overall resource efficiency.
--&gt;
&lt;h2 id=&#34;肉眼可见的性能提升&#34;&gt;肉眼可见的性能提升&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;内存消耗降低：&lt;/strong&gt; 当处理大型 &lt;strong&gt;list&lt;/strong&gt; 请求，尤其是涉及&lt;strong&gt;大型资源&lt;/strong&gt;时，API 服务器的内存占用大幅下降。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;可扩展性提升：&lt;/strong&gt; 允许 API 服务器处理更多并发请求和更大数据集，而不会耗尽内存。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;稳定性增强：&lt;/strong&gt; 降低 OOM 被杀和服务中断的风险。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;资源利用率提升：&lt;/strong&gt; 优化内存使用率，提高整体资源效率。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Benchmark results

To validate results Kubernetes has introduced a new **list** benchmark which executes concurrently 10 **list** requests each returning 1GB of data.

The benchmark has showed 20x improvement, reducing memory usage from 70-80GB to 3GB.
--&gt;
&lt;h2 id=&#34;基准测试结果&#34;&gt;基准测试结果&lt;/h2&gt;
&lt;p&gt;为了验证效果，Kubernetes 引入了一个新的 &lt;strong&gt;list&lt;/strong&gt; 基准测试，同时并发执行 10 个 &lt;strong&gt;list&lt;/strong&gt; 请求，每个请求返回 1GB 数据。&lt;/p&gt;
&lt;p&gt;此基准测试显示内存使用量下降了 &lt;strong&gt;20 倍&lt;/strong&gt;，从 70–80GB 降低到了 3GB。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/09/kubernetes-v1-33-streaming-list-responses/results.png&#34;
         alt=&#34;Screenshot of a K8s performance dashboard showing memory usage for benchmark list going down from 60GB to 3GB&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;List benchmark memory usage&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/09/kubernetes-v1-33-streaming-list-responses/results.png&#34;
         alt=&#34;K8s 性能面板截图，显示基准 list 内存使用量从 60GB 降低到 3GB&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;List 基准测试内存使用量&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.33：卷填充器进阶至 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/08/kubernetes-v1-33-volume-populators-ga/</link>
      <pubDate>Thu, 08 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/08/kubernetes-v1-33-volume-populators-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.33: Volume Populators Graduate to GA&#34;
date: 2025-05-08T10:30:00-08:00
slug: kubernetes-v1-33-volume-populators-ga
author: &gt;
  Danna Wang (Google)
  Sunny Song (Google)
--&gt;
&lt;!--
Kubernetes _volume populators_ are now  generally available (GA)! The `AnyVolumeDataSource` feature
gate is treated as always enabled for Kubernetes v1.33, which means that users can specify any appropriate
[custom resource](/docs/concepts/extend-kubernetes/api-extension/custom-resources/#custom-resources)
as the data source of a PersistentVolumeClaim (PVC).

An example of how to use dataSourceRef in PVC:
--&gt;
&lt;p&gt;Kubernetes 的&lt;strong&gt;卷填充器&lt;/strong&gt;现已进阶至 GA（正式发布）！
&lt;code&gt;AnyVolumeDataSource&lt;/code&gt; 特性门控在 Kubernetes v1.33 中设为始终启用，
这意味着用户可以将任何合适的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources/#custom-resources&#34;&gt;自定义资源&lt;/a&gt;作为
PersistentVolumeClaim（PVC）的数据源。&lt;/p&gt;
&lt;p&gt;以下是如何在 PVC 中使用 dataSourceRef 的示例：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolumeClaim&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pvc1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;dataSourceRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiGroup&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;provider.example.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Provider&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;provider1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## What is new

There are four major enhancements from beta.

### Populator Pod is optional

During the beta phase, contributors to Kubernetes identified potential resource leaks with PersistentVolumeClaim (PVC) deletion while volume population was in progress; these leaks happened due to limitations in finalizer handling.
Ahead of the graduation to general availability, the Kubernetes project added support to delete temporary resources (PVC prime, etc.) if the original PVC is deleted.
--&gt;
&lt;h2 id=&#34;what-is-new&#34;&gt;新变化  &lt;/h2&gt;
&lt;p&gt;从 Beta 进阶到 GA 后，主要有四个增强。&lt;/p&gt;
&lt;h3 id=&#34;populator-pod-is-optional&#34;&gt;填充器 Pod 成为可选  &lt;/h3&gt;
&lt;p&gt;在 Beta 阶段，Kubernetes 的贡献者们发现当正在进行卷填充时删除
PersistentVolumeClaim（PVC）可能导致资源泄露问题，这些泄漏是由于 Finalizer 处理机制的局限性所致。
在进阶至 GA 之前，Kubernetes 项目增加了在原始 PVC 被删除时对删除临时资源（PVC 派生体等）的支持。&lt;/p&gt;
&lt;!--
To accommodate this, we&#39;ve introduced three new plugin-based functions:
* `PopulateFn()`: Executes the provider-specific data population logic.
* `PopulateCompleteFn()`: Checks if the data population operation has finished successfully.
* `PopulateCleanupFn()`: Cleans up temporary resources created by the provider-specific functions after data population is completed

A provider example is added in [lib-volume-populator/example](https://github.com/kubernetes-csi/lib-volume-populator/tree/master/example).
--&gt;
&lt;p&gt;为支持此能力，我们引入了三个基于插件的新函数：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PopulateFn()&lt;/code&gt;：执行特定于提供程序的数据填充逻辑。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PopulateCompleteFn()&lt;/code&gt;：检查数据填充操作是否成功完成。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PopulateCleanupFn()&lt;/code&gt;：在数据填充完成后，清理由提供程序特定函数创建的临时资源。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有关提供程序的例子，参见
&lt;a href=&#34;https://github.com/kubernetes-csi/lib-volume-populator/tree/master/example&#34;&gt;lib-volume-populator/example&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Mutator functions to modify the Kubernetes resources

For GA, the CSI volume populator controller code gained a `MutatorConfig`, allowing the specification of mutator functions to modify Kubernetes resources.
For example, if the PVC prime is not an exact copy of the PVC and you need provider-specific information for the driver, you can include this information in the optional `MutatorConfig`. 
This allows you to customize the Kubernetes objects in the volume populator.
--&gt;
&lt;h3 id=&#34;支持修改-kubernetes-资源的-mutator-函数&#34;&gt;支持修改 Kubernetes 资源的 Mutator 函数&lt;/h3&gt;
&lt;p&gt;在 GA 版本中，CSI 卷填充器控制器代码新增了 &lt;code&gt;MutatorConfig&lt;/code&gt;，允许指定 Mutator 函数用于修改 Kubernetes 资源。
例如，如果 PVC 派生体不是 PVC 的完美副本，并且你需要为驱动提供一些特定于提供程序的信息，
你可以通过可选的 &lt;code&gt;MutatorConfig&lt;/code&gt; 将这些信息加入。这使你能够自定义卷填充器中的 Kubernetes 对象。&lt;/p&gt;
&lt;!--
### Flexible metric handling for providers

Our beta phase highlighted a new requirement: the need to aggregate metrics not just from lib-volume-populator, but also from other components within the provider&#39;s codebase.
--&gt;
&lt;h3 id=&#34;灵活处理提供程序的指标&#34;&gt;灵活处理提供程序的指标&lt;/h3&gt;
&lt;p&gt;在 Beta 阶段，我们发现一个新需求：不仅需要从 lib-volume-populator
聚合指标，还要能够从提供程序代码库中的其他组件聚合指标。&lt;/p&gt;
&lt;!--
To address this, SIG Storage introduced a [provider metric manager](https://github.com/kubernetes-csi/lib-volume-populator/blob/8a922a5302fdba13a6c27328ee50e5396940214b/populator-machinery/controller.go#L122).
This enhancement delegates the implementation of metrics logic to the provider itself, rather than relying solely on lib-volume-populator.
This shift provides greater flexibility and control over metrics collection and aggregation, enabling a more comprehensive view of provider performance.
--&gt;
&lt;p&gt;为此，SIG Storage 引入了一个&lt;a href=&#34;https://github.com/kubernetes-csi/lib-volume-populator/blob/8a922a5302fdba13a6c27328ee50e5396940214b/populator-machinery/controller.go#L122&#34;&gt;提供程序指标管理器&lt;/a&gt;。
此增强特性将指标逻辑的实现委托给提供程序自身，而不再仅仅依赖于 lib-volume-populator。
这种转变使指标收集与聚合更灵活、更好控制，有助于更好地观察提供程序的总体性能。&lt;/p&gt;
&lt;!--
### Clean up for temporary resources

During the beta phase, we identified potential resource leaks with PersistentVolumeClaim (PVC) deletion while volume population was in progress, due to limitations in finalizer handling. We have improved the populator to support the deletion of temporary resources (PVC prime, etc.) if the original PVC is deleted in this GA release.
--&gt;
&lt;h3 id=&#34;清理临时资源&#34;&gt;清理临时资源&lt;/h3&gt;
&lt;p&gt;在 Beta 阶段，我们发现当卷填充过程尚未完成时删除 PVC 会导致资源泄露问题，这是由于
Finalizer 的局限性引起的。在 GA 版本中，我们改善了填充器特性，在原始 PVC 被删除时支持删除临时资源（如 PVC 派生体等）。&lt;/p&gt;
&lt;!--
## How to use it

To try it out, please follow the [steps](/blog/2022/05/16/volume-populators-beta/#trying-it-out) in the previous beta blog.

## Future directions and potential feature requests

For next step, there are several potential feature requests for volume populator:
--&gt;
&lt;h2 id=&#34;how-to-use-it&#34;&gt;如何使用  &lt;/h2&gt;
&lt;p&gt;如需试用，请参考之前 Beta 版本博客中的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2022/05/16/volume-populators-beta/#trying-it-out&#34;&gt;操作步骤&lt;/a&gt;。&lt;/p&gt;
&lt;h2 id=&#34;future-directions-and-potential-feature-requests&#34;&gt;后续方向与潜在特性请求  &lt;/h2&gt;
&lt;p&gt;下一阶段，卷填充器可能会引入以下特性请求：&lt;/p&gt;
&lt;!--
* Multi sync: the current implementation is a one-time unidirectional sync from source to destination. This can be extended to support multiple syncs, enabling periodic syncs or allowing users to sync on demand
* Bidirectional sync: an extension of multi sync above, but making it bidirectional between source and destination
* Populate data with priorities: with a list of different dataSourceRef, populate based on priorities
* Populate data from multiple sources of the same provider: populate multiple different sources to one destination
* Populate data from multiple sources of the different providers: populate multiple different sources to one destination, pipelining different resources’ population
--&gt;
&lt;ul&gt;
&lt;li&gt;多次同步：当前实现是从源到目的地的一次性单向同步，可以扩展为支持周期性同步或允许用户按需同步。&lt;/li&gt;
&lt;li&gt;双向同步：多次同步的扩展版本，实现源与目的地之间的双向同步。&lt;/li&gt;
&lt;li&gt;基于优先级的数据填充：提供多个 dataSourceRef，并按优先级进行数据填充。&lt;/li&gt;
&lt;li&gt;从同一提供程序的多个源填充数据：将多个不同源填充到同一个目的地。&lt;/li&gt;
&lt;li&gt;从不同提供程序的多个源填充数据：将多个不同源填充到一个目的地，支持流水线式的不同资源的填充。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
To ensure we&#39;re building something truly valuable, Kubernetes SIG Storage would love to hear about any specific use cases you have in mind for this feature.
For any inquiries or specific questions related to volume populator, please reach out to the [SIG Storage community](https://github.com/kubernetes/community/tree/master/sig-storage).
--&gt;
&lt;p&gt;为了确保我们构建的特性真正有价值，Kubernetes SIG Storage 非常希望了解你所知道的与此特性有关的任何具体使用场景。
如有任何关于卷填充器的疑问或特定问题，请联系
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;SIG Storage 社区&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：防止无序删除时 PersistentVolume 泄漏特性进阶到 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/05/kubernetes-v1-33-prevent-persistentvolume-leaks-when-deleting-out-of-order-graduate-to-ga/</link>
      <pubDate>Mon, 05 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/05/kubernetes-v1-33-prevent-persistentvolume-leaks-when-deleting-out-of-order-graduate-to-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.33: Prevent PersistentVolume Leaks When Deleting out of Order graduates to GA&#39;
date: 2025-05-05T10:30:00-08:00
slug: kubernetes-v1-33-prevent-persistentvolume-leaks-when-deleting-out-of-order-graduate-to-ga
author: &gt;
  Deepak Kinni (Broadcom)
--&gt;
&lt;!--
I am thrilled to announce that the feature to prevent
[PersistentVolume](/docs/concepts/storage/persistent-volumes/) (or PVs for short)
leaks when deleting out of order has graduated to General Availability (GA) in
Kubernetes v1.33! This improvement, initially introduced as a beta
feature in Kubernetes v1.31, ensures that your storage resources are properly
reclaimed, preventing unwanted leaks.
--&gt;
&lt;p&gt;我很高兴地宣布，当无序删除时防止
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;PersistentVolume&lt;/a&gt;（简称 PV）
泄漏的特性已经在 Kubernetes v1.33 中进阶为正式版（GA）！这项改进最初在
Kubernetes v1.31 中作为 Beta 特性引入，
确保你的存储资源能够被正确回收，防止不必要的泄漏。&lt;/p&gt;
&lt;!--
## How did reclaim work in previous Kubernetes releases?

[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#Introduction) (or PVC for short) is
a user&#39;s request for storage. A PV and PVC are considered [Bound](/docs/concepts/storage/persistent-volumes/#Binding)
if a newly created PV or a matching PV is found. The PVs themselves are
backed by volumes allocated by the storage backend.
--&gt;
&lt;h2 id=&#34;以前的-kubernetes-版本中-reclaim-是如何工作的&#34;&gt;以前的 Kubernetes 版本中 reclaim 是如何工作的？&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#Introduction&#34;&gt;PersistentVolumeClaim&lt;/a&gt;（简称 PVC）
是用户对存储的请求。如果创建了新的 PV 或找到了匹配的 PV，则认为 PV 和 PVC
是&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#Binding&#34;&gt;绑定&lt;/a&gt;的。
PV 本身由存储后端分配的卷支持。&lt;/p&gt;
&lt;!--
Normally, if the volume is to be deleted, then the expectation is to delete the
PVC for a bound PV-PVC pair. However, there are no restrictions on deleting a PV
before deleting a PVC.
--&gt;
&lt;p&gt;通常，如果卷需要被删除，则预期是删除绑定的 PV-PVC 对的 PVC。但是，
删除 PVC 之前并没有限制不能删除 PV。&lt;/p&gt;
&lt;!--
For a `Bound` PV-PVC pair, the ordering of PV-PVC deletion determines whether
the PV reclaim policy is honored. The reclaim policy is honored if the PVC is
deleted first; however, if the PV is deleted prior to deleting the PVC, then the
reclaim policy is not exercised. As a result of this behavior, the associated
storage asset in the external infrastructure is not removed.
--&gt;
&lt;p&gt;对于一个“已绑定”的 PV-PVC 对，PV 和 PVC 的删除顺序决定了是否遵守 PV 回收策略。
如果先删除 PVC，则会遵守回收策略；然而，如果在删除 PVC 之前删除了 PV，
则不会执行回收策略。因此，外部基础设施中相关的存储资源不会被移除。&lt;/p&gt;
&lt;!--
## PV reclaim policy with Kubernetes v1.33

With the graduation to GA in Kubernetes v1.33, this issue is now resolved. Kubernetes
now reliably honors the configured `Delete` reclaim policy, even when PVs are deleted
before their bound PVCs. This is achieved through the use of finalizers,
ensuring that the storage backend releases the allocated storage resource as intended.
--&gt;
&lt;h2 id=&#34;在-kubernetes-v1-33-中的-pv-回收策略&#34;&gt;在 Kubernetes v1.33 中的 PV 回收策略&lt;/h2&gt;
&lt;p&gt;随着在 Kubernetes v1.33 中升级为 GA，这个问题现在得到了解决。
Kubernetes 现在可靠地遵循配置的 &lt;code&gt;Delete&lt;/code&gt; 回收策略（即使在删除 PV
时，其绑定的 PVC 尚未被删除）。这是通过使用 Finalizer 来实现的，
确保存储后端如预期释放分配的存储资源。&lt;/p&gt;
&lt;!--
### How does it work?

For CSI volumes, the new behavior is achieved by adding a [finalizer](/docs/concepts/overview/working-with-objects/finalizers/) `external-provisioner.volume.kubernetes.io/finalizer`
on new and existing PVs. The finalizer is only removed after the storage from the backend is deleted. Addition or removal of finalizer is handled by `external-provisioner`

An example of a PV with the finalizer, notice the new finalizer in the finalizers list
--&gt;
&lt;h3 id=&#34;它是如何工作的&#34;&gt;它是如何工作的？&lt;/h3&gt;
&lt;p&gt;对于 CSI 卷，新的行为是通过在新创建和现有的 PV 上添加
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/working-with-objects/finalizers/&#34;&gt;Finalizer&lt;/a&gt;
&lt;code&gt;external-provisioner.volume.kubernetes.io/finalizer&lt;/code&gt; 来实现的。
只有在后端存储被删除后，Finalizer 才会被移除。&lt;/p&gt;
&lt;p&gt;下面是一个带 Finalizer 的 PV 示例，请注意 Finalizer 列表中的新 Finalizer：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl get pv pvc-a7b7e3ba-f837-45ba-b243-dec7d8aaed53 -o yaml
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;annotations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pv.kubernetes.io/provisioned-by&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;csi.example.driver.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;creationTimestamp&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2021-11-17T19:28:56Z&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;finalizers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- kubernetes.io/pv-protection&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- external-provisioner.volume.kubernetes.io/finalizer&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pvc-a7b7e3ba-f837-45ba-b243-dec7d8aaed53&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;194711&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;087f14f2-4157-4e95-8a70-8294b039d30e&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;accessModes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- ReadWriteOnce&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;capacity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storage&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;1Gi&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claimRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolumeClaim&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-vanilla-block-pvc&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;default&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;194677&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;a7b7e3ba-f837-45ba-b243-dec7d8aaed53&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;csi&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;driver&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;csi.example.driver.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;fsType&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ext4&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeAttributes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storage.kubernetes.io/csiProvisionerIdentity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1637110610497-8081&lt;/span&gt;-csi.example.driver.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;CNS Block Volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeHandle&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;2dacf297-803f-4ccc-afc7-3d3c3f02051e&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;persistentVolumeReclaimPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Delete&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storageClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-vanilla-block-sc&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Filesystem&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;phase&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Bound&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The [finalizer](/docs/concepts/overview/working-with-objects/finalizers/) prevents this
PersistentVolume from being removed from the
cluster. As stated previously, the finalizer is only removed from the PV object
after it is successfully deleted from the storage backend. To learn more about
finalizers, please refer to [Using Finalizers to Control Deletion](/blog/2021/05/14/using-finalizers-to-control-deletion/).

Similarly, the finalizer `kubernetes.io/pv-controller` is added to dynamically provisioned in-tree plugin volumes.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/working-with-objects/finalizers/&#34;&gt;Finalizer&lt;/a&gt;
防止此 PersistentVolume 从集群中被移除。如前文所述，Finalizer 仅在从存储后端被成功删除后才会从
PV 对象中被移除。进一步了解 Finalizer，
请参阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2021/05/14/using-finalizers-to-control-deletion/&#34;&gt;使用 Finalizer 控制删除&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;同样，Finalizer &lt;code&gt;kubernetes.io/pv-controller&lt;/code&gt; 也被添加到动态制备的树内插件卷中。&lt;/p&gt;
&lt;!--
### Important note

The fix does not apply to statically provisioned in-tree plugin volumes.
--&gt;
&lt;h3 id=&#34;重要提示&#34;&gt;重要提示&lt;/h3&gt;
&lt;p&gt;此修复不适用于静态制备的内置插件卷。&lt;/p&gt;
&lt;!--
## How to enable new behavior?

To take advantage of the new behavior, you must have upgraded your cluster to the v1.33 release of Kubernetes
and run the CSI [`external-provisioner`](https://github.com/kubernetes-csi/external-provisioner) version `5.0.1` or later.
The feature was released as beta in v1.31 release of Kubernetes, where it was enabled by default.
--&gt;
&lt;h2 id=&#34;如何启用新行为&#34;&gt;如何启用新行为？&lt;/h2&gt;
&lt;p&gt;要利用新行为，你必须将集群升级到 Kubernetes 的 v1.33 版本，
并运行 CSI &lt;a href=&#34;https://github.com/kubernetes-csi/external-provisioner&#34;&gt;&lt;code&gt;external-provisioner&lt;/code&gt;&lt;/a&gt;
5.0.1 或更新版本。
此特性在 Kubernetes 的 v1.31 版本中作为 Beta 版发布，并且默认启用。&lt;/p&gt;
&lt;!--
## References

* [KEP-2644](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2644-honor-pv-reclaim-policy)
* [Volume leak issue](https://github.com/kubernetes-csi/external-provisioner/issues/546)
* [Beta Release Blog](/blog/2024/08/16/kubernetes-1-31-prevent-persistentvolume-leaks-when-deleting-out-of-order/)
--&gt;
&lt;h2 id=&#34;参考&#34;&gt;参考&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2644-honor-pv-reclaim-policy&#34;&gt;KEP-2644&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-csi/external-provisioner/issues/546&#34;&gt;卷泄漏问题&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-prevent-persistentvolume-leaks-when-deleting-out-of-order/&#34;&gt;Beta 版发布博客&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How do I get involved?

The Kubernetes Slack channel [SIG Storage communication channels](https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact) are great mediums to reach out to the SIG Storage and migration working group teams.

Special thanks to the following people for the insightful reviews, thorough consideration and valuable contribution:
--&gt;
&lt;h2 id=&#34;如何参与&#34;&gt;如何参与？&lt;/h2&gt;
&lt;p&gt;Kubernetes Slack 频道
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact&#34;&gt;SIG Storage 交流渠道&lt;/a&gt;是接触
SIG Storage 和迁移工作组团队的绝佳方式。&lt;/p&gt;
&lt;p&gt;特别感谢以下人员的深入审查、细致考虑和宝贵贡献：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fan Baofa (carlory)&lt;/li&gt;
&lt;li&gt;Jan Šafránek (jsafrane)&lt;/li&gt;
&lt;li&gt;Xing Yang (xing-yang)&lt;/li&gt;
&lt;li&gt;Matthew Wong (wongma7)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Join the [Kubernetes Storage Special Interest Group (SIG)](https://github.com/kubernetes/community/tree/master/sig-storage) if you&#39;re interested in getting involved with the design and development of CSI or any part of the Kubernetes Storage system. We’re rapidly growing and always welcome new contributors.
--&gt;
&lt;p&gt;如果你对 CSI 或 Kubernetes 存储系统的任何部分的设计和开发感兴趣，
可以加入 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes 存储特别兴趣小组（SIG）&lt;/a&gt;。
我们正在迅速成长，并且总是欢迎新的贡献者。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：可变的 CSI 节点可分配数</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/02/kubernetes-1-33-mutable-csi-node-allocatable-count/</link>
      <pubDate>Fri, 02 May 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/05/02/kubernetes-1-33-mutable-csi-node-allocatable-count/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Mutable CSI Node Allocatable Count&#34;
date: 2025-05-02T10:30:00-08:00
slug: kubernetes-1-33-mutable-csi-node-allocatable-count
author: Eddie Torres (Amazon Web Services)
--&gt;
&lt;!--
Scheduling stateful applications reliably depends heavily on accurate information about resource availability on nodes.
Kubernetes v1.33 introduces an alpha feature called *mutable CSI node allocatable count*, allowing Container Storage Interface (CSI) drivers to dynamically update the reported maximum number of volumes that a node can handle.
This capability significantly enhances the accuracy of pod scheduling decisions and reduces scheduling failures caused by outdated volume capacity information.
--&gt;
&lt;p&gt;可靠调度有状态应用极度依赖于节点上资源可用性的准确信息。&lt;br&gt;
Kubernetes v1.33 引入一个名为&lt;strong&gt;可变的 CSI 节点可分配计数&lt;/strong&gt;的 Alpha 特性，允许
CSI（容器存储接口）驱动动态更新节点可以处理的最大卷数量。&lt;br&gt;
这一能力显著提升 Pod 调度决策的准确性，并减少因卷容量信息过时而导致的调度失败。&lt;/p&gt;
&lt;!--
## Background

Traditionally, Kubernetes CSI drivers report a static maximum volume attachment limit when initializing. However, actual attachment capacities can change during a node&#39;s lifecycle for various reasons, such as:

- Manual or external operations attaching/detaching volumes outside of Kubernetes control.
- Dynamically attached network interfaces or specialized hardware (GPUs, NICs, etc.) consuming available slots.
- Multi-driver scenarios, where one CSI driver’s operations affect available capacity reported by another.
--&gt;
&lt;h2 id=&#34;background&#34;&gt;背景  &lt;/h2&gt;
&lt;p&gt;传统上，Kubernetes 中的 CSI 驱动在初始化时会报告一个静态的最大卷挂接限制。
然而，在节点生命周期内，实际的挂接容量可能会由于多种原因发生变化，例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在 Kubernetes 控制之外的手动或外部操作挂接/解除挂接卷。&lt;/li&gt;
&lt;li&gt;动态挂接的网络接口或专用硬件（如 GPU、NIC 等）占用可用的插槽。&lt;/li&gt;
&lt;li&gt;在多驱动场景中，一个 CSI 驱动的操作会影响另一个驱动所报告的可用容量。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Static reporting can cause Kubernetes to schedule pods onto nodes that appear to have capacity but don&#39;t, leading to pods stuck in a `ContainerCreating` state.

## Dynamically adapting CSI volume limits

With the new feature gate `MutableCSINodeAllocatableCount`, Kubernetes enables CSI drivers to dynamically adjust and report node attachment capacities at runtime. This ensures that the scheduler has the most accurate, up-to-date view of node capacity.
--&gt;
&lt;p&gt;静态报告可能导致 Kubernetes 将 Pod 调度到看似有容量但实际没有的节点上，进而造成
Pod 长时间卡在 &lt;code&gt;ContainerCreating&lt;/code&gt; 状态。&lt;/p&gt;
&lt;h2 id=&#34;dynamically-adapting-csi-volume-limits&#34;&gt;动态适应 CSI 卷限制  &lt;/h2&gt;
&lt;p&gt;借助新的特性门控 &lt;code&gt;MutableCSINodeAllocatableCount&lt;/code&gt;，Kubernetes 允许 CSI
驱动在运行时动态调整并报告节点的挂接容量。如此确保调度器能获取到最准确、最新的节点容量信息。&lt;/p&gt;
&lt;!--
### How it works

When this feature is enabled, Kubernetes supports two mechanisms for updating the reported node volume limits:

- **Periodic Updates:** CSI drivers specify an interval to periodically refresh the node&#39;s allocatable capacity.
- **Reactive Updates:** An immediate update triggered when a volume attachment fails due to exhausted resources (`ResourceExhausted` error).
--&gt;
&lt;h3 id=&#34;how-it-works&#34;&gt;工作原理  &lt;/h3&gt;
&lt;p&gt;启用此特性后，Kubernetes 支持通过以下两种机制来更新节点卷限制的报告值：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;周期性更新：&lt;/strong&gt; CSI 驱动指定一个间隔时间，来定期刷新节点的可分配容量。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;响应式更新：&lt;/strong&gt; 当因资源耗尽（&lt;code&gt;ResourceExhausted&lt;/code&gt; 错误）导致卷挂接失败时，立即触发更新。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### Enabling the feature

To use this alpha feature, you must enable the `MutableCSINodeAllocatableCount` feature gate in these components:
--&gt;
&lt;h3 id=&#34;enabling-the-feature&#34;&gt;启用此特性  &lt;/h3&gt;
&lt;p&gt;要使用此 Alpha 特性，你必须在以下组件中启用 &lt;code&gt;MutableCSINodeAllocatableCount&lt;/code&gt; 特性门控：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kube-apiserver&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubelet&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### Example CSI driver configuration

Below is an example of configuring a CSI driver to enable periodic updates every 60 seconds:
--&gt;
&lt;h3 id=&#34;example-csi-driver-configuration&#34;&gt;CSI 驱动配置示例  &lt;/h3&gt;
&lt;p&gt;以下是配置 CSI 驱动以每 60 秒进行一次周期性更新的示例：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;storage.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;CSIDriver&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example.csi.k8s.io&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;nodeAllocatableUpdatePeriodSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;60&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
This configuration directs Kubelet to periodically call the CSI driver&#39;s `NodeGetInfo` method every 60 seconds, updating the node’s allocatable volume count. Kubernetes enforces a minimum update interval of 10 seconds to balance accuracy and resource usage.
--&gt;
&lt;p&gt;此配置会指示 Kubelet 每 60 秒调用一次 CSI 驱动的 &lt;code&gt;NodeGetInfo&lt;/code&gt; 方法，从而更新节点的可分配卷数量。&lt;br&gt;
Kubernetes 强制要求最小更新间隔时间为 10 秒，以平衡准确性和资源使用量。&lt;/p&gt;
&lt;!--
### Immediate updates on attachment failures

In addition to periodic updates, Kubernetes now reacts to attachment failures. Specifically, if a volume attachment fails with a `ResourceExhausted` error (gRPC code `8`), an immediate update is triggered to correct the allocatable count promptly.

This proactive correction prevents repeated scheduling errors and helps maintain cluster health.
--&gt;
&lt;h3 id=&#34;immediate-updates-on-attachment-failures&#34;&gt;挂接失败时的即时更新  &lt;/h3&gt;
&lt;p&gt;除了周期性更新外，Kubernetes 现在也能对挂接失败做出响应。&lt;br&gt;
具体来说，如果卷挂接由于 &lt;code&gt;ResourceExhausted&lt;/code&gt; 错误（gRPC 错误码 &lt;code&gt;8&lt;/code&gt;）而失败，将立即触发更新，以快速纠正可分配数量。&lt;/p&gt;
&lt;p&gt;这种主动纠正可以防止重复的调度错误，有助于保持集群的健康状态。&lt;/p&gt;
&lt;!--
## Getting started

To experiment with mutable CSI node allocatable count in your Kubernetes v1.33 cluster:

1. Enable the feature gate `MutableCSINodeAllocatableCount` on the `kube-apiserver` and `kubelet` components.
2. Update your CSI driver configuration by setting `nodeAllocatableUpdatePeriodSeconds`.
3. Monitor and observe improvements in scheduling accuracy and pod placement reliability.
--&gt;
&lt;h2 id=&#34;getting-started&#34;&gt;快速开始   &lt;/h2&gt;
&lt;p&gt;要在 Kubernetes v1.33 集群中试用可变的 CSI 节点可分配数：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;在 &lt;code&gt;kube-apiserver&lt;/code&gt; 和 &lt;code&gt;kubelet&lt;/code&gt; 组件上启用特性门控 &lt;code&gt;MutableCSINodeAllocatableCount&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;在 CSI 驱动配置中设置 &lt;code&gt;nodeAllocatableUpdatePeriodSeconds&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;监控并观察调度准确性和 Pod 放置可靠性的提升程度。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Next steps

This feature is currently in alpha and the Kubernetes community welcomes your feedback. Test it, share your experiences, and help guide its evolution toward beta and GA stability.

Join discussions in the [Kubernetes Storage Special Interest Group (SIG-Storage)](https://github.com/kubernetes/community/tree/master/sig-storage) to shape the future of Kubernetes storage capabilities.
--&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;后续计划  &lt;/h2&gt;
&lt;p&gt;此特性目前处于 Alpha 阶段，Kubernetes 社区欢迎你的反馈。
无论是参与测试、分享你的经验，都有助于推动此特性向 Beta 和 GA（正式发布）稳定版迈进。&lt;/p&gt;
&lt;p&gt;欢迎加入 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes SIG-Storage&lt;/a&gt;
的讨论，共同塑造 Kubernetes 存储能力的未来。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：存储动态制备模式下的节点存储容量评分（Alpha 版）</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/30/kubernetes-v1-33-storage-capacity-scoring-feature/</link>
      <pubDate>Wed, 30 Apr 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/30/kubernetes-v1-33-storage-capacity-scoring-feature/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Storage Capacity Scoring of Nodes for Dynamic Provisioning (alpha)&#34;
date: 2025-04-30T10:30:00-08:00
slug: kubernetes-v1-33-storage-capacity-scoring-feature
author: &gt;
  Yuma Ogami (Cybozu)
--&gt;
&lt;!--
Kubernetes v1.33 introduces a new alpha feature called `StorageCapacityScoring`. This feature adds a scoring method for pod scheduling
with [the topology-aware volume provisioning](/blog/2018/10/11/topology-aware-volume-provisioning-in-kubernetes/).
This feature eases to schedule pods on nodes with either the most or least available storage capacity.
--&gt;
&lt;p&gt;Kubernetes v1.33 引入了一个名为 &lt;code&gt;StorageCapacityScoring&lt;/code&gt; 的新 Alpha 级别&lt;strong&gt;特性&lt;/strong&gt;。
此&lt;strong&gt;特性&lt;/strong&gt;添加了一种为 Pod 调度评分的方法，
并与&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2018/10/11/topology-aware-volume-provisioning-in-kubernetes/&#34;&gt;拓扑感知卷制备&lt;/a&gt;相关。
此&lt;strong&gt;特性&lt;/strong&gt;可以轻松地选择在具有最多或最少可用存储容量的节点上调度 Pod。&lt;/p&gt;
&lt;!--
## About this feature

This feature extends the kube-scheduler&#39;s VolumeBinding plugin to perform scoring using node storage capacity information
obtained from [Storage Capacity](/docs/concepts/storage/storage-capacity/). Currently, you can only filter out nodes with insufficient storage capacity.
So, you have to use a scheduler extender to achieve storage-capacity-based pod scheduling.
--&gt;
&lt;h2 id=&#34;about-this-feature&#34;&gt;关于此特性  &lt;/h2&gt;
&lt;p&gt;此特性扩展了 kube-scheduler 的 VolumeBinding 插件，
以使用从&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/storage-capacity/&#34;&gt;存储容量&lt;/a&gt;获得的节点存储容量信息进行评分。
目前，你只能过滤掉存储容量不足的节点。因此，你必须使用调度器扩展程序来实现基于存储容量的 Pod 调度。&lt;/p&gt;
&lt;!--
This feature is useful for provisioning node-local PVs, which have size limits based on the node&#39;s storage capacity. By using this feature,
you can assign the PVs to the nodes with the most available storage space so that you can expand the PVs later as much as possible.

In another use case, you might want to reduce the number of nodes as much as possible for low operation costs in cloud environments by choosing
the least storage capacity node. This feature helps maximize resource utilization by filling up nodes more sequentially, starting with the most
utilized nodes first that still have enough storage capacity for the requested volume size.
--&gt;
&lt;p&gt;此特性对于制备节点本地的 PV 非常有用，这些 PV 的大小限制取决于节点的存储容量。
通过使用此特性，你可以将 PV 指派给具有最多可用存储空间的节点，
以便以后尽可能多地扩展 PV。&lt;/p&gt;
&lt;p&gt;在另一个用例中，你可能希望通过选择存储容量最小的节点，
在云环境中尽可能减少节点数量以降低运维成本。
此特性通过从利用率最高的节点开始填充节点，从而帮助最大化资源利用率，
前提是这些节点仍有足够的存储容量来满足请求的卷大小。&lt;/p&gt;
&lt;!--
## How to use

### Enabling the feature

In the alpha phase, `StorageCapacityScoring` is disabled by default. To use this feature, add `StorageCapacityScoring=true`
to the kube-scheduler command line option `--feature-gates`.
--&gt;
&lt;h2 id=&#34;how-to-use&#34;&gt;如何使用  &lt;/h2&gt;
&lt;h3 id=&#34;enabling-the-feature&#34;&gt;启用此特性  &lt;/h3&gt;
&lt;p&gt;在 Alpha 阶段，&lt;code&gt;StorageCapacityScoring&lt;/code&gt; 默认是禁用的。要使用此特性，请将
&lt;code&gt;StorageCapacityScoring=true&lt;/code&gt; 添加到 kube-scheduler 命令行选项
&lt;code&gt;--feature-gates&lt;/code&gt; 中。&lt;/p&gt;
&lt;!--
### Configuration changes

You can configure node priorities based on storage utilization using the `shape` parameter in the VolumeBinding plugin configuration.
This allows you to prioritize nodes with higher available storage capacity (default) or, conversely, nodes with lower available storage capacity.
For example, to prioritize lower available storage capacity, configure `KubeSchedulerConfiguration` as follows:
--&gt;
&lt;h3 id=&#34;configuration-changes&#34;&gt;配置更改  &lt;/h3&gt;
&lt;p&gt;你可以使用 VolumeBinding 插件配置中的 &lt;code&gt;shape&lt;/code&gt; 参数，根据存储利用率来配置节点优先级。
这允许你优先考虑具有更高可用存储容量（默认）的节点，或者相反，优先考虑具有更低可用存储容量的节点。
例如，要优先考虑更低的可用存储容量，请按如下方式配置 &lt;code&gt;KubeSchedulerConfiguration&lt;/code&gt;：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;kubescheduler.config.k8s.io/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;KubeSchedulerConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;profiles&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pluginConfig&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;VolumeBinding&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;args&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;shape&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;utilization&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;score&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;utilization&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;100&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;score&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;10&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
For more details, please refer to the [documentation](/docs/reference/config-api/kube-scheduler-config.v1/#kubescheduler-config-k8s-io-v1-VolumeBindingArgs).
--&gt;
&lt;p&gt;详情请参阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kube-scheduler-config.v1/#kubescheduler-config-k8s-io-v1-VolumeBindingArgs&#34;&gt;文档&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Further reading
--&gt;
&lt;h2 id=&#34;further-reading&#34;&gt;进一步阅读  &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/4049-storage-capacity-scoring-of-nodes-for-dynamic-provisioning/README.md&#34;&gt;KEP-4049: Storage Capacity Scoring of Nodes for Dynamic Provisioning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Additional note: Relationship with VolumeCapacityPriority

The alpha feature gate `VolumeCapacityPriority`, which performs node scoring based on available storage capacity during static provisioning,
will be deprecated and replaced by `StorageCapacityScoring`.
--&gt;
&lt;h2 id=&#34;附加说明-与-volumecapacitypriority-的关系&#34;&gt;附加说明：与 VolumeCapacityPriority 的关系&lt;/h2&gt;
&lt;p&gt;基于静态配置期间的可用存储容量进行节点评分的 Alpha &lt;strong&gt;特性门控&lt;/strong&gt;
&lt;code&gt;VolumeCapacityPriority&lt;/code&gt;，将被弃用，并由 &lt;code&gt;StorageCapacityScoring&lt;/code&gt; 替代。&lt;/p&gt;
&lt;!--
Please note that while `VolumeCapacityPriority` prioritizes nodes with lower available storage capacity by default,
`StorageCapacityScoring` prioritizes nodes with higher available storage capacity by default.
--&gt;
&lt;p&gt;请注意，虽然 &lt;code&gt;VolumeCapacityPriority&lt;/code&gt; 默认优先考虑可用存储容量较低的节点，
但 &lt;code&gt;StorageCapacityScoring&lt;/code&gt; 默认优先考虑可用存储容量较高的节点。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：镜像卷进阶至 Beta！</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/29/kubernetes-v1-33-image-volume-beta/</link>
      <pubDate>Tue, 29 Apr 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/29/kubernetes-v1-33-image-volume-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: Image Volumes graduate to beta!&#34;
date: 2025-04-29T10:30:00-08:00
slug: kubernetes-v1-33-image-volume-beta
author: Sascha Grunert (Red Hat)
--&gt;
&lt;!--
[Image Volumes](/blog/2024/08/16/kubernetes-1-31-image-volume-source) were
introduced as an Alpha feature with the Kubernetes v1.31 release as part of
[KEP-4639](https://github.com/kubernetes/enhancements/issues/4639). In Kubernetes v1.33, this feature graduates to **beta**.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-image-volume-source&#34;&gt;镜像卷&lt;/a&gt;作为
Alpha 特性首次引入 Kubernetes v1.31 版本，并作为
&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4639&#34;&gt;KEP-4639&lt;/a&gt;
的一部分发布。在 Kubernetes v1.33 中，此特性进阶至 &lt;strong&gt;Beta&lt;/strong&gt;。&lt;/p&gt;
&lt;!--
Please note that the feature is still _disabled_ by default, because not all
[container runtimes](/docs/setup/production-environment/container-runtimes) have
full support for it. [CRI-O](https://cri-o.io) supports the initial feature since version v1.31 and
will add support for Image Volumes as beta in v1.33.
[containerd merged](https://github.com/containerd/containerd/pull/10579) support
for the alpha feature which will be part of the v2.1.0 release and is working on
beta support as part of [PR #11578](https://github.com/containerd/containerd/pull/11578).
--&gt;
&lt;p&gt;请注意，此特性目前仍默认&lt;strong&gt;禁用&lt;/strong&gt;，
因为并非所有的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/production-environment/container-runtimes&#34;&gt;容器运行时&lt;/a&gt;都完全支持此特性。
&lt;a href=&#34;https://cri-o.io&#34;&gt;CRI-O&lt;/a&gt; 自 v1.31 起就支持此初始特性，并将在 v1.33 中添加对镜像卷的 Beta 支持。
&lt;a href=&#34;https://github.com/containerd/containerd/pull/10579&#34;&gt;containerd 已合并&lt;/a&gt;对 Alpha 特性的支持，
此特性将包含在 containerd v2.1.0 版本中，并正通过
&lt;a href=&#34;https://github.com/containerd/containerd/pull/11578&#34;&gt;PR #11578&lt;/a&gt; 实现对 Beta 的支持。&lt;/p&gt;
&lt;!--
### What&#39;s new

The major change for the beta graduation of Image Volumes is the support for
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) and
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment) mounts
for containers via `spec.containers[*].volumeMounts.[subPath,subPathExpr]`. This
allows end-users to mount a certain subdirectory of an image volume, which is
still mounted as readonly (`noexec`). This means that non-existing
subdirectories cannot be mounted by default. As for other `subPath` and
`subPathExpr` values, Kubernetes will ensure that there are no absolute path or
relative path components part of the specified sub path. Container runtimes are
also required to double check those requirements for safety reasons. If a
specified subdirectory does not exist within a volume, then runtimes should fail
on container creation and provide user feedback by using existing kubelet
events.
--&gt;
&lt;h3 id=&#34;whats-new&#34;&gt;新增内容  &lt;/h3&gt;
&lt;p&gt;镜像卷进阶为 Beta 的主要变化是支持通过 &lt;code&gt;spec.containers[*].volumeMounts.[subPath,subPathExpr]&lt;/code&gt;
配置容器的 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#using-subpath&#34;&gt;&lt;code&gt;subPath&lt;/code&gt;&lt;/a&gt; 和
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#using-subpath-expanded-environment&#34;&gt;&lt;code&gt;subPathExpr&lt;/code&gt;&lt;/a&gt; 挂载。
这允许最终用户在保持只读（&lt;code&gt;noexec&lt;/code&gt;）方式挂载的同时可以挂载某镜像卷中的某个子目录。
这意味着默认情况下无法挂载不存在的子目录。与其他 &lt;code&gt;subPath&lt;/code&gt; 和 &lt;code&gt;subPathExpr&lt;/code&gt; 取值一样，
Kubernetes 将确保所指定的子路径中不包含绝对路径或相对路径成分。
出于安全考虑，容器运行时也需要再次验证这些要求。如果指定的子目录在卷中不存在，
则运行时应在创建容器时失败，并通过现有的 kubelet 事件向用户提供反馈。&lt;/p&gt;
&lt;!--
Besides that, there are also three new kubelet metrics available for image volumes:

- `kubelet_image_volume_requested_total`: Outlines the number of requested image volumes.
- `kubelet_image_volume_mounted_succeed_total`: Counts the number of successful image volume mounts.
- `kubelet_image_volume_mounted_errors_total`: Accounts the number of failed image volume mounts.
--&gt;
&lt;p&gt;除此之外，还为镜像卷新增三个 kubelet 指标：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kubelet_image_volume_requested_total&lt;/code&gt;：统计请求镜像卷的数量。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubelet_image_volume_mounted_succeed_total&lt;/code&gt;：统计镜像卷成功挂载的数量。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubelet_image_volume_mounted_errors_total&lt;/code&gt;：统计镜像卷挂载失败的数量。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
To use an existing subdirectory for a specific image volume, just use it as
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) (or
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment))
value of the containers `volumeMounts`:
--&gt;
&lt;p&gt;若要为特定镜像卷使用已有的子目录，只需将其用作容器 &lt;code&gt;volumeMounts&lt;/code&gt; 的
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#using-subpath&#34;&gt;&lt;code&gt;subPath&lt;/code&gt;&lt;/a&gt;
或 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#using-subpath-expanded-environment&#34;&gt;&lt;code&gt;subPathExpr&lt;/code&gt;&lt;/a&gt;
取值：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;image-volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;shell&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sleep&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;infinity&amp;#34;&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;debian&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMounts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;subPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;dir&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;reference&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;quay.io/crio/artifact:v2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pullPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;IfNotPresent&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then, create the pod on your cluster:
--&gt;
&lt;p&gt;然后，在集群中创建 Pod：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl apply -f image-volumes-subpath.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Now you can attach to the container:
--&gt;
&lt;p&gt;现在你可以挂接到容器：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl attach -it image-volume bash
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
And check the content of the file from the `dir` sub path in the volume:
--&gt;
&lt;p&gt;并查看卷中 &lt;code&gt;dir&lt;/code&gt; 子路径下的文件内容：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat /volume/file
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The output will be similar to:
--&gt;
&lt;p&gt;输出将类似于：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-none&#34; data-lang=&#34;none&#34;&gt;1
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Thank you for reading through the end of this blog post! SIG Node is proud and
happy to deliver this feature graduation as part of Kubernetes v1.33.

As writer of this blog post, I would like to emphasize my special thanks to
**all** involved individuals out there!
--&gt;
&lt;p&gt;感谢你读完本博文！SIG Node 团队非常自豪和高兴地在 Kubernetes v1.33 中交付此特性的进阶版本。&lt;/p&gt;
&lt;p&gt;作为本文作者，我要特别感谢参与开发此特性的&lt;strong&gt;所有人&lt;/strong&gt;！&lt;/p&gt;
&lt;!--
If you would like to provide feedback or suggestions feel free to reach out
to SIG Node using the [Kubernetes Slack (#sig-node)](https://kubernetes.slack.com/messages/sig-node)
channel or the [SIG Node mailing list](https://groups.google.com/g/kubernetes-sig-node).
--&gt;
&lt;p&gt;如果你有任何反馈或建议，欢迎通过
&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-node&#34;&gt;Kubernetes Slack (#sig-node)&lt;/a&gt;
频道或 &lt;a href=&#34;https://groups.google.com/g/kubernetes-sig-node&#34;&gt;SIG Node 邮件列表&lt;/a&gt;与 SIG Node 团队联系。&lt;/p&gt;
&lt;!--
## Further reading

- [Use an Image Volume With a Pod](/docs/tasks/configure-pod-container/image-volumes)
- [`image` volume overview](/docs/concepts/storage/volumes/#image)
--&gt;
&lt;h2 id=&#34;further-reading&#34;&gt;进一步阅读  &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/image-volumes&#34;&gt;Pod 使用镜像卷&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#image&#34;&gt;&lt;code&gt;image&lt;/code&gt; 卷概览&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33：HorizontalPodAutoscaler 可配置容差</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/28/kubernetes-v1-33-hpa-configurable-tolerance/</link>
      <pubDate>Mon, 28 Apr 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/28/kubernetes-v1-33-hpa-configurable-tolerance/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.33: HorizontalPodAutoscaler Configurable Tolerance&#34;
slug: kubernetes-v1-33-hpa-configurable-tolerance
math: true # for formulae
date: 2025-04-28T10:30:00-08:00
author: &#34;Jean-Marc François (Google)&#34;
--&gt;
&lt;!--
This post describes _configurable tolerance for horizontal Pod autoscaling_,
a new alpha feature first available in Kubernetes 1.33.
--&gt;
&lt;p&gt;这篇文章描述了&lt;strong&gt;水平 Pod 自动扩缩的可配置容差&lt;/strong&gt;，
这是在 Kubernetes 1.33 中首次出现的一个新的 Alpha 特性。&lt;/p&gt;
&lt;!--
## What is it?

[Horizontal Pod Autoscaling](/docs/tasks/run-application/horizontal-pod-autoscale/)
is a well-known Kubernetes feature that allows your workload to
automatically resize by adding or removing replicas based on resource
utilization.
--&gt;
&lt;h2 id=&#34;它是什么&#34;&gt;它是什么？&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/&#34;&gt;水平 Pod 自动扩缩&lt;/a&gt;
是 Kubernetes 中一个众所周知的特性，它允许你的工作负载根据资源利用率自动增减副本数量。&lt;/p&gt;
&lt;!--
Let&#39;s say you have a web application running in a Kubernetes cluster with 50
replicas. You configure the Horizontal Pod Autoscaler (HPA) to scale based on
CPU utilization, with a target of 75% utilization. Now, imagine that the current
CPU utilization across all replicas is 90%, which is higher than the desired
75%. The HPA will calculate the required number of replicas using the formula:
--&gt;
&lt;p&gt;假设你在 Kubernetes 集群中运行了一个具有 50 个副本的 Web 应用程序。
你配置了 Horizontal Pod Autoscaler （HPA）根据 CPU 利用率进行扩缩，
目标利用率 75%。现在，假设所有副本的当前 CPU 利用率为 90%，
这高于预期的 75%。HPA 将使用以下公式计算所需的副本数量：&lt;/p&gt;

&lt;div class=&#34;math&#34;&gt;$$desiredReplicas = ceil\left\lceil currentReplicas \times \frac{currentMetricValue}{desiredMetricValue} \right\rceil$$&lt;/div&gt;&lt;!--
In this example:
--&gt;
&lt;p&gt;在此示例中：&lt;/p&gt;

&lt;div class=&#34;math&#34;&gt;$$50 \times (90/75) = 60$$&lt;/div&gt;&lt;!--
So, the HPA will increase the number of replicas from 50 to 60 to reduce the
load on each pod. Similarly, if the CPU utilization were to drop below 75%, the
HPA would scale down the number of replicas accordingly. The Kubernetes
documentation provides a
[detailed description of the scaling algorithm](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details).
--&gt;
&lt;p&gt;因此，HPA 将增加副本数量从 50 个提高到 60 个，以减少每个 Pod 的负载。
同样，如果 CPU 利用率降至 75% 以下，HPA 会相应地减少副本数量。
Kubernetes 文档提供了&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details&#34;&gt;扩缩算法的详细描述&lt;/a&gt;。&lt;/p&gt;
&lt;!--
In order to avoid replicas being created or deleted whenever a small metric
fluctuation occurs, Kubernetes applies a form of hysteresis: it only changes the
number of replicas when the current and desired metric values differ by more
than 10%. In the example above, since the ratio between the current and desired
metric values is \\(90/75\\), or 20% above target, exceeding the 10% tolerance,
the scale-up action will proceed.
--&gt;
&lt;p&gt;为了避免在指标发生小波动时创建或删除副本，
Kubernetes 应用了一种迟滞形式：仅当当前和期望的指标值差异超过 10% 时，
才改变副本数量。在上面的例子中，因为当前和期望的指标值比率是 \(90/75\)，
即超出目标 20%，超过了 10% 的容差，所以扩容操作将继续进行。&lt;/p&gt;
&lt;!--
This default tolerance of 10% is cluster-wide; in older Kubernetes releases, it
could not be fine-tuned. It&#39;s a suitable value for most usage, but too coarse
for large deployments, where a 10% tolerance represents tens of pods. As a
result, the community has long
[asked](https://github.com/kubernetes/kubernetes/issues/116984) to be able to
tune this value.

In Kubernetes v1.33, this is now possible.
--&gt;
&lt;p&gt;这个 10% 的默认容差是集群范围的；在旧版本的 Kubernetes 中，
它无法进行微调。对于大多数使用场景来说，这是一个合适的值，
但对于大型部署而言则过于粗糙，因为 10% 的容差代表着数十个 Pod。
因此，社区长期以来&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/116984&#34;&gt;要求&lt;/a&gt;能够调整这个值。&lt;/p&gt;
&lt;p&gt;在 Kubernetes v1.33 中，现在这已成为可能。&lt;/p&gt;
&lt;!--
## How do I use it?

After enabling the `HPAConfigurableTolerance`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) in
your Kubernetes v1.33 cluster, you can add your desired tolerance for your
HorizontalPodAutoscaler object.
--&gt;
&lt;h2 id=&#34;我如何使用它&#34;&gt;我如何使用它？&lt;/h2&gt;
&lt;p&gt;在你的 Kubernetes v1.33 集群中启用 &lt;code&gt;HPAConfigurableTolerance&lt;/code&gt;
[特性门控][/zh-cn/docs/reference/command-line-tools-reference/feature-gates/]后，
你可以为你的 HorizontalPodAutoscaler 对象添加期望的容差。&lt;/p&gt;
&lt;!--
Tolerances appear under the `spec.behavior.scaleDown` and
`spec.behavior.scaleUp` fields and can thus be different for scale up and scale
down. A typical usage would be to specify a small tolerance on scale up (to
react quickly to spikes), but higher on scale down (to avoid adding and removing
replicas too quickly in response to small metric fluctuations).

For example, an HPA with a tolerance of 5% on scale-down, and no tolerance on
scale-up, would look like the following:
--&gt;
&lt;p&gt;容差出现在 &lt;code&gt;spec.behavior.scaleDown&lt;/code&gt; 和 &lt;code&gt;spec.behavior.scaleUp&lt;/code&gt;
字段下，因此对于扩容和缩容可以有不同的设置。一个典型的用法是在扩容时指定一个小的容差（以快速响应峰值），
而在缩容时指定较大的容差（以避免因小的指标波动而过快地添加或移除副本）。&lt;/p&gt;
&lt;p&gt;例如，一个在缩容时有 5% 容差，在扩容时没有容差的 HPA 配置如下所示：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;autoscaling/v2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;HorizontalPodAutoscaler&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;my-app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;behavior&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;scaleDown&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tolerance&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0.05&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;scaleUp&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tolerance&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## I want all the details!

Get all the technical details by reading
[KEP-4951](https://github.com/kubernetes/enhancements/tree/master/keps/sig-autoscaling/4951-configurable-hpa-tolerance)
and follow [issue 4951](https://github.com/kubernetes/enhancements/issues/4951)
to be notified of the feature graduation.
--&gt;
&lt;h2 id=&#34;所有细节&#34;&gt;所有细节&lt;/h2&gt;
&lt;p&gt;通过阅读
&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-autoscaling/4951-configurable-hpa-tolerance&#34;&gt;KEP-4951&lt;/a&gt;
获取所有技术细节，并关注 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4951&#34;&gt;Issue 4951&lt;/a&gt;
以获得&lt;strong&gt;特性毕业&lt;/strong&gt;的通知。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 多容器 Pod：概述</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/22/multi-container-pods-overview/</link>
      <pubDate>Tue, 22 Apr 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/22/multi-container-pods-overview/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes Multicontainer Pods: An Overview&#34;
date: 2025-04-22
draft: false
slug: multi-container-pods-overview
author: Agata Skorupka (The Scale Factory)
--&gt;
&lt;!--
As cloud-native architectures continue to evolve, Kubernetes has become the go-to platform for deploying complex, distributed systems. One of the most powerful yet nuanced design patterns in this ecosystem is the sidecar pattern—a technique that allows developers to extend application functionality without diving deep into source code.
--&gt;
&lt;p&gt;随着云原生架构的不断演进，Kubernetes 已成为部署复杂分布式系统的首选平台。
在这个生态系统中，最强大却又微妙的设计模式之一是边车（Sidecar）
模式 —— 一种允许开发者扩展应用功能而不深入源代码的技术。&lt;/p&gt;
&lt;!--
## The origins of the sidecar pattern

Think of a sidecar like a trusty companion motorcycle attachment. Historically, IT infrastructures have always used auxiliary services to handle critical tasks. Before containers, we relied on background processes and helper daemons to manage logging, monitoring, and networking. The microservices revolution transformed this approach, making sidecars a structured and intentional architectural choice.
With the rise of microservices, the sidecar pattern became more clearly defined, allowing developers to offload specific responsibilities from the main service without altering its code. Service meshes like Istio and Linkerd have popularized sidecar proxies, demonstrating how these companion containers can elegantly handle observability, security, and traffic management in distributed systems.
--&gt;
&lt;h2 id=&#34;the-origins-of-the-sidecar-pattern&#34;&gt;边车模式的起源  &lt;/h2&gt;
&lt;p&gt;想象一下边车就像一个可靠的伴侣摩托车附件。历史上，IT 基础设施总是使用辅助服务来处理关键任务。
在容器出现之前，我们依赖后台进程和辅助守护程序来管理日志记录、监控和网络。
微服务革命改变了这种方法，使边车成为一种结构化且有意图的架构选择。
随着微服务的兴起，边车模式变得更加明确，允许开发者从主服务中卸载特定职责而不改变其代码。
诸如 Istio 和 Linkerd 之类的服务网格普及了边车代理，
展示了这些伴侣容器如何优雅地处理分布式系统中的可观察性、安全性和流量管理。&lt;/p&gt;
&lt;!--
## Kubernetes implementation

In Kubernetes, [sidecar containers](/docs/concepts/workloads/pods/sidecar-containers/) operate within
the same Pod as the main application, enabling communication and resource sharing.
Does this sound just like defining multiple containers along each other inside the Pod? It actually does, and
this is how sidecar containers had to be implemented before Kubernetes v1.29.0, which introduced
native support for sidecars.
Sidecar containers  can now be defined within a Pod manifest using the `spec.initContainers` field. What makes
it a sidecar container is that you specify it with `restartPolicy: Always`. You can see an example of this below, which is a partial snippet of the full Kubernetes manifest:
--&gt;
&lt;h2 id=&#34;kubernetes-implementation&#34;&gt;Kubernetes 实现  &lt;/h2&gt;
&lt;p&gt;在 Kubernetes 中，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/sidecar-containers/&#34;&gt;边车容器&lt;/a&gt;与主应用位于同一个
Pod 内，实现通信和资源共享。这听起来就像是在 Pod 内一起定义多个容器一样？实际上确实如此，
这也是在 Kubernetes v1.29.0 引入对边车的本地支持之前实现边车容器的唯一方式。
现在，边车容器可以使用 &lt;code&gt;spec.initContainers&lt;/code&gt; 字段在 Pod 清单中定义。
所指定容器之所以变成了边车容器，是因为你在规约中设置了 &lt;code&gt;restartPolicy: Always&lt;/code&gt;
你可以在下面看到一个示例，这是完整 Kubernetes 清单的一个片段：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;logshipper&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;alpine:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;sh&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;-c&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;tail -F /opt/logs.txt&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMounts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;data&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/opt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
That field name, `spec.initContainers` may sound confusing. How come when you want to define a sidecar container, you have to put an entry in the `spec.initContainers` array? `spec.initContainers` are run to completion just before main application starts, so they’re one-off, whereas sidecars often run in parallel to the main app container. It’s the `spec.initContainers` with `restartPolicy:Always` which differs classic [init containers](/docs/concepts/workloads/pods/init-containers/) from Kubernetes-native sidecar containers and ensures they are always up. 
--&gt;
&lt;p&gt;该字段名称 &lt;code&gt;spec.initContainers&lt;/code&gt; 可能听起来令人困惑。为何在定义边车容器时，必须在
&lt;code&gt;spec.initContainers&lt;/code&gt; 数组中添加条目？&lt;code&gt;spec.initContainers&lt;/code&gt;
在主应用启动前运行至完成，因此它们是一次性的，而边车容器通常与主应用容器并行运行。
正是通过带有 &lt;code&gt;restartPolicy:Always&lt;/code&gt; 的 &lt;code&gt;spec.initContainers&lt;/code&gt; 区分了经典的
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/init-containers/&#34;&gt;Init 容器&lt;/a&gt;和
Kubernetes 原生的边车容器，并确保它们始终保持运行。&lt;/p&gt;
&lt;!--
## When to embrace (or avoid) sidecars

While the sidecar pattern can be useful in many cases, it is generally not the preferred approach unless the use case justifies it. Adding a sidecar increases complexity, resource consumption, and potential network latency. Instead, simpler alternatives such as built-in libraries or shared infrastructure should be considered first.
--&gt;
&lt;h2 id=&#34;when-to-embrace-or-avoid-sidecars&#34;&gt;何时采用（或避免使用）边车  &lt;/h2&gt;
&lt;p&gt;虽然边车模式在许多情况下非常有用，但除非使用场景证明其合理性，
否则通常不推荐优先采用这种方法。添加边车会增加复杂性、
资源消耗以及可能的网络延迟。因此，应首先考虑更简单的替代方案，
例如内置库或共享基础设施。&lt;/p&gt;
&lt;!--
**Deploy a sidecar when:**

1. You need to extend application functionality without touching the original code
1. Implementing cross-cutting concerns like logging, monitoring or security
1. Working with legacy applications requiring modern networking capabilities
1. Designing microservices that demand independent scaling and updates
--&gt;
&lt;p&gt;&lt;strong&gt;在以下情况部署边车：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;你需要扩展应用功能，而无需修改原始代码&lt;/li&gt;
&lt;li&gt;实现日志记录、监控或安全等跨领域关注点&lt;/li&gt;
&lt;li&gt;处理需要现代网络功能的遗留应用&lt;/li&gt;
&lt;li&gt;设计需要独立扩展和更新的微服务&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
**Proceed with caution if:**

1. Resource efficiency is your primary concern
1. Minimal network latency is critical
1. Simpler alternatives exist
1. You want to minimize troubleshooting complexity
--&gt;
&lt;p&gt;&lt;strong&gt;谨慎行事，如果：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;资源效率是你的首要考虑&lt;/li&gt;
&lt;li&gt;最小网络延迟至关重要&lt;/li&gt;
&lt;li&gt;存在更简单的替代方案&lt;/li&gt;
&lt;li&gt;你希望最小化故障排查的复杂性&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Four essential multi-container patterns

### Init container pattern

The **Init container** pattern is used to execute (often critical) setup tasks before the main application container starts. Unlike regular containers, init containers run to completion and then terminate, ensuring that preconditions for the main application are met.
--&gt;
&lt;h2 id=&#34;four-essential-multi-container-patterns&#34;&gt;四个基本的多容器模式  &lt;/h2&gt;
&lt;h3 id=&#34;init-container-pattern&#34;&gt;Init 容器模式  &lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Init 容器&lt;/strong&gt;模式用于在主应用容器启动之前执行（通常是关键的）设置任务。
与常规容器不同，Init 容器会运行至完成然后终止，确保满足主应用的前提条件。&lt;/p&gt;
&lt;!--
**Ideal for:**

1. Preparing configurations
1. Loading secrets
1. Verifying dependency availability
1. Running database migrations

The init container ensures your application starts in a predictable, controlled environment without code modifications.
--&gt;
&lt;p&gt;&lt;strong&gt;适合于：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;准备配置&lt;/li&gt;
&lt;li&gt;加载密钥&lt;/li&gt;
&lt;li&gt;验证依赖项的可用性&lt;/li&gt;
&lt;li&gt;运行数据库迁移&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Init 容器确保你的应用在一个可预测、受控的环境中启动，而无需修改代码。&lt;/p&gt;
&lt;!--
### Ambassador pattern

An ambassador container provides Pod-local helper services that expose a simple way to access a network service. Commonly, ambassador containers send network requests on behalf of a an application container and
take care of challenges such as service discovery, peer identity verification, or encryption in transit.
--&gt;
&lt;h3 id=&#34;ambassador-pattern&#34;&gt;Ambassador 模式  &lt;/h3&gt;
&lt;p&gt;一个大使（Ambassador）容器提供了 Pod 本地的辅助服务，这些服务暴露了一种访问网络服务的简单方式。
通常，Ambassador 容器代表应用容器发送网络请求，并处理诸如服务发现、对等身份验证或传输中加密等挑战。&lt;/p&gt;
&lt;!--
**Perfect when you need to:**

1. Offload client connectivity concerns
1. Implement language-agnostic networking features
1. Add security layers like TLS
1. Create robust circuit breakers and retry mechanisms
--&gt;
&lt;p&gt;&lt;strong&gt;能够完美地处理以下需求：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;卸载客户端连接问题&lt;/li&gt;
&lt;li&gt;实现语言无关的网络功能&lt;/li&gt;
&lt;li&gt;添加如 TLS 的安全层&lt;/li&gt;
&lt;li&gt;创建强大的断路器和重试机制&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### Configuration helper

A _configuration helper_ sidecar provides configuration updates to an application dynamically, ensuring it always has access to the latest settings without disrupting the service. Often the helper needs to provide an initial
configuration before the application would be able to start successfully.
--&gt;
&lt;h3 id=&#34;configuration-helper&#34;&gt;配置助手  &lt;/h3&gt;
&lt;p&gt;一个&lt;strong&gt;配置助手&lt;/strong&gt;边车容器动态地向应用提供配置更新，
确保它始终可以访问最新的设置而不会中断服务。
通常，助手需要在应用能够成功启动之前提供初始配置。&lt;/p&gt;
&lt;!--
**Use cases:**

1. Fetching environment variables and secrets
1. Polling configuration changes
1. Decoupling configuration management from application logic
--&gt;
&lt;p&gt;&lt;strong&gt;使用场景：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;获取环境变量和密钥&lt;/li&gt;
&lt;li&gt;轮询配置更改&lt;/li&gt;
&lt;li&gt;将配置管理与应用逻辑解耦&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### Adapter pattern

An _adapter_ (or sometimes _façade_) container enables interoperability between the main application container and external services. It does this by translating data formats, protocols, or APIs.
--&gt;
&lt;h3 id=&#34;adapter-pattern&#34;&gt;适配器模式  &lt;/h3&gt;
&lt;p&gt;一个&lt;strong&gt;适配器（adapter）&lt;/strong&gt;（有时也称为&lt;strong&gt;切面（façade）&lt;/strong&gt;）容器使主应用容器与外部服务之间能够互操作。
它通过转换数据格式、协议或 API 来实现这一点。&lt;/p&gt;
&lt;!--
**Strengths:**

1. Transforming legacy data formats
1. Bridging communication protocols
1. Facilitating integration between mismatched services
--&gt;
&lt;p&gt;&lt;strong&gt;优点：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;转换遗留数据格式&lt;/li&gt;
&lt;li&gt;搭建通信协议桥梁&lt;/li&gt;
&lt;li&gt;帮助不匹配服务之间的集成&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Wrap-up

While sidecar patterns offer tremendous flexibility, they&#39;re not a silver bullet. Each added sidecar introduces complexity, consumes resources, and potentially increases operational overhead. Always evaluate simpler alternatives first.
The key is strategic implementation: use sidecars as precision tools to solve specific architectural challenges, not as a default approach. When used correctly, they can improve security, networking, and configuration management in containerized environments.
Choose wisely, implement carefully, and let your sidecars elevate your container ecosystem.
--&gt;
&lt;h2 id=&#34;wrap-up&#34;&gt;总结  &lt;/h2&gt;
&lt;p&gt;尽管边车模式提供了巨大的灵活性，但它不是万能的。所添加的每个边车容器都会引入复杂性、
消耗资源，并可能增加操作负担。始终首先评估更简单的替代方案。
关键在于战略性实施：将边车用作解决特定架构挑战的精准工具，而不是默认选择。
正确使用时，它们可以提升容器化环境中的安全性、网络和配置管理。
明智地选择，谨慎地实施，让你的边车提升你的容器生态系统。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>kube-scheduler-simulator 介绍</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/07/introducing-kube-scheduler-simulator/</link>
      <pubDate>Mon, 07 Apr 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/04/07/introducing-kube-scheduler-simulator/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Introducing kube-scheduler-simulator&#34;
date: 2025-04-07
draft: false 
slug: introducing-kube-scheduler-simulator
author: Kensei Nakada (Tetrate)
--&gt;
&lt;!--
The Kubernetes Scheduler is a crucial control plane component that determines which node a Pod will run on. 
Thus, anyone utilizing Kubernetes relies on a scheduler.

[kube-scheduler-simulator](https://github.com/kubernetes-sigs/kube-scheduler-simulator) is a _simulator_ for the Kubernetes scheduler, that started as a [Google Summer of Code 2021](https://summerofcode.withgoogle.com/) project developed by me (Kensei Nakada) and later received a lot of contributions.
This tool allows users to closely examine the scheduler’s behavior and decisions. 
--&gt;
&lt;p&gt;Kubernetes 调度器（Scheduler）是一个关键的控制平面组件，负责决定 Pod 将运行在哪个节点上。&lt;br&gt;
因此，任何使用 Kubernetes 的人都依赖于调度器。&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator&#34;&gt;kube-scheduler-simulator&lt;/a&gt;
是一个 Kubernetes 调度器的&lt;strong&gt;模拟器&lt;/strong&gt;，最初是作为
&lt;a href=&#34;https://summerofcode.withgoogle.com/&#34;&gt;Google Summer of Code 2021&lt;/a&gt;
项目由我（Kensei Nakada）开发的，后来收到了许多贡献。&lt;br&gt;
该工具允许用户深入检查调度器的行为和决策。&lt;/p&gt;
&lt;!--
It is useful for casual users who employ scheduling constraints (for example, [inter-Pod affinity](/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity/#affinity-and-anti-affinity))
and experts who extend the scheduler with custom plugins.
--&gt;
&lt;p&gt;对于使用调度约束（例如，
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity&#34;&gt;Pod 间亲和性&lt;/a&gt;）
的普通用户和通过自定义插件扩展调度器的专家来说，它都是非常有用的。&lt;/p&gt;
&lt;!--
## Motivation

The scheduler often appears as a black box, 
composed of many plugins that each contribute to the scheduling decision-making process from their unique perspectives. 
Understanding its behavior can be challenging due to the multitude of factors it considers. 

Even if a Pod appears to be scheduled correctly in a simple test cluster, it might have been scheduled based on different calculations than expected. This discrepancy could lead to unexpected scheduling outcomes when deployed in a large production environment.
--&gt;
&lt;h2 id=&#34;出发点&#34;&gt;出发点&lt;/h2&gt;
&lt;p&gt;调度器通常被视为一个“黑箱”，&lt;br&gt;
由许多插件组成，每个插件从其独特的角度对调度决策过程做出贡献。&lt;br&gt;
由于调度器考虑的因素繁多，理解其行为可能会非常具有挑战性。&lt;/p&gt;
&lt;p&gt;即使在一个简单的测试集群中，Pod 似乎被正确调度，它也可能基于与预期不同的计算逻辑进行调度。
这种差异可能会在大规模生产环境中导致意外的调度结果。&lt;/p&gt;
&lt;!--
Also, testing a scheduler is a complex challenge.
There are countless patterns of operations executed within a real cluster, making it unfeasible to anticipate every scenario with a finite number of tests. 
More often than not, bugs are discovered only when the scheduler is deployed in an actual cluster.
Actually, many bugs are found by users after shipping the release, 
even in the upstream kube-scheduler. 
--&gt;
&lt;p&gt;此外，测试调度器是一个复杂的挑战。&lt;br&gt;
在实际集群中执行的操作模式数不胜数，使得通过有限数量的测试来预见每种场景变得不可行。&lt;br&gt;
通常，只有当调度器部署到实际集群时，才会发现其中的 Bug。&lt;/p&gt;
&lt;p&gt;实际上，许多 Bug 是在发布版本后由用户发现的，即使是在上游 kube-scheduler 中也是如此。&lt;/p&gt;
&lt;!--
Having a development or sandbox environment for testing the scheduler — or, indeed, any Kubernetes controllers — is a common practice.
However, this approach falls short of capturing all the potential scenarios that might arise in a production cluster 
because a development cluster is often much smaller with notable differences in workload sizes and scaling dynamics.
It never sees the exact same use or exhibits the same behavior as its production counterpart.
--&gt;
&lt;p&gt;拥有一个用于测试调度器或任何 Kubernetes 控制器的开发或沙箱环境是常见做法。&lt;br&gt;
然而，这种方法不足以捕捉生产集群中可能出现的所有潜在场景，因为开发集群通常规模要小得多，
在工作负载大小和扩展动态方面存在显著差异。&lt;br&gt;
它永远不会看到与生产环境中完全相同的使用情况或表现出相同的行为。&lt;/p&gt;
&lt;!--
The kube-scheduler-simulator aims to solve those problems.
It enables users to test their scheduling constraints, scheduler configurations, 
and custom plugins while checking every detailed part of scheduling decisions.
It also allows users to create a simulated cluster environment, where they can test their scheduler
with the same resources as their production cluster without affecting actual workloads.
--&gt;
&lt;p&gt;kube-scheduler-simulator 旨在解决这些问题。&lt;br&gt;
它使用户能够在检查调度决策每一个细节的同时，测试他们的调度约束、调度器配置和自定义插件。&lt;br&gt;
它还允许用户创建一个模拟集群环境，在该环境中，他们可以使用与生产集群相同的资源来测试其调度器，
而不会影响实际的工作负载。&lt;/p&gt;
&lt;!--
## Features of the kube-scheduler-simulator

The kube-scheduler-simulator’s core feature is its ability to expose the scheduler&#39;s internal decisions.
The scheduler operates based on the [scheduling framework](/docs/concepts/scheduling-eviction/scheduling-framework/), 
using various plugins at different extension points,
filter nodes (Filter phase), score nodes (Score phase), and ultimately determine the best node for the Pod.
--&gt;
&lt;h2 id=&#34;kube-scheduler-simulator-的特性&#34;&gt;kube-scheduler-simulator 的特性&lt;/h2&gt;
&lt;p&gt;kube-scheduler-simulator 的核心特性在于它能够揭示调度器的内部决策过程。&lt;br&gt;
调度器基于 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;scheduling framework&lt;/a&gt;
运作，在不同的扩展点使用各种插件，过滤节点（Filter 阶段）、为节点打分（Score 阶段），
并最终确定最适合 Pod 的节点。&lt;/p&gt;
&lt;!--
The simulator allows users to create Kubernetes resources and observe how each plugin influences the scheduling decisions for Pods.
This visibility helps users understand the scheduler’s workings and define appropriate scheduling constraints.



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/images/blog/2025-04-07-kube-scheduler-simulator/simulator.png&#34;
         alt=&#34;Screenshot of the simulator web frontend that shows the detailed scheduling results per node and per extension point&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;The simulator web frontend&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;
&lt;p&gt;模拟器允许用户创建 Kubernetes 资源，并观察每个插件如何影响 Pod 的调度决策。&lt;br&gt;
这种可见性帮助用户理解调度器的工作机制并定义适当的调度约束。&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/images/blog/2025-04-07-kube-scheduler-simulator/simulator.png&#34;
         alt=&#34;模拟器 Web 前端的截图，显示了每个节点和每个扩展点的详细调度结果&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;模拟器 Web 前端&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
Inside the simulator, a debuggable scheduler runs instead of the vanilla scheduler. 
This debuggable scheduler outputs the results of each scheduler plugin at every extension point to the Pod’s annotations like the following manifest shows
and the web front end formats/visualizes the scheduling results based on these annotations.
--&gt;
&lt;p&gt;在模拟器内部，运行的是一个可调试的调度器，而不是普通的调度器。&lt;br&gt;
这个可调试的调度器会将每个调度器插件在各个扩展点的结果输出到 Pod 的注解中，
如下所示的清单所示，而 Web 前端则基于这些注解对调度结果进行格式化和可视化。&lt;/p&gt;
&lt;!--
# The JSONs within these annotations are manually formatted for clarity in the blog post. 
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 为了使博客文章更清晰，这些注释中的 JSON 都是手动格式化的。&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;annotations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/bind-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{&amp;#34;DefaultBinder&amp;#34;:&amp;#34;success&amp;#34;}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/filter-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-jjfg5&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeName&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeUnschedulable&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;passed&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-mtb5x&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeName&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeUnschedulable&amp;#34;:&amp;#34;passed&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;passed&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      }&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/finalscore-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-jjfg5&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;ImageLocality&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeAffinity&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesBalancedAllocation&amp;#34;:&amp;#34;52&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;47&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;300&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;VolumeBinding&amp;#34;:&amp;#34;0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-mtb5x&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;ImageLocality&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeAffinity&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesBalancedAllocation&amp;#34;:&amp;#34;76&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;73&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;300&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;VolumeBinding&amp;#34;:&amp;#34;0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      } &lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/permit-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/permit-result-timeout&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/postfilter-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/prebind-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{&amp;#34;VolumeBinding&amp;#34;:&amp;#34;success&amp;#34;}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/prefilter-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/prefilter-result-status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;AzureDiskLimits&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;EBSLimits&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;GCEPDLimits&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;InterPodAffinity&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeAffinity&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodePorts&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;success&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeVolumeLimits&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;PodTopologySpread&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;VolumeBinding&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;VolumeRestrictions&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;VolumeZone&amp;#34;:&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      }&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/prescore-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;InterPodAffinity&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeAffinity&amp;#34;:&amp;#34;success&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeResourcesBalancedAllocation&amp;#34;:&amp;#34;success&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;success&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;PodTopologySpread&amp;#34;:&amp;#34;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;TaintToleration&amp;#34;:&amp;#34;success&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      }&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/reserve-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{&amp;#34;VolumeBinding&amp;#34;:&amp;#34;success&amp;#34;}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/result-history&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/bind-result&amp;#34;:&amp;#34;{\&amp;#34;DefaultBinder\&amp;#34;:\&amp;#34;success\&amp;#34;}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/filter-result&amp;#34;:&amp;#34;{\&amp;#34;node-jjfg5\&amp;#34;:{\&amp;#34;NodeName\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;NodeUnschedulable\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;passed\&amp;#34;},\&amp;#34;node-mtb5x\&amp;#34;:{\&amp;#34;NodeName\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;NodeUnschedulable\&amp;#34;:\&amp;#34;passed\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;passed\&amp;#34;}}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/finalscore-result&amp;#34;:&amp;#34;{\&amp;#34;node-jjfg5\&amp;#34;:{\&amp;#34;ImageLocality\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeResourcesBalancedAllocation\&amp;#34;:\&amp;#34;52\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;47\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;300\&amp;#34;,\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;0\&amp;#34;},\&amp;#34;node-mtb5x\&amp;#34;:{\&amp;#34;ImageLocality\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeResourcesBalancedAllocation\&amp;#34;:\&amp;#34;76\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;73\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;300\&amp;#34;,\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;0\&amp;#34;}}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/permit-result&amp;#34;:&amp;#34;{}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/permit-result-timeout&amp;#34;:&amp;#34;{}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/postfilter-result&amp;#34;:&amp;#34;{}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/prebind-result&amp;#34;:&amp;#34;{\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;success\&amp;#34;}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/prefilter-result&amp;#34;:&amp;#34;{}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/prefilter-result-status&amp;#34;:&amp;#34;{\&amp;#34;AzureDiskLimits\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;EBSLimits\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;GCEPDLimits\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;InterPodAffinity\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;NodePorts\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;success\&amp;#34;,\&amp;#34;NodeVolumeLimits\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;PodTopologySpread\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;VolumeRestrictions\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;VolumeZone\&amp;#34;:\&amp;#34;\&amp;#34;}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/prescore-result&amp;#34;:&amp;#34;{\&amp;#34;InterPodAffinity\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;success\&amp;#34;,\&amp;#34;NodeResourcesBalancedAllocation\&amp;#34;:\&amp;#34;success\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;success\&amp;#34;,\&amp;#34;PodTopologySpread\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;success\&amp;#34;}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/reserve-result&amp;#34;:&amp;#34;{\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;success\&amp;#34;}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/score-result&amp;#34;:&amp;#34;{\&amp;#34;node-jjfg5\&amp;#34;:{\&amp;#34;ImageLocality\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeResourcesBalancedAllocation\&amp;#34;:\&amp;#34;52\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;47\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;0\&amp;#34;},\&amp;#34;node-mtb5x\&amp;#34;:{\&amp;#34;ImageLocality\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeAffinity\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;NodeResourcesBalancedAllocation\&amp;#34;:\&amp;#34;76\&amp;#34;,\&amp;#34;NodeResourcesFit\&amp;#34;:\&amp;#34;73\&amp;#34;,\&amp;#34;TaintToleration\&amp;#34;:\&amp;#34;0\&amp;#34;,\&amp;#34;VolumeBinding\&amp;#34;:\&amp;#34;0\&amp;#34;}}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;kube-scheduler-simulator.sigs.k8s.io/selected-node&amp;#34;:&amp;#34;node-mtb5x&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      ]&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/score-result&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;gt;-&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-jjfg5&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;ImageLocality&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeAffinity&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesBalancedAllocation&amp;#34;:&amp;#34;52&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;47&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;VolumeBinding&amp;#34;:&amp;#34;0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        &amp;#34;node-mtb5x&amp;#34;:{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;ImageLocality&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeAffinity&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesBalancedAllocation&amp;#34;:&amp;#34;76&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;NodeResourcesFit&amp;#34;:&amp;#34;73&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;TaintToleration&amp;#34;:&amp;#34;0&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;            &amp;#34;VolumeBinding&amp;#34;:&amp;#34;0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;      }&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kube-scheduler-simulator.sigs.k8s.io/selected-node&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-mtb5x&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Users can also integrate [their custom plugins](/docs/concepts/scheduling-eviction/scheduling-framework/) or [extenders](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/scheduler_extender.md), into the debuggable scheduler and visualize their results. 

This debuggable scheduler can also run standalone, for example, on any Kubernetes cluster or in integration tests. 
This would be useful to custom plugin developers who want to test their plugins or examine their custom scheduler in a real cluster with better debuggability.
--&gt;
&lt;p&gt;用户还可以将&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;其自定义插件&lt;/a&gt;
或&lt;a href=&#34;https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/scheduler_extender.md&#34;&gt;扩展器&lt;/a&gt;
集成到可调试调度器中，并可视化其结果。&lt;/p&gt;
&lt;p&gt;这个可调试调度器还可以独立运行，例如，在任何 Kubernetes 集群上或在集成测试中运行。&lt;br&gt;
这对于希望测试其插件或在真实集群中以更好的可调试性检查其自定义调度器的插件开发者来说非常有用。&lt;/p&gt;
&lt;!--
## The simulator as a better dev cluster

As mentioned earlier, with a limited set of tests, it is impossible to predict every possible scenario in a real-world cluster.
Typically, users will test the scheduler in a small, development cluster before deploying it to production, hoping that no issues arise.
--&gt;
&lt;h2 id=&#34;作为更优开发集群的模拟器&#34;&gt;作为更优开发集群的模拟器&lt;/h2&gt;
&lt;p&gt;如前所述，由于测试用例的数量有限，不可能预测真实世界集群中的每一种可能场景。&lt;br&gt;
通常，用户会在一个小型开发集群中测试调度器，然后再将其部署到生产环境中，
希望能不出现任何问题。&lt;/p&gt;
&lt;!--
[The simulator’s importing feature](https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/master/simulator/docs/import-cluster-resources.md)
provides a solution by allowing users to simulate deploying a new scheduler version in a production-like environment without impacting their live workloads.

By continuously syncing between a production cluster and the simulator, users can safely test a new scheduler version with the same resources their production cluster handles. 
Once confident in its performance, they can proceed with the production deployment, reducing the risk of unexpected issues.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/master/simulator/docs/import-cluster-resources.md&#34;&gt;模拟器的导入功能&lt;/a&gt;
通过允许用户在类似生产环境的模拟中部署新的调度器版本而不影响其线上工作负载，
提供了一种解决方案。&lt;/p&gt;
&lt;p&gt;通过在生产集群和模拟器之间进行持续同步，用户可以安全地使用与生产集群相同的资源测试新的调度器版本。
一旦对其性能感到满意，便可以继续进行生产部署，从而减少意外问题的风险。&lt;/p&gt;
&lt;!--
## What are the use cases?

1. **Cluster users**: Examine if scheduling constraints (for example, PodAffinity, PodTopologySpread) work as intended.
1. **Cluster admins**: Assess how a cluster would behave with changes to the scheduler configuration.
1. **Scheduler plugin developers**: Test a custom scheduler plugins or extenders, use the debuggable scheduler in integration tests or development clusters, or use the [syncing](https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/simulator/v0.3.0/simulator/docs/import-cluster-resources.md) feature for testing within a production-like environment.
--&gt;
&lt;h2 id=&#34;有哪些使用场景&#34;&gt;有哪些使用场景？&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;集群用户&lt;/strong&gt;：检查调度约束（例如，PodAffinity、PodTopologySpread）是否按预期工作。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;集群管理员&lt;/strong&gt;：评估在调度器配置更改后集群的行为表现。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;调度器插件开发者&lt;/strong&gt;：测试自定义调度器插件或扩展器，在集成测试或开发集群中使用可调试调度器，
或利用&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator/blob/simulator/v0.3.0/simulator/docs/import-cluster-resources.md&#34;&gt;同步&lt;/a&gt;
功能在类似生产环境的环境中进行测试。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Getting started

The simulator only requires Docker to be installed on a machine; a Kubernetes cluster is not necessary.
--&gt;
&lt;h2 id=&#34;入门指南&#34;&gt;入门指南&lt;/h2&gt;
&lt;p&gt;模拟器仅要求在机器上安装 Docker；并不需要 Kubernetes 集群。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone git@github.com:kubernetes-sigs/kube-scheduler-simulator.git
cd kube-scheduler-simulator
make docker_up
&lt;/code&gt;&lt;/pre&gt;&lt;!--
You can then access the simulator&#39;s web UI at `http://localhost:3000`.

Visit the [kube-scheduler-simulator repository](https://sigs.k8s.io/kube-scheduler-simulator) for more details!
--&gt;
&lt;p&gt;然后，你可以通过访问 &lt;code&gt;http://localhost:3000&lt;/code&gt; 来使用模拟器的 Web UI。&lt;/p&gt;
&lt;p&gt;更多详情，请访问 &lt;a href=&#34;https://sigs.k8s.io/kube-scheduler-simulator&#34;&gt;kube-scheduler-simulator 仓库&lt;/a&gt;！&lt;/p&gt;
&lt;!--
## Getting involved 

The scheduler simulator is developed by [Kubernetes SIG Scheduling](https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md#kube-scheduler-simulator). Your feedback and contributions are welcome!
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;调度器模拟器由
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md#kube-scheduler-simulator&#34;&gt;Kubernetes SIG Scheduling&lt;/a&gt;
开发。欢迎你提供反馈并参与贡献！&lt;/p&gt;
&lt;!--
Open issues or PRs at the [kube-scheduler-simulator repository](https://sigs.k8s.io/kube-scheduler-simulator).
Join the conversation on the [#sig-scheduling](https://kubernetes.slack.com/messages/sig-scheduling) slack channel.
--&gt;
&lt;p&gt;在 &lt;a href=&#34;https://sigs.k8s.io/kube-scheduler-simulator&#34;&gt;kube-scheduler-simulator 仓库&lt;/a&gt;开启问题或提交 PR。&lt;/p&gt;
&lt;p&gt;加入 &lt;a href=&#34;https://kubernetes.slack.com/messages/sig-scheduling&#34;&gt;#sig-scheduling&lt;/a&gt;
Slack 频道参与讨论。&lt;/p&gt;
&lt;!--
## Acknowledgments

The simulator has been maintained by dedicated volunteer engineers, overcoming many challenges to reach its current form. 

A big shout out to all [the awesome contributors](https://github.com/kubernetes-sigs/kube-scheduler-simulator/graphs/contributors)!
--&gt;
&lt;h2 id=&#34;致谢&#34;&gt;致谢&lt;/h2&gt;
&lt;p&gt;模拟器由致力于该项目的志愿者工程师们维护，克服了许多挑战才达到了现在的形式。&lt;/p&gt;
&lt;p&gt;特别感谢所有&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator/graphs/contributors&#34;&gt;杰出的贡献者&lt;/a&gt;！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.33 预览</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/26/kubernetes-v1-33-upcoming-changes/</link>
      <pubDate>Wed, 26 Mar 2025 10:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/26/kubernetes-v1-33-upcoming-changes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.33 sneak peek&#39;
date: 2025-03-26T10:30:00-08:00
slug: kubernetes-v1-33-upcoming-changes
author: &gt;
  Agustina Barbetta,
  Aakanksha Bhende,
  Udi Hofesh,
  Ryota Sawada,
  Sneha Yadav
--&gt;
&lt;!--
As the release of Kubernetes v1.33 approaches, the Kubernetes project continues to evolve. Features may be deprecated, removed, or replaced to improve the overall health of the project. This blog post outlines some planned changes for the v1.33 release, which the release team believes you should be aware of to ensure the continued smooth operation of your Kubernetes environment and to keep you up-to-date with the latest developments.  The information below is based on the current status of the v1.33 release and is subject to change before the final release date.
--&gt;
&lt;p&gt;随着 Kubernetes v1.33 版本的发布临近，Kubernetes 项目仍在不断发展。
为了提升项目的整体健康状况，某些特性可能会被弃用、移除或替换。
这篇博客文章概述了 v1.33 版本的一些计划变更，发布团队认为你有必要了解这些内容，
以确保 Kubernetes 环境的持续平稳运行，并让你掌握最新的发展动态。
以下信息基于 v1.33 版本的当前状态，在最终发布日期之前可能会有所变化。&lt;/p&gt;
&lt;!--
## The Kubernetes API removal and deprecation process

The Kubernetes project has a well-documented [deprecation policy](/docs/reference/using-api/deprecation-policy/) for features. This policy states that stable APIs may only be deprecated when a newer, stable version of that same API is available and that APIs have a minimum lifetime for each stability level. A deprecated API has been marked for removal in a future Kubernetes release. It will continue to function until removal (at least one year from the deprecation), but usage will result in a warning being displayed. Removed APIs are no longer available in the current version, at which point you must migrate to using the replacement.
--&gt;
&lt;h2 id=&#34;kubernetes-api-的移除与弃用流程&#34;&gt;Kubernetes API 的移除与弃用流程&lt;/h2&gt;
&lt;p&gt;Kubernetes 项目针对特性的弃用有一套完善的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-policy/&#34;&gt;弃用政策&lt;/a&gt;。
该政策规定，只有在有更新的、稳定的同名 API 可用时，才能弃用稳定的 API，
并且每个稳定性级别的 API 都有最低的生命周期要求。被弃用的 API 已被标记为将在未来的
Kubernetes 版本中移除。在移除之前（自弃用起至少一年内），它仍然可以继续使用，
但使用时会显示警告信息。已被移除的 API 在当前版本中不再可用，届时你必须迁移到使用替代方案。&lt;/p&gt;
&lt;!--
* Generally available (GA) or stable API versions may be marked as deprecated but must not be removed within a major version of Kubernetes.

* Beta or pre-release API versions must be supported for 3 releases after the deprecation.

* Alpha or experimental API versions may be removed in any release without prior deprecation notice; this process can become a withdrawal in cases where a different implementation for the same feature is already in place.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;一般可用（GA）或稳定 API 版本可以被标记为已弃用，但在 Kubernetes
的一个主要版本内不得移除。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;测试版或预发布 API 版本在弃用后必须支持至少三个发行版本。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alpha 或实验性 API 版本可以在任何版本中被移除，且无需事先发出弃用通知；
如果同一特性已经有了不同的实现，这个过程可能会变为撤回。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Whether an API is removed as a result of a feature graduating from beta to stable, or because that API simply did not succeed, all removals comply with this deprecation policy. Whenever an API is removed, migration options are communicated in the [deprecation guide](/docs/reference/using-api/deprecation-guide/).
--&gt;
&lt;p&gt;无论是由于某个特性从测试阶段升级为稳定阶段而导致 API 被移除，还是因为该
API 未能成功，所有的移除操作都遵循此弃用政策。每当一个 API 被移除时，
迁移选项都会在&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/&#34;&gt;弃用指南&lt;/a&gt;中进行说明。&lt;/p&gt;
&lt;!--
## Deprecations and removals for Kubernetes v1.33

### Deprecation of the stable Endpoints API

The [EndpointSlices](/docs/concepts/services-networking/endpoint-slices/) API has been stable since v1.21, which effectively replaced the original Endpoints API. While the original Endpoints API was simple and straightforward, it also posed some challenges when scaling to large numbers of network endpoints. The EndpointSlices API has introduced new features such as dual-stack networking, making the original Endpoints API ready for deprecation.
--&gt;
&lt;h2 id=&#34;kubernetes-v1-33-的弃用与移除&#34;&gt;Kubernetes v1.33 的弃用与移除&lt;/h2&gt;
&lt;h3 id=&#34;稳定版-endpoints-api-的弃用&#34;&gt;稳定版 Endpoints API 的弃用&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/endpoint-slices/&#34;&gt;EndpointSlices&lt;/a&gt; API
自 v1.21 起已稳定，实际上取代了原有的 Endpoints API。虽然原有的 Endpoints API 简单直接，
但在扩展到大量网络端点时也带来了一些挑战。EndpointSlices API 引入了诸如双栈网络等新特性，
使得原有的 Endpoints API 已准备好被弃用。&lt;/p&gt;
&lt;!--
This deprecation only impacts those who use the Endpoints API directly from workloads or scripts; these users should migrate to use EndpointSlices instead. There will be a dedicated blog post with more details on the deprecation implications and migration plans in the coming weeks.

You can find more in [KEP-4974: Deprecate v1.Endpoints](https://kep.k8s.io/4974).
--&gt;
&lt;p&gt;此弃用仅影响那些直接在工作负载或脚本中使用 Endpoints API 的用户；
这些用户应迁移到使用 EndpointSlices。未来几周内将发布一篇专门的博客文章，
详细介绍弃用的影响和迁移计划。&lt;/p&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/4974&#34;&gt;KEP-4974: Deprecate v1.Endpoints&lt;/a&gt;
中找到更多信息。&lt;/p&gt;
&lt;!--
### Removal of kube-proxy version information in node status

Following its deprecation in v1.31, as highlighted in the [release announcement](/blog/2024/07/19/kubernetes-1-31-upcoming-changes/#deprecation-of-status-nodeinfo-kubeproxyversion-field-for-nodes-kep-4004-https-github-com-kubernetes-enhancements-issues-4004), the `status.nodeInfo.kubeProxyVersion` field will be removed in v1.33. This field was set by kubelet, but its value was not consistently accurate. As it has been disabled by default since v1.31, the v1.33 release will remove this field entirely.
--&gt;
&lt;h3 id=&#34;节点状态中-kube-proxy-版本信息的移除&#34;&gt;节点状态中 kube-proxy 版本信息的移除&lt;/h3&gt;
&lt;p&gt;继在 v1.31 中被弃用，并在&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2024/07/19/kubernetes-1-31-upcoming-changes/#deprecation-of-status-nodeinfo-kubeproxyversion-field-for-nodes-kep-4004-https-github-com-kubernetes-enhancements-issues-4004&#34;&gt;发布说明&lt;/a&gt;中强调后，
&lt;code&gt;status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段将在 v1.33 中被移除。
此字段由 kubelet 设置，但其值并不总是准确的。由于自 v1.31
起该字段默认已被禁用，v1.33 发行版将完全移除此字段。&lt;/p&gt;
&lt;!--
You can find more in [KEP-4004: Deprecate status.nodeInfo.kubeProxyVersion field](https://kep.k8s.io/4004).

### Removal of host network support for Windows pods
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/4004&#34;&gt;KEP-4004: Deprecate status.nodeInfo.kubeProxyVersion field&lt;/a&gt;
中找到更多信息。&lt;/p&gt;
&lt;h3 id=&#34;移除对-windows-pod-的主机网络支持&#34;&gt;移除对 Windows Pod 的主机网络支持&lt;/h3&gt;
&lt;!--
Windows Pod networking aimed to achieve feature parity with Linux and provide better cluster density by allowing containers to use the Node’s networking namespace.
The original implementation landed as alpha with v1.26, but as it faced unexpected containerd behaviours,
and alternative solutions were available, the Kubernetes project has decided to withdraw the associated
KEP. We&#39;re expecting to see support fully removed in v1.33.
--&gt;
&lt;p&gt;Windows Pod 网络旨在通过允许容器使用节点的网络命名空间来实现与 Linux 的特性对等，
并提供更高的集群密度。最初的实现作为 Alpha 版本在 v1.26 中引入，但由于遇到了未预期的
containerd 行为，且存在替代方案，Kubernetes 项目决定撤回相关的 KEP。
我们预计在 v1.33 中完全移除对该特性的支持。&lt;/p&gt;
&lt;!--
You can find more in [KEP-3503: Host network support for Windows pods](https://kep.k8s.io/3503).

## Featured improvement of Kubernetes v1.33

As authors of this article, we picked one improvement as the most significant change to call out!
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/3503&#34;&gt;KEP-3503: Host network support for Windows pods&lt;/a&gt;
中找到更多信息。&lt;/p&gt;
&lt;h2 id=&#34;kubernetes-v1-33-的特色改进&#34;&gt;Kubernetes v1.33 的特色改进&lt;/h2&gt;
&lt;p&gt;作为本文的作者，我们挑选了一项改进作为最重要的变更来特别提及！&lt;/p&gt;
&lt;!--
### Support for user namespaces within Linux Pods

One of the oldest open KEPs today is [KEP-127](https://kep.k8s.io/127), Pod security improvement by using Linux [User namespaces](/docs/concepts/workloads/pods/user-namespaces/) for Pods. This KEP was first opened in late 2016, and after multiple iterations, had its alpha release in v1.25, initial beta in v1.30 (where it was disabled by default), and now is set to be a part of v1.33, where the feature is available by default.
--&gt;
&lt;h3 id=&#34;linux-pods-中用户命名空间的支持&#34;&gt;Linux Pods 中用户命名空间的支持&lt;/h3&gt;
&lt;p&gt;当前最古老的开放 KEP 之一是 &lt;a href=&#34;https://kep.k8s.io/127&#34;&gt;KEP-127&lt;/a&gt;，
通过使用 Linux &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/user-namespaces/&#34;&gt;用户命名空间&lt;/a&gt;为
Pod 提供安全性改进。该 KEP 最初在 2016 年末提出，经过多次迭代，在 v1.25 中发布了 Alpha 版本，
在 v1.30 中首次进入 Beta 阶段（在此版本中默认禁用），现在它将成为 v1.33 的一部分，
默认情况下即可使用该特性。&lt;/p&gt;
&lt;!--
This support will not impact existing Pods unless you manually specify `pod.spec.hostUsers` to opt in. As highlighted in the [v1.30 sneak peek blog](/blog/2024/03/12/kubernetes-1-30-upcoming-changes/), this is an important milestone for mitigating vulnerabilities.

You can find more in [KEP-127: Support User Namespaces in pods](https://kep.k8s.io/127).
--&gt;
&lt;p&gt;除非你手动指定 &lt;code&gt;pod.spec.hostUsers&lt;/code&gt; 以选择使用此特性，否则此支持不会影响现有的 Pod。
正如在 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2024/03/12/kubernetes-1-30-upcoming-changes/&#34;&gt;v1.30 预览博客&lt;/a&gt;中强调的那样，
就缓解漏洞的影响而言，这是一个重要里程碑。&lt;/p&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/127&#34;&gt;KEP-127: Support User Namespaces in pods&lt;/a&gt;
中找到更多信息。&lt;/p&gt;
&lt;!--
## Selected other Kubernetes v1.33 improvements

The following list of enhancements is likely to be included in the upcoming v1.33 release. This is not a commitment and the release content is subject to change.
--&gt;
&lt;h2 id=&#34;精选的其他-kubernetes-v1-33-改进&#34;&gt;精选的其他 Kubernetes v1.33 改进&lt;/h2&gt;
&lt;p&gt;以下列出的改进很可能会包含在即将到来的 v1.33 发行版中。
这些改进尚无法承诺，发行内容仍有可能发生变化。&lt;/p&gt;
&lt;!--
### In-place resource resize for vertical scaling of Pods

When provisioning a Pod, you can use various resources such as Deployment, StatefulSet, etc. Scalability requirements may need horizontal scaling by updating the Pod replica count, or vertical scaling by updating resources allocated to Pod’s container(s). Before this enhancement, container resources defined in a Pod&#39;s `spec` were immutable, and updating any of these details within a Pod template would trigger Pod replacement.
--&gt;
&lt;h3 id=&#34;pod-垂直扩展的就地资源调整&#34;&gt;Pod 垂直扩展的就地资源调整&lt;/h3&gt;
&lt;p&gt;在制备某个 Pod 时，你可以使用诸如 Deployment、StatefulSet 等多种资源。
为了满足可扩缩性需求，可能需要通过更新 Pod 副本数量进行水平扩缩，或通过更新分配给
Pod 容器的资源进行垂直扩缩。在此增强特性之前，Pod 的 &lt;code&gt;spec&lt;/code&gt;
中定义的容器资源是不可变的，更新 Pod 模板中的这类细节会触发 Pod 的替换。&lt;/p&gt;
&lt;!--
But what if you could dynamically update the resource configuration for your existing Pods without restarting them?

The [KEP-1287](https://kep.k8s.io/1287) is precisely to allow such in-place Pod updates. It opens up various possibilities of vertical scale-up for stateful processes without any downtime, seamless scale-down when the traffic is low, and even allocating larger resources during startup that is eventually reduced once the initial setup is complete. This was released as alpha in v1.27, and is expected to land as beta in v1.33.
--&gt;
&lt;p&gt;但是如果可以在不重启的情况下动态更新现有 Pod 的资源配置，那会怎样呢？&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kep.k8s.io/1287&#34;&gt;KEP-1287&lt;/a&gt; 正是为了实现这种就地 Pod 更新而设计的。
它为无状态进程的垂直扩缩开辟了多种可能性，例如在不停机的情况下进行扩容、
在流量较低时无缝缩容，甚至在启动时分配更多资源，待初始设置完成后减少资源分配。
该特性在 v1.27 中以 Alpha 版本发布，并预计在 v1.33 中进入 beta 阶段。&lt;/p&gt;
&lt;!--
You can find more in [KEP-1287: In-Place Update of Pod Resources](https://kep.k8s.io/1287).

### DRA’s ResourceClaim Device Status graduates to beta
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/1287&#34;&gt;KEP-1287：Pod 资源的就地更新&lt;/a&gt;中找到更多信息。&lt;/p&gt;
&lt;h3 id=&#34;dra-的-resourceclaim-设备状态升级为-beta&#34;&gt;DRA 的 ResourceClaim 设备状态升级为 Beta&lt;/h3&gt;
&lt;!--
The `devices` field in ResourceClaim `status`, originally introduced in the v1.32 release, is likely to graduate to beta in v1.33. This field allows drivers to report device status data, improving both observability and troubleshooting capabilities.
--&gt;
&lt;p&gt;在 v1.32 版本中首次引入的 ResourceClaim &lt;code&gt;status&lt;/code&gt; 中的 &lt;code&gt;devices&lt;/code&gt; 字段，
预计将在 v1.33 中升级为 beta 阶段。此字段允许驱动程序报告设备状态数据，
从而提升可观测性和故障排查能力。&lt;/p&gt;
&lt;!--
For example, reporting the interface name, MAC address, and IP addresses of network interfaces in the status of a ResourceClaim can significantly help in configuring and managing network services, as well as in debugging network related issues. You can read more about ResourceClaim Device Status in [Dynamic Resource Allocation: ResourceClaim Device Status](/docs/concepts/scheduling-eviction/dynamic-resource-allocation/#resourceclaim-device-status) document.
--&gt;
&lt;p&gt;例如，在 ResourceClaim 的状态中报告网络接口的接口名称、MAC 地址和 IP 地址，
可以显著帮助配置和管理网络服务，并且在调试网络相关问题时也非常有用。
你可以在&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/dynamic-resource-allocation/#resourceclaim-device-status&#34;&gt;动态资源分配：ResourceClaim 设备状态&lt;/a&gt;
文档中阅读关于 ResourceClaim 设备状态的更多信息。&lt;/p&gt;
&lt;!--
Also, you can find more about the planned enhancement in [KEP-4817: DRA: Resource Claim Status with possible standardized network interface data](https://kep.k8s.io/4817).
--&gt;
&lt;p&gt;此外，你可以在
&lt;a href=&#34;https://kep.k8s.io/4817&#34;&gt;KEP-4817: DRA: Resource Claim Status with possible standardized network interface data&lt;/a&gt;
中找到更多关于此计划增强特性的信息。&lt;/p&gt;
&lt;!--
### Ordered namespace deletion

This KEP introduces a more structured deletion process for Kubernetes namespaces to ensure secure and deterministic resource removal. The current semi-random deletion order can create security gaps or unintended behaviour, such as Pods persisting after their associated NetworkPolicies are deleted. By enforcing a structured deletion sequence that respects logical and security dependencies, this approach ensures Pods are removed before other resources. The design improves Kubernetes’s security and reliability by mitigating risks associated with non-deterministic deletions.
--&gt;
&lt;h3 id=&#34;有序的命名空间删除&#34;&gt;有序的命名空间删除&lt;/h3&gt;
&lt;p&gt;此 KEP 为 Kubernetes 命名空间引入了一种更为结构化的删除流程，
以确保更为安全且更为确定的资源移除。当前半随机的删除顺序可能会导致安全漏洞或意外行为，
例如在相关的 NetworkPolicy 被删除后，Pod 仍然存在。
通过强制执行尊重逻辑和安全依赖关系的结构化删除顺序，此方法确保在删除其他资源之前先删除 Pod。
这种设计通过减少与非确定性删除相关的风险，提升了 Kubernetes 的安全性和可靠性。&lt;/p&gt;
&lt;!--
You can find more in [KEP-5080: Ordered namespace deletion](https://kep.k8s.io/5080).
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/5080&#34;&gt;KEP-5080: Ordered namespace deletion&lt;/a&gt;
中找到更多信息。&lt;/p&gt;
&lt;!--
### Enhancements for indexed job management

These two KEPs are both set to graduate to GA to provide better reliability for job handling, specifically for indexed jobs. [KEP-3850](https://kep.k8s.io/3850) provides per-index backoff limits for indexed jobs, which allows each index to be fully independent of other indexes. Also, [KEP-3998](https://kep.k8s.io/3998) extends Job API to define conditions for making an indexed job as successfully completed when not all indexes are succeeded.
--&gt;
&lt;h3 id=&#34;针对带索引作业-indexed-job-管理的增强&#34;&gt;针对带索引作业（Indexed Job）管理的增强&lt;/h3&gt;
&lt;p&gt;这两个 KEP 都计划升级为 GA，以提供更好的作业处理可靠性，特别是针对索引作业。
&lt;a href=&#34;https://kep.k8s.io/3850&#34;&gt;KEP-3850&lt;/a&gt; 为索引作业中的不同索引分别支持独立的回退限制，
这使得每个索引可以完全独立于其他索引。此外，&lt;a href=&#34;https://kep.k8s.io/3998&#34;&gt;KEP-3998&lt;/a&gt;
扩展了 Job API，定义了在并非所有索引都成功的情况下将索引作业标记为成功完成的条件。&lt;/p&gt;
&lt;!--
You can find more in [KEP-3850: Backoff Limit Per Index For Indexed Jobs](https://kep.k8s.io/3850) and [KEP-3998: Job success/completion policy](https://kep.k8s.io/3998).
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kep.k8s.io/3850&#34;&gt;KEP-3850: Backoff Limit Per Index For Indexed Jobs&lt;/a&gt; 和
&lt;a href=&#34;https://kep.k8s.io/3998&#34;&gt;KEP-3998: Job success/completion policy&lt;/a&gt; 中找到更多信息。&lt;/p&gt;
&lt;!--
## Want to know more?

New features and deprecations are also announced in the Kubernetes release notes. We will formally announce what&#39;s new in [Kubernetes v1.33](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.33.md) as part of the CHANGELOG for that release.
--&gt;
&lt;h2 id=&#34;想了解更多&#34;&gt;想了解更多？&lt;/h2&gt;
&lt;p&gt;新特性和弃用也会在 Kubernetes 发行说明中宣布。我们将在该版本的
CHANGELOG 中正式宣布 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.33.md&#34;&gt;Kubernetes v1.33&lt;/a&gt;
的新内容。&lt;/p&gt;
&lt;!--
Kubernetes v1.33 release is planned for **Wednesday, 23rd April, 2025**. Stay tuned for updates!

You can also see the announcements of changes in the release notes for:
--&gt;
&lt;p&gt;Kubernetes v1.33 版本计划于 &lt;strong&gt;2025年4月23日星期三&lt;/strong&gt;发布。请持续关注以获取更新！&lt;/p&gt;
&lt;p&gt;你也可以在以下版本的发行说明中查看变更公告：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.32.md&#34;&gt;Kubernetes v1.32&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md&#34;&gt;Kubernetes v1.31&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.30.md&#34;&gt;Kubernetes v1.30&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved

The simplest way to get involved with Kubernetes is by joining one of the many [Special Interest Groups](https://github.com/kubernetes/community/blob/master/sig-list.md) (SIGs) that align with your interests. Have something you’d like to broadcast to the Kubernetes community? Share your voice at our weekly [community meeting](https://github.com/kubernetes/community/tree/master/communication), and through the channels below. Thank you for your continued feedback and support.
--&gt;
&lt;h2 id=&#34;参与进来&#34;&gt;参与进来&lt;/h2&gt;
&lt;p&gt;参与 Kubernetes 最简单的方式是加入与你兴趣相符的众多&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-list.md&#34;&gt;特别兴趣小组&lt;/a&gt;（SIG）
之一。你有什么想向 Kubernetes 社区广播的内容吗？
通过我们每周的&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/communication&#34;&gt;社区会议&lt;/a&gt;和以下渠道分享你的声音。
感谢你持续的反馈和支持。&lt;/p&gt;
&lt;!--
- Follow us on Bluesky [@kubernetes.io](https://bsky.app/profile/kubernetes.io) for the latest updates
- Join the community discussion on [Discuss](https://discuss.kubernetes.io/)
- Join the community on [Slack](http://slack.k8s.io/)
- Post questions (or answer questions) on [Server Fault](https://serverfault.com/questions/tagged/kubernetes) or [Stack Overflow](http://stackoverflow.com/questions/tagged/kubernetes)
- Share your Kubernetes [story](https://docs.google.com/a/linuxfoundation.org/forms/d/e/1FAIpQLScuI7Ye3VQHQTwBASrgkjQDSS5TP0g3AXfFhwSM9YpHgxRKFA/viewform)
- Read more about what’s happening with Kubernetes on the [blog](https://kubernetes.io/blog/)
- Learn more about the [Kubernetes Release Team](https://github.com/kubernetes/sig-release/tree/master/release-team)
--&gt;
&lt;ul&gt;
&lt;li&gt;在 Bluesky 上关注我们 &lt;a href=&#34;https://bsky.app/profile/kubernetes.io&#34;&gt;@kubernetes.io&lt;/a&gt; 以获取最新更新&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;https://discuss.kubernetes.io/&#34;&gt;Discuss&lt;/a&gt; 上参与社区讨论&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;http://slack.k8s.io/&#34;&gt;Slack&lt;/a&gt; 上加入社区&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;https://serverfault.com/questions/tagged/kubernetes&#34;&gt;Server Fault&lt;/a&gt; 或
&lt;a href=&#34;http://stackoverflow.com/questions/tagged/kubernetes&#34;&gt;Stack Overflow&lt;/a&gt; 上提问（或回答问题）&lt;/li&gt;
&lt;li&gt;分享你的 Kubernetes &lt;a href=&#34;https://docs.google.com/a/linuxfoundation.org/forms/d/e/1FAIpQLScuI7Ye3VQHQTwBASrgkjQDSS5TP0g3AXfFhwSM9YpHgxRKFA/viewform&#34;&gt;故事&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;在&lt;a href=&#34;https://kubernetes.io/zh-cn/blog/&#34;&gt;博客&lt;/a&gt;上阅读更多关于 Kubernetes 最新动态的内容&lt;/li&gt;
&lt;li&gt;了解更多关于 &lt;a href=&#34;https://github.com/kubernetes/sig-release/tree/master/release-team&#34;&gt;Kubernetes 发布团队&lt;/a&gt;的信息&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>ingress-nginx CVE-2025-1974 须知</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/24/ingress-nginx-cve-2025-1974/</link>
      <pubDate>Mon, 24 Mar 2025 12:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/24/ingress-nginx-cve-2025-1974/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Ingress-nginx CVE-2025-1974: What You Need to Know&#34;
date: 2025-03-24T12:00:00-08:00
slug: ingress-nginx-CVE-2025-1974
author: &gt;
  Tabitha Sable (Kubernetes Security Response Committee)
--&gt;
&lt;!--
Today, the ingress-nginx maintainers have [released patches for a batch of critical vulnerabilities](https://github.com/kubernetes/ingress-nginx/releases) that could make it easy for attackers to take over your Kubernetes cluster. If you are among the over 40% of Kubernetes administrators using [ingress-nginx](https://github.com/kubernetes/ingress-nginx/), you should take action immediately to protect your users and data.
--&gt;
&lt;p&gt;今天，ingress-nginx 项目的维护者们&lt;a href=&#34;https://github.com/kubernetes/ingress-nginx/releases&#34;&gt;发布了一批关键漏洞的修复补丁&lt;/a&gt;，
这些漏洞可能让攻击者轻易接管你的 Kubernetes 集群。目前有 40% 以上的 Kubernetes 管理员正在使用
&lt;a href=&#34;https://github.com/kubernetes/ingress-nginx/&#34;&gt;ingress-nginx&lt;/a&gt;，
如果你是其中之一，请立即采取行动，保护你的用户和数据。&lt;/p&gt;
&lt;!--
## Background

[Ingress](/docs/concepts/services-networking/ingress/) is the traditional Kubernetes feature for exposing your workload Pods to the world so that they can be useful. In an implementation-agnostic way, Kubernetes users can define how their applications should be made available on the network. Then, an [ingress controller](/docs/concepts/services-networking/ingress-controllers/) uses that definition to set up local or cloud resources as required for the user’s particular situation and needs.
--&gt;
&lt;h2 id=&#34;background&#34;&gt;背景  &lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/ingress/&#34;&gt;Ingress&lt;/a&gt;
是 Kubernetes 提供的一种传统特性，可以将你的工作负载 Pod 暴露给外部世界，方便外部用户使用。
Kubernetes 用户可以用与实现无关的方式来定义应用如何在网络上可用。
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/ingress-controllers/&#34;&gt;Ingress 控制器&lt;/a&gt;会根据定义，
配置所需的本地资源或云端资源，以满足用户的特定场景和需求。&lt;/p&gt;
&lt;!--
Many different ingress controllers are available, to suit users of different cloud providers or brands of load balancers. Ingress-nginx is a software-only ingress controller provided by the Kubernetes project. Because of its versatility and ease of use, ingress-nginx is quite popular: it is deployed in over 40% of Kubernetes clusters\!

Ingress-nginx translates the requirements from Ingress objects into configuration for nginx, a powerful open source webserver daemon. Then, nginx uses that configuration to accept and route requests to the various applications running within a Kubernetes cluster. Proper handling of these nginx configuration parameters is crucial, because ingress-nginx needs to allow users significant flexibility while preventing them from accidentally or intentionally tricking nginx into doing things it shouldn’t.
--&gt;
&lt;p&gt;为了满足不同云厂商用户或负载均衡器产品的需求，目前有许多不同类型的 Ingress 控制器。
ingress-nginx 是 Kubernetes 项目提供的纯软件的 Ingress 控制器。
ingress-nginx 由于灵活易用，非常受用户欢迎。它已经被部署在超过 40% 的 Kubernetes 集群中！&lt;/p&gt;
&lt;p&gt;ingress-nginx 会将 Ingress 对象中的要求转换为 Nginx（一个强大的开源 Web 服务器守护进程）的配置。
Nginx 使用这些配置接受请求并将其路由到 Kubernetes 集群中运行的不同应用。
正确处理这些 Nginx 配置参数至关重要，因为 ingress-nginx 既要给予用户足够的灵活性，
又要防止用户无意或有意诱使 Nginx 执行其不应执行的操作。&lt;/p&gt;
&lt;!--
## Vulnerabilities Patched Today

Four of today’s ingress-nginx vulnerabilities are improvements to how ingress-nginx handles particular bits of nginx config. Without these fixes, a specially-crafted Ingress object can cause nginx to misbehave in various ways, including revealing the values of [Secrets](/docs/concepts/configuration/secret/) that are accessible to ingress-nginx. By default, ingress-nginx has access to all Secrets cluster-wide, so this can often lead to complete cluster takeover by any user or entity that has permission to create an Ingress.
--&gt;
&lt;h2 id=&#34;vulnerabilities-patched-today&#34;&gt;今日修复的漏洞   &lt;/h2&gt;
&lt;p&gt;今天修复的四个 ingress-nginx 漏洞都是对 ingress-nginx 如何处理特定 Nginx 配置细节的改进。
如果不打这些修复补丁，一个精心构造的 Ingress 资源对象就可以让 Nginx 出现异常行为，
包括泄露 ingress-nginx 可访问的 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/configuration/secret/&#34;&gt;Secret&lt;/a&gt;
的值。默认情况下，ingress-nginx 可以访问集群范围内的所有 Secret，因此这往往会导致任一有权限创建
Ingress 的用户或实体接管整个集群。&lt;/p&gt;
&lt;!--
The most serious of today’s vulnerabilities, [CVE-2025-1974](https://github.com/kubernetes/kubernetes/issues/131009), rated [9.8 CVSS](https://www.first.org/cvss/calculator/3-1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H), allows anything on the Pod network to exploit configuration injection vulnerabilities via the Validating Admission Controller feature of ingress-nginx. This makes such vulnerabilities far more dangerous: ordinarily one would need to be able to create an Ingress object in the cluster, which is a fairly privileged action. When combined with today’s other vulnerabilities, **CVE-2025-1974 means that anything on the Pod network has a good chance of taking over your Kubernetes cluster, with no credentials or administrative access required**. In many common scenarios, the Pod network is accessible to all workloads in your cloud VPC, or even anyone connected to your corporate network\! This is a very serious situation.
--&gt;
&lt;p&gt;本次最严重的漏洞是 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131009&#34;&gt;CVE-2025-1974&lt;/a&gt;，
CVSS 评分高达 &lt;a href=&#34;https://www.first.org/cvss/calculator/3-1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H&#34;&gt;9.8&lt;/a&gt;，
它允许 Pod 网络中的任意实体通过 ingress-nginx 的验证性准入控制器特性滥用配置注入漏洞。
这种机制使得这些漏洞会产生更危险的情形：攻击者通常需要能够在集群中创建 Ingress 对象（这是一种较高权限的操作）。
当结合使用今天修复的其他漏洞（比如 CVE-2025-1974），
&lt;strong&gt;就意味着 Pod 网络中的任何实体都有极大可能接管你的 Kubernetes 集群，而不需要任何凭证或管理权限&lt;/strong&gt;。
在许多常见场景下，Pod 网络可以访问云端 VPC 中的所有工作负载，甚至能访问连接到你公司内网的任何人的机器！
这是一个非常严重的安全风险。&lt;/p&gt;
&lt;!--
Today, we have [released ingress-nginx v1.12.1 and v1.11.5](https://github.com/kubernetes/ingress-nginx/releases), which have fixes for all five of these vulnerabilities.

## Your next steps

First, determine if your clusters are using ingress-nginx. In most cases, you can check this by running `kubectl get pods --all-namespaces --selector app.kubernetes.io/name=ingress-nginx` with cluster administrator permissions.
--&gt;
&lt;p&gt;我们今天已经&lt;a href=&#34;https://github.com/kubernetes/ingress-nginx/releases&#34;&gt;发布了 ingress-nginx v1.12.1 和 v1.11.5&lt;/a&gt;，
这两个版本修复了所有这 5 个漏洞。&lt;/p&gt;
&lt;h2 id=&#34;your-next-steps&#34;&gt;你需要做什么  &lt;/h2&gt;
&lt;p&gt;首先，确定你的集群是否在使用 ingress-nginx。大多数情况下，你可以使用集群管理员权限运行以下命令进行检查：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pods --all-namespaces --selector app.kubernetes.io/name&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;ingress-nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
**If you are using ingress-nginx, make a plan to remediate these vulnerabilities immediately.**

**The best and easiest remedy is to [upgrade to the new patch release of ingress-nginx](https://kubernetes.github.io/ingress-nginx/deploy/upgrade/).** All five of today’s vulnerabilities are fixed by installing today’s patches.

If you can’t upgrade right away, you can significantly reduce your risk by turning off the Validating Admission Controller feature of ingress-nginx.
--&gt;
&lt;p&gt;&lt;strong&gt;如果你在使用 ingress-nginx，请立即针对这些漏洞制定补救计划。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;最简单且推荐的补救方案是&lt;a href=&#34;https://kubernetes.github.io/ingress-nginx/deploy/upgrade/&#34;&gt;立即升级到最新补丁版本&lt;/a&gt;。&lt;/strong&gt;
安装今天的补丁，就能修复所有这 5 个漏洞。&lt;/p&gt;
&lt;p&gt;如果你暂时无法升级，可以通过关闭 ingress-nginx 的验证性准入控制器特性来显著降低风险。&lt;/p&gt;
&lt;!--
* If you have installed ingress-nginx using Helm  
  * Reinstall, setting the Helm value `controller.admissionWebhooks.enabled=false`  
* If you have installed ingress-nginx manually  
  * delete the ValidatingWebhookconfiguration called `ingress-nginx-admission`  
  * edit the `ingress-nginx-controller` Deployment or Daemonset, removing `--validating-webhook` from the controller container’s argument list
--&gt;
&lt;ul&gt;
&lt;li&gt;如果你使用 Helm 安装了 ingress-nginx
&lt;ul&gt;
&lt;li&gt;重新安装，设置 Helm 参数 &lt;code&gt;controller.admissionWebhooks.enabled=false&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;如果你是手动安装的
&lt;ul&gt;
&lt;li&gt;删除名为 &lt;code&gt;ingress-nginx-admission&lt;/code&gt; 的 ValidatingWebhookConfiguration&lt;/li&gt;
&lt;li&gt;编辑 &lt;code&gt;ingress-nginx-controller&lt;/code&gt; Deployment 或 DaemonSet，从控制器容器的参数列表中移除 &lt;code&gt;--validating-webhook&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
If you turn off the Validating Admission Controller feature as a mitigation for CVE-2025-1974, remember to turn it back on after you upgrade. This feature provides important quality of life improvements for your users, warning them about incorrect Ingress configurations before they can take effect.
--&gt;
&lt;p&gt;如果你为了缓解 CVE-2025-1974 造成的风险而关闭了验证性准入控制器特性，
请在升级完成后记得重新开启此特性。这个特性可以为你的用户提供重要的生命期帮助，
可以在错误的 Ingress 配置在生效之前及时提醒用户。&lt;/p&gt;
&lt;!--
## Conclusion, thanks, and further reading

The ingress-nginx vulnerabilities announced today, including CVE-2025-1974, present a serious risk to many Kubernetes users and their data. If you use ingress-nginx, you should take action immediately to keep yourself safe.

Thanks go out to Nir Ohfeld, Sagi Tzadik, Ronen Shustin, and Hillai Ben-Sasson from Wiz for responsibly disclosing these vulnerabilities, and for working with the Kubernetes SRC members and ingress-nginx maintainers (Marco Ebert and James Strong) to ensure we fixed them effectively.
--&gt;
&lt;h2 id=&#34;conclusion-thanks-and-further-reading&#34;&gt;总结、致谢与更多参考  &lt;/h2&gt;
&lt;p&gt;今天公布的包括 CVE-2025-1974 在内的 ingress-nginx 漏洞对许多 Kubernetes 用户及其数据构成了严重风险。
如果你正在使用 ingress-nginx，请立即采取行动确保自身安全。&lt;/p&gt;
&lt;p&gt;我们要感谢来自 Wiz 的 Nir Ohfeld、Sagi Tzadik、Ronen Shustin 和 Hillai Ben-Sasson，
他们负责任地披露了这些漏洞，并与 Kubernetes 安全响应委员会成员以及 ingress-nginx
维护者（Marco Ebert 和 James Strong）协同合作，确保这些漏洞被有效修复。&lt;/p&gt;
&lt;!--
For further information about the maintenance and future of ingress-nginx, please see this [GitHub issue](https://github.com/kubernetes/ingress-nginx/issues/13002) and/or attend [James and Marco’s KubeCon/CloudNativeCon EU 2025 presentation](https://kccnceu2025.sched.com/event/1tcyc/).

For further information about the specific vulnerabilities discussed in this article, please see the appropriate GitHub issue: [CVE-2025-24513](https://github.com/kubernetes/kubernetes/issues/131005), [CVE-2025-24514](https://github.com/kubernetes/kubernetes/issues/131006), [CVE-2025-1097](https://github.com/kubernetes/kubernetes/issues/131007), [CVE-2025-1098](https://github.com/kubernetes/kubernetes/issues/131008), or [CVE-2025-1974](https://github.com/kubernetes/kubernetes/issues/131009)
--&gt;
&lt;p&gt;有关 ingress-nginx 的维护和未来的更多信息，
请参阅&lt;a href=&#34;https://github.com/kubernetes/ingress-nginx/issues/13002&#34;&gt;这个 GitHub Issue&lt;/a&gt;，
或参与 &lt;a href=&#34;https://kccnceu2025.sched.com/event/1tcyc/&#34;&gt;James 和 Marco 在 KubeCon/CloudNativeCon EU 2025 的演讲&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;关于本文中提到的具体漏洞的信息，请参阅以下 GitHub Issue：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131005&#34;&gt;CVE-2025-24513&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131006&#34;&gt;CVE-2025-24514&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131007&#34;&gt;CVE-2025-1097&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131008&#34;&gt;CVE-2025-1098&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/131009&#34;&gt;CVE-2025-1974&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>JobSet 介绍</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/23/introducing-jobset/</link>
      <pubDate>Sun, 23 Mar 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/23/introducing-jobset/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Introducing JobSet&#34;
date: 2025-03-23
slug: introducing-jobset

**Authors**: Daniel Vega-Myhre (Google), Abdullah Gharaibeh (Google), Kevin Hannon (Red Hat)
--&gt;
&lt;!--
In this article, we introduce [JobSet](https://jobset.sigs.k8s.io/), an open source API for
representing distributed jobs. The goal of JobSet is to provide a unified API for distributed ML
training and HPC workloads on Kubernetes.
--&gt;
&lt;p&gt;在本文中，我们介绍 &lt;a href=&#34;https://jobset.sigs.k8s.io/&#34;&gt;JobSet&lt;/a&gt;，这是一个用于表示分布式任务的开源 API。
JobSet 的目标是为 Kubernetes 上的分布式机器学习训练和高性能计算（HPC）工作负载提供统一的 API。&lt;/p&gt;
&lt;!--
## Why JobSet?

The Kubernetes community’s recent enhancements to the batch ecosystem on Kubernetes has attracted ML
engineers who have found it to be a natural fit for the requirements of running distributed training
workloads. 

Large ML models (particularly LLMs) which cannot fit into the memory of the GPU or TPU chips on a
single host are often distributed across tens of thousands of accelerator chips, which in turn may
span thousands of hosts.
--&gt;
&lt;h2 id=&#34;why-jobset&#34;&gt;为什么需要 JobSet？  &lt;/h2&gt;
&lt;p&gt;Kubernetes 社区近期对 Kubernetes 批处理生态系统的增强，吸引了许多机器学习工程师，
他们发现这非常符合运行分布式训练工作负载的需求。&lt;/p&gt;
&lt;p&gt;单个主机上的 GPU 或 TPU 芯片通常无法满足大型机器学习模型（尤其是大语言模型，LLM）的内存需求，
因此往往会被分布到成千上万的加速器芯片上，而这些芯片可能跨越数千个主机。&lt;/p&gt;
&lt;!--
As such, the model training code is often containerized and executed simultaneously on all these
hosts, performing distributed computations which often shard both the model parameters and/or the
training dataset across the target accelerator chips, using communication collective primitives like
all-gather and all-reduce to perform distributed computations and synchronize gradients between
hosts. 

These workload characteristics make Kubernetes a great fit for this type of workload, as efficiently
scheduling and managing the lifecycle of containerized applications across a cluster of compute
resources is an area where it shines. 
--&gt;
&lt;p&gt;因此，模型训练代码通常会被容器化，并在所有这些主机上同时执行，进行分布式计算。
这些计算通常会将模型参数和/或训练数据集拆分到目标加速器芯片上，并使用如
all-gather 和 all-reduce 等通信集合原语来进行分布式计算以及在主机之间同步梯度。&lt;/p&gt;
&lt;p&gt;这些工作负载的特性使得 Kubernetes 非常适合此类任务，
因为高效地调度和管理跨计算资源集群的容器化应用生命周期是 Kubernetes 的强项。&lt;/p&gt;
&lt;!--
It is also very extensible, allowing developers to define their own Kubernetes APIs, objects, and
controllers which manage the behavior and life cycle of these objects, allowing engineers to develop
custom distributed training orchestration solutions to fit their needs.

However, as distributed ML training techniques continue to evolve, existing Kubernetes primitives do
not adequately model them alone anymore.
--&gt;
&lt;p&gt;Kubernetes 还具有很强的可扩展性，允许开发者定义自己的 Kubernetes API、
对象以及管理这些对象行为和生命周期的控制器，
从而让工程师能够开发定制化的分布式训练编排解决方案以满足特定需求。&lt;/p&gt;
&lt;p&gt;然而，随着分布式机器学习训练技术的不断发展，现有的 Kubernetes
原语已经无法单独充分描述这些新技术。&lt;/p&gt;
&lt;!--
Furthermore, the landscape of Kubernetes distributed training orchestration APIs has become
fragmented, and each of the existing solutions in this fragmented landscape has certain limitations
that make it non-optimal for distributed ML training. 

For example, the KubeFlow training operator defines custom APIs for different frameworks (e.g.
PyTorchJob, TFJob, MPIJob, etc.); however, each of these job types are in fact a solution fit
specifically to the target framework, each with different semantics and behavior.
--&gt;
&lt;p&gt;此外，Kubernetes 分布式训练编排 API 的领域已经变得支离破碎，
而这个碎片化的领域中每个现有的解决方案都存在某些限制，
使得它们在分布式机器学习训练方面并非最优选择。&lt;/p&gt;
&lt;p&gt;例如，KubeFlow 训练 Operator 为不同的框架定义了自定义 API（例如 PyTorchJob、TFJob、MPIJob 等）。
然而，这些作业类型实际上分别是针对特定框架量身定制的解决方案，各自具有不同的语义和行为。&lt;/p&gt;
&lt;!--
On the other hand, the Job API fixed many gaps for running batch workloads, including Indexed
completion mode, higher scalability, Pod failure policies and Pod backoff policy to mention a few of
the most recent enhancements. However, running ML training and HPC workloads using the upstream Job
API requires extra orchestration to fill the following gaps:

Multi-template Pods : Most HPC or ML training jobs include more than one type of Pods. The different
Pods are part of the same workload, but they need to run a different container, request different
resources or have different failure policies. A common example is the driver-worker pattern.
--&gt;
&lt;p&gt;另一方面，Job API 弥补了运行批处理工作负载的许多空白，包括带索引的完成模式（Indexed Completion Mode）、
更高的可扩展性、Pod 失效策略和 Pod 回退策略等，这些都是最近的一些重要增强功能。然而，使用上游
Job API 运行机器学习训练和高性能计算（HPC）工作负载时，需要额外的编排来填补以下空白：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;多模板 Pod：大多数 HPC 或机器学习训练任务包含多种类型的 Pod。这些不同的 Pod 属于同一工作负载，
但它们需要运行不同的容器、请求不同的资源或具有不同的失效策略。
一个常见的例子是驱动器-工作节点（driver-worker）模式。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Job groups : Large scale training workloads span multiple network topologies, running across
multiple racks for example. Such workloads are network latency sensitive, and aim to localize
communication and minimize traffic crossing the higher-latency network links. To facilitate this,
the workload needs to be split into groups of Pods each assigned to a network topology.

Inter-Pod communication : Create and manage the resources (e.g. [headless
Services](/docs/concepts/services-networking/service/#headless-services)) necessary to establish
communication between the Pods of a job.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;任务组：大规模训练工作负载跨越多个网络拓扑，例如在多个机架之间运行。
这类工作负载对网络延迟非常敏感，目标是将通信本地化并尽量减少跨越高延迟网络链路的流量。
为此，需要将工作负载拆分为 Pod 组，每组分配到一个网络拓扑。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pod 间通信：创建和管理建立作业中 Pod 之间通信所需的资源
（例如&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/service/#headless-services&#34;&gt;无头服务&lt;/a&gt;）。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Startup sequencing : Some jobs require a specific start sequence of pods; sometimes the driver is
expected to start first (like Ray or Spark), in other cases the workers are expected to be ready
before starting the driver (like MPI).

JobSet aims to address those gaps using the Job API as a building block to build a richer API for
large-scale distributed HPC and ML use cases.
--&gt;
&lt;ul&gt;
&lt;li&gt;启动顺序：某些任务需要特定的 Pod 启动顺序；有时需要驱动（driver）首先启动（例如 Ray 或 Spark），
而有时，人们期望多个工作节点（worker）在驱动启动之前就绪（例如 MPI）。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;JobSet 旨在以 Job API 为基础，填补这些空白，构建一个更丰富的 API，
以支持大规模分布式 HPC 和 ML 使用场景。&lt;/p&gt;
&lt;!--
## How JobSet Works
JobSet models a distributed batch workload as a group of Kubernetes Jobs. This allows a user to
easily specify different pod templates for different distinct groups of pods (e.g. a leader,
workers, parameter servers, etc.). 

It uses the abstraction of a ReplicatedJob to manage child Jobs, where a ReplicatedJob is
essentially a Job Template with some desired number of Job replicas specified. This provides a
declarative way to easily create identical child-jobs to run on different islands of accelerators,
without resorting to scripting or Helm charts to generate many versions of the same job but with
different names.
--&gt;
&lt;h2 id=&#34;how-jobset-works&#34;&gt;JobSet 的工作原理  &lt;/h2&gt;
&lt;p&gt;JobSet 将分布式批处理工作负载建模为一组 Kubernetes Job。
这使得用户可以轻松为不同的 Pod 组（例如领导者 Pod、工作节点 Pod、参数服务器 Pod 等）
指定不同的 Pod 模板。&lt;/p&gt;
&lt;p&gt;它通过抽象概念 ReplicatedJob 来管理子 Job，其中 ReplicatedJob 本质上是一个带有指定副本数量的
Job 模板。这种方式提供了一种声明式的手段，能够轻松创建相同的子 Job，使其在不同的加速器集群上运行，
而无需借助脚本或 Helm Chart 来生成具有不同名称的多个相同任务版本。&lt;/p&gt;
&lt;!--


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/23/introducing-jobset/jobset_diagram.svg&#34;
         alt=&#34;JobSet Architecture&#34;/&gt; 
&lt;/figure&gt;

Some other key JobSet features which address the problems described above include:

Replicated Jobs : In modern data centers, hardware accelerators like GPUs and TPUs allocated in
islands of homogenous accelerators connected via a specialized, high bandwidth network links. For
example, a user might provision nodes containing a group of hosts co-located on a rack, each with
H100 GPUs, where GPU chips within each host are connected via NVLink, with a NVLink Switch
connecting the multiple NVLinks. TPU Pods are another example of this: TPU ViperLitePods consist of
64 hosts, each with 4 TPU v5e chips attached, all connected via ICI mesh. When running a distributed
training job across multiple of these islands, we often want to partition the workload into a group
of smaller identical jobs, 1 per island, where each pod primarily communicates with the pods within
the same island to do segments of distributed computation, and keeping the gradient synchronization
over DCN (data center network, which is lower bandwidth than ICI) to a bare minimum. 
--&gt;


&lt;figure class=&#34;diagram-large clickable-zoom&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/23/introducing-jobset/jobset_diagram.svg&#34;
         alt=&#34;JobSet 架构&#34;/&gt; 
&lt;/figure&gt;
&lt;p&gt;解决上述问题的其他一些关键 JobSet 特性包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;任务副本（Replicated Jobs）&lt;/strong&gt;：在现代数据中心中，硬件加速器（如 GPU 和 TPU）通常以同质加速器岛的形式分配，
并通过专用的高带宽网络链路连接。例如，用户可能会配置包含一组主机的节点，这些主机位于同一机架内，
每个主机都配备了 H100 GPU，主机内的 GPU 芯片通过 NVLink 连接，并通过 NVLink 交换机连接多个 NVLink。
TPU Pod 是另一个例子：TPU ViperLitePods 包含 64 个主机，每个主机连接了 4 个 TPU v5e 芯片，
所有芯片通过 ICI 网格连接。在跨多个这样的加速器岛运行分布式训练任务时，我们通常希望将工作负载划分为一组较小的相同任务，
每个岛一个任务，其中每个 Pod 主要与同一岛内的其他 Pod 通信以完成分布式计算的部分段，
并将梯度同步通过数据中心网络（DCN，其带宽低于 ICI）降到最低。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Automatic headless service creation, configuration, and lifecycle management : Pod-to-pod
communication via pod hostname is enabled by default, with automatic configuration and lifecycle
management of the headless service enabling this. 

Configurable success policies : JobSet has configurable success policies which target specific
ReplicatedJobs, with operators to target “Any” or “All” of their child jobs. For example, you can
configure the JobSet to be marked complete if and only if all pods that are part of the “worker”
ReplicatedJob are completed.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;自动创建、配置无头服务并管理其生命周期&lt;/strong&gt;：默认情况下，启用通过 Pod 主机名来完成
Pod 到 Pod 的通信，并通过无头服务的自动配置和生命周期管理来支持这一功能。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;可配置的成功策略&lt;/strong&gt;：JobSet 提供了可配置的成功策略，这些策略针对特定的 ReplicatedJob，
并可通过操作符指定 &amp;quot;Any&amp;quot; 或 &amp;quot;All&amp;quot; 子任务。例如，你可以将 JobSet 配置为仅在属于 &amp;quot;worker&amp;quot;
ReplicatedJob 的所有 Pod 完成时才标记为完成。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Configurable failure policies : JobSet has configurable failure policies which allow the user to
specify a maximum number of times the JobSet should be restarted in the event of a failure. If any
job is marked failed, the entire JobSet will be recreated, allowing the workload to resume from the
last checkpoint. When no failure policy is specified, if any job fails, the JobSet simply fails. 
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;可配置的失效策略&lt;/strong&gt;：JobSet 提供了可配置的失效策略，允许用户指定在发生故障时
JobSet 应重启的最大次数。如果任何任务被标记为失败，整个 JobSet 将会被重新创建，
从而使工作负载可以从最后一个检查点恢复。当未指定失效策略时，如果任何任务失败，
JobSet 会直接标记为失败。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Exclusive placement per topology domain : JobSet allows users to express that child jobs have 1:1
exclusive assignment to a topology domain, typically an accelerator island like a rack. For example,
if the JobSet creates two child jobs, then this feature will enforce that the pods of each child job
will be co-located on the same island, and that only one child job is allowed to schedule per
island. This is useful for scenarios where we want to use a distributed data parallel (DDP) training
strategy to train a model using multiple islands of compute resources (GPU racks or TPU slices),
running 1 model replica in each accelerator island, ensuring the forward and backward passes
themselves occur within a single model replica occurs over the high bandwidth interconnect linking
the accelerators chips within the island, and only the gradient synchronization between model
replicas occurs across accelerator islands over the lower bandwidth data center network.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;按拓扑域的独占放置&lt;/strong&gt;：JobSet 允许用户指定子任务与拓扑域（通常是加速器岛，例如机架）
之间的一对一独占分配关系。例如，如果 JobSet 创建了两个子任务，
此功能将确保每个子任务的 Pod 位于同一个加速器岛内，并且每个岛只允许调度一个子任务。
这在我们希望使用分布式数据并行（DDP）训练策略的情况下非常有用，
例如利用多个计算资源岛（GPU 机架或 TPU 切片）训练模型，在每个加速器岛内运行一个模型副本，
确保前向和反向传播过程通过岛内加速器芯片之间的高带宽互联完成，
而模型副本之间的梯度同步则通过低带宽的数据中心网络在加速器岛之间进行。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Integration with Kueue : Users can submit JobSets via [Kueue](https://kueue.sigs.k8s.io/) to
oversubscribe their clusters, queue workloads to run as capacity becomes available, prevent partial
scheduling and deadlocks, enable multi-tenancy, and more.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;与 Kueue 集成&lt;/strong&gt;：用户可以通过 &lt;a href=&#34;https://kueue.sigs.k8s.io/&#34;&gt;Kueue&lt;/a&gt;
提交 JobSet，以实现集群的超额订阅、将工作负载排队等待容量可用时运行、
防止部分调度和死锁、支持多租户等更多功能。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Example use case

### Distributed ML training on multiple TPU slices with Jax

The following example is a JobSet spec for running a TPU Multislice workload on 4 TPU v5e
[slices](https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#slices). To learn more about
TPU concepts and terminology, please refer to these
[docs](https://cloud.google.com/tpu/docs/system-architecture-tpu-vm).
--&gt;
&lt;h2 id=&#34;example-use-case&#34;&gt;示例用例  &lt;/h2&gt;
&lt;h3 id=&#34;使用-jax-在多个-tpu-切片上进行分布式-ml-训练&#34;&gt;使用 Jax 在多个 TPU 切片上进行分布式 ML 训练&lt;/h3&gt;
&lt;p&gt;以下示例展示了一个 JobSet 规范，用于在 4 个 TPU v5e
&lt;a href=&#34;https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#slices&#34;&gt;切片&lt;/a&gt;上运行
TPU 多切片工作负载。若想了解更多关于 TPU 的概念和术语，
请参考这些&lt;a href=&#34;https://cloud.google.com/tpu/docs/system-architecture-tpu-vm&#34;&gt;文档&lt;/a&gt;。&lt;/p&gt;
&lt;!--
This example uses [Jax](https://jax.readthedocs.io/en/latest/quickstart.html), an ML framework with
native support for Just-In-Time (JIT) compilation targeting TPU chips via
[OpenXLA](https://github.com/openxla). However, you can also use
[PyTorch/XLA](https://pytorch.org/xla/release/2.3/index.html) to do ML training on TPUs.

This example makes use of several JobSet features (both explicitly and implicitly) to support the
unique scheduling requirements of TPU multislice training out-of-the-box with very little
configuration required by the user.
--&gt;
&lt;p&gt;此示例使用了 &lt;a href=&#34;https://jax.readthedocs.io/en/latest/quickstart.html&#34;&gt;Jax&lt;/a&gt;，
这是一个通过 &lt;a href=&#34;https://github.com/openxla&#34;&gt;OpenXLA&lt;/a&gt; 提供对 TPU 芯片即时（JIT）
编译原生支持的机器学习框架。不过，你也可以使用 &lt;a href=&#34;https://pytorch.org/xla/release/2.3/index.html&#34;&gt;PyTorch/XLA&lt;/a&gt;
在 TPUs 上进行机器学习训练。&lt;/p&gt;
&lt;p&gt;此示例利用了 JobSet 的多个功能（无论是显式还是隐式），以开箱即用地支持 TPU
多切片训练的独特调度需求，而用户需要的配置非常少。&lt;/p&gt;
&lt;!--
```yaml
# Run a simple Jax workload on 
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
  name: multislice
  annotations:
    # Give each child Job exclusive usage of a TPU slice 
    alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool
spec:
  failurePolicy:
    maxRestarts: 3
  replicatedJobs:
  - name: workers
    replicas: 4 # Set to number of TPU slices
    template:
      spec:
        parallelism: 2 # Set to number of VMs per TPU slice
        completions: 2 # Set to number of VMs per TPU slice
        backoffLimit: 0
        template:
          spec:
            hostNetwork: true
            dnsPolicy: ClusterFirstWithHostNet
            nodeSelector:
              cloud.google.com/gke-tpu-accelerator: tpu-v5-lite-podslice
              cloud.google.com/gke-tpu-topology: 2x4
            containers:
            - name: jax-tpu
              image: python:3.8
              ports:
              - containerPort: 8471
              - containerPort: 8080
              securityContext:
                privileged: true
              command:
              - bash
              - -c
              - |
                pip install &#34;jax[tpu]&#34; -f https://storage.googleapis.com/jax-releases/libtpu_releases.html
                python -c &#39;import jax; print(&#34;Global device count:&#34;, jax.device_count())&#39;
                sleep 60
              resources:
                limits:
                  google.com/tpu: 4
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 运行简单的 Jax 工作负载&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;jobset.x-k8s.io/v1alpha2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;JobSet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;multislice&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;annotations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 为每个子任务提供 TPU 切片的独占使用权&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;alpha.jobset.sigs.k8s.io/exclusive-topology&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud.google.com/gke-nodepool&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;failurePolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;maxRestarts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;replicatedJobs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;workers&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;replicas&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 设置为 TPU 切片的数量&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parallelism&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 设置为每个 TPU 切片的虚拟机数量&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 设置为每个 TPU 切片的虚拟机数量&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backoffLimit&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostNetwork&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;dnsPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ClusterFirstWithHostNet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;nodeSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cloud.google.com/gke-tpu-accelerator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tpu-v5-lite-podslice&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cloud.google.com/gke-tpu-topology&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;2x4&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;jax-tpu&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;python:3.8&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;ports&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8471&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8080&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;securityContext&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;privileged&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- bash&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;- |&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;                pip install &amp;#34;jax[tpu]&amp;#34; -f https://storage.googleapis.com/jax-releases/libtpu_releases.html
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;                python -c &amp;#39;import jax; print(&amp;#34;Global device count:&amp;#34;, jax.device_count())&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;                sleep 60&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;limits&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;google.com/tpu&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Future work and getting involved
We have a number of features on the JobSet roadmap planned for development this year, which can be
found in the [JobSet roadmap](https://github.com/kubernetes-sigs/jobset?tab=readme-ov-file#roadmap).

Please feel free to reach out with feedback of any kind. We’re also open to additional contributors,
whether it is to fix or report bugs, or help add new features or write documentation. 
--&gt;
&lt;h2 id=&#34;furture-work-and-getting-involved&#34;&gt;未来工作与参与方式  &lt;/h2&gt;
&lt;p&gt;我们今年的 JobSet 路线图中计划开发多项功能，具体内容可以在
&lt;a href=&#34;https://github.com/kubernetes-sigs/jobset?tab=readme-ov-file#roadmap&#34;&gt;JobSet 路线图&lt;/a&gt;中找到。&lt;/p&gt;
&lt;p&gt;欢迎你随时提供任何形式的反馈。我们也欢迎更多贡献者加入，无论是修复或报告问题、
帮助添加新功能，还是撰写文档，都非常欢迎。&lt;/p&gt;
&lt;!--
You can get in touch with us via our [repo](http://sigs.k8s.io/jobset), [mailing
list](https://groups.google.com/a/kubernetes.io/g/wg-batch) or on
[Slack](https://kubernetes.slack.com/messages/wg-batch).

Last but not least, thanks to all [our
contributors](https://github.com/kubernetes-sigs/jobset/graphs/contributors) who made this project
possible!
--&gt;
&lt;p&gt;你可以通过我们的&lt;a href=&#34;http://sigs.k8s.io/jobset&#34;&gt;代码仓库&lt;/a&gt;、
&lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/wg-batch&#34;&gt;邮件列表&lt;/a&gt;或者在
&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-batch&#34;&gt;Slack&lt;/a&gt; 上与我们联系。&lt;/p&gt;
&lt;p&gt;最后但同样重要的是，感谢所有&lt;a href=&#34;https://github.com/kubernetes-sigs/jobset/graphs/contributors&#34;&gt;贡献者&lt;/a&gt;，
是你们让这个项目成为可能！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>聚焦 SIG Apps</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/12/sig-apps-spotlight-2025/</link>
      <pubDate>Wed, 12 Mar 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/03/12/sig-apps-spotlight-2025/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Apps&#34;
slug: sig-apps-spotlight-2025
canonicalUrl: https://www.kubernetes.dev/blog/2025/03/12/sig-apps-spotlight-2025
date: 2025-03-12
author: &#34;Sandipan Panda (DevZero)&#34;
--&gt;
&lt;!--
In our ongoing SIG Spotlight series, we dive into the heart of the Kubernetes project by talking to
the leaders of its various Special Interest Groups (SIGs). This time, we focus on 
**[SIG Apps](https://github.com/kubernetes/community/tree/master/sig-apps#apps-special-interest-group)**,
the group responsible for everything related to developing, deploying, and operating applications on
Kubernetes. [Sandipan Panda](https://www.linkedin.com/in/sandipanpanda)
([DevZero](https://www.devzero.io/)) had the opportunity to interview [Maciej
Szulik](https://github.com/soltysh) ([Defense Unicorns](https://defenseunicorns.com/)) and [Janet
Kuo](https://github.com/janetkuo) ([Google](https://about.google/)), the chairs and tech leads of
SIG Apps. They shared their experiences, challenges, and visions for the future of application
management within the Kubernetes ecosystem.
--&gt;
&lt;p&gt;在我们正在进行的 SIG 聚焦系列中，我们通过与 Kubernetes 项目各个特别兴趣小组（SIG）的领导者对话，
深入探讨 Kubernetes 项目的核心。这一次，我们聚焦于
&lt;strong&gt;&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps#apps-special-interest-group&#34;&gt;SIG Apps&lt;/a&gt;&lt;/strong&gt;，
这个小组负责 Kubernetes 上与应用程序开发、部署和操作相关的所有内容。
&lt;a href=&#34;https://www.linkedin.com/in/sandipanpanda&#34;&gt;Sandipan Panda&lt;/a&gt;（[DevZero](&lt;a href=&#34;https://www.devzero.io/&#34;&gt;https://www.devzero.io/&lt;/a&gt;））
有机会采访了 SIG Apps 的主席和技术负责人
&lt;a href=&#34;https://github.com/soltysh&#34;&gt;Maciej Szulik&lt;/a&gt;（&lt;a href=&#34;https://defenseunicorns.com/&#34;&gt;Defense Unicorns&lt;/a&gt;）
以及 &lt;a href=&#34;https://github.com/janetkuo&#34;&gt;Janet Kuo&lt;/a&gt;（&lt;a href=&#34;https://about.google/&#34;&gt;Google&lt;/a&gt;）。
他们分享了在 Kubernetes 生态系统中关于应用管理的经验、挑战以及未来愿景。&lt;/p&gt;
&lt;!--
## Introductions

**Sandipan: Hello, could you start by telling us a bit about yourself, your role, and your journey
within the Kubernetes community that led to your current roles in SIG Apps?**

**Maciej**: Hey, my name is Maciej, and I’m one of the leads for SIG Apps. Aside from this role, you
can also find me helping
[SIG CLI](https://github.com/kubernetes/community/tree/master/sig-cli#readme) and also being one of
the Steering Committee members. I’ve been contributing to Kubernetes since late 2014 in various
areas, including controllers, apiserver, and kubectl.
--&gt;
&lt;h2 id=&#34;自我介绍&#34;&gt;自我介绍&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：你好，能否先简单介绍一下你自己、你的角色，以及你在
Kubernetes 社区中的经历，这些经历是如何引导你担任 SIG Apps 的当前角色的？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：嗨，我叫 Maciej，是 SIG Apps 的负责人之一。除了这个角色，
你还可以看到我在协助 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cli#readme&#34;&gt;SIG CLI&lt;/a&gt;
的工作，同时我也是指导委员会的成员之一。自 2014 年底以来，我一直为
Kubernetes 做出贡献，涉及的领域包括控制器、API 服务器以及 kubectl。&lt;/p&gt;
&lt;!--
**Janet**: Certainly! I&#39;m Janet, a Staff Software Engineer at Google, and I&#39;ve been deeply involved
with the Kubernetes project since its early days, even before the 1.0 launch in 2015.  It&#39;s been an
amazing journey!

My current role within the Kubernetes community is one of the chairs and tech leads of SIG Apps. My
journey with SIG Apps started organically. I started with building the Deployment API and adding
rolling update functionalities. I naturally gravitated towards SIG Apps and became increasingly
involved. Over time, I took on more responsibilities, culminating in my current leadership roles.
--&gt;
&lt;p&gt;&lt;strong&gt;Janet&lt;/strong&gt;：当然可以！我是 Janet，在 Google 担任资深软件工程师，
并且从 Kubernetes 项目早期（甚至在 2015 年 1.0 版本发布之前）就深度参与其中。
这是一段非常精彩的旅程！&lt;/p&gt;
&lt;p&gt;我在 Kubernetes 社区中的当前角色是 SIG Apps 的主席之一和技术负责人之一。
我与 SIG Apps 的结缘始于自然而然的过程。最初，我从构建 Deployment API
并添加滚动更新功能开始，逐渐对 SIG Apps 产生了浓厚的兴趣，并且参与度越来越高。
随着时间推移，我承担了更多的责任，最终走到了目前的领导岗位。&lt;/p&gt;
&lt;!--
## About SIG Apps

*All following answers were jointly provided by Maciej and Janet.*

**Sandipan: For those unfamiliar, could you provide an overview of SIG Apps&#39; mission and objectives?
What key problems does it aim to solve within the Kubernetes ecosystem?**
--&gt;
&lt;h2 id=&#34;关于-sig-apps&#34;&gt;关于 SIG Apps&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;以下所有回答均由 Maciej 和 Janet 共同提供。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：对于那些不熟悉的人，能否简要介绍一下 SIG Apps 的使命和目标？
它在 Kubernetes 生态系统中旨在解决哪些关键问题？&lt;/p&gt;
&lt;!--
As described in our
[charter](https://github.com/kubernetes/community/blob/master/sig-apps/charter.md#scope), we cover a
broad area related to developing, deploying, and operating applications on Kubernetes. That, in
short, means we’re open to each and everyone showing up at our bi-weekly meetings and discussing the
ups and downs of writing and deploying various applications on Kubernetes.

**Sandipan: What are some of the most significant projects or initiatives currently being undertaken
by SIG Apps?**
--&gt;
&lt;p&gt;正如我们在&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-apps/charter.md#scope&#34;&gt;章程&lt;/a&gt;中所描述的那样，
我们涵盖了与在 Kubernetes 上开发、部署和操作应用程序相关的广泛领域。
简而言之，这意味着我们欢迎每个人参加我们的双周会议，讨论在 Kubernetes
上编写和部署各种应用程序的经验和挑战。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：SIG Apps 目前正在进行的一些最重要项目或倡议有哪些？&lt;/p&gt;
&lt;!--
At this point in time, the main factors driving the development of our controllers are the
challenges coming from running various AI-related workloads. It’s worth giving credit here to two
working groups we’ve sponsored over the past years:
--&gt;
&lt;p&gt;在当前阶段，推动我们控制器开发的主要因素是运行各种 AI 相关工作负载所带来的挑战。
在此值得一提的是，过去几年我们支持的两个工作组：&lt;/p&gt;
&lt;!--
1. [The Batch Working Group](https://github.com/kubernetes/community/tree/master/wg-batch), which is
   looking at running HPC, AI/ML, and data analytics jobs on top of Kubernetes.
2. [The Serving Working Group](https://github.com/kubernetes/community/tree/master/wg-serving), which
   is focusing on hardware-accelerated AI/ML inference.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-batch&#34;&gt;Batch 工作组&lt;/a&gt;，
该工作组致力于在 Kubernetes 上运行 HPC、AI/ML 和数据分析作业。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-serving&#34;&gt;Serving 工作组&lt;/a&gt;，
该工作组专注于硬件加速的 AI/ML 推理。&lt;/li&gt;
&lt;/ol&gt;
&lt;!---
## Best practices and challenges

**Sandipan: SIG Apps plays a crucial role in developing application management best practices for
Kubernetes. Can you share some of these best practices and how they help improve application
lifecycle management?**
--&gt;
&lt;h2 id=&#34;最佳实践与挑战&#34;&gt;最佳实践与挑战&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：SIG Apps 在为 Kubernetes 开发应用程序管理最佳实践方面发挥着关键作用。
你能分享一些这些最佳实践吗？以及它们如何帮助改进应用程序生命周期管理？&lt;/p&gt;
&lt;!--
1. Implementing [health checks and readiness probes](/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)
ensures that your applications are healthy and ready to serve traffic, leading to improved
reliability and uptime. The above, combined with comprehensive logging, monitoring, and tracing
solutions, will provide insights into your application&#39;s behavior, enabling you to identify and
resolve issues quickly.
--&gt;
&lt;ol&gt;
&lt;li&gt;实施&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/&#34;&gt;健康检查和就绪探针&lt;/a&gt;
确保你的应用程序处于健康状态并准备好处理流量，从而提高可靠性和正常运行时间。
结合全面的日志记录、监控和跟踪解决方案，上述措施将为您提供应用程序行为的洞察，
使你能够快速识别并解决问题。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. [Auto-scale your application](/docs/concepts/workloads/autoscaling/) based
   on resource utilization or custom metrics, optimizing resource usage and ensuring your
   application can handle varying loads.
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;根据资源利用率或自定义指标&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/autoscaling/&#34;&gt;自动扩缩你的应用&lt;/a&gt;，
优化资源使用并确保您的应用程序能够处理不同的负载。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Use Deployment for stateless applications, StatefulSet for stateful applications, Job
   and CronJob for batch workloads, and DaemonSet for running a daemon on each node. Use
   Operators and CRDs to extend the Kubernetes API to automate the deployment, management, and
   lifecycle of complex applications, making them easier to operate and reducing manual
   intervention.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;对于无状态应用程序使用 Deployment，对于有状态应用程序使用 StatefulSet，
对于批处理工作负载使用 Job 和 CronJob，在每个节点上运行守护进程时使用
DaemonSet。使用 Operator 和 CRD 扩展 Kubernetes API 以自动化复杂应用程序的部署、
管理和生命周期，使其更易于操作并减少手动干预。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
**Sandipan: What are some of the common challenges SIG Apps faces, and how do you address them?**

The biggest challenge we’re facing all the time is the need to reject a lot of features, ideas, and
improvements. This requires a lot of discipline and patience to be able to explain the reasons
behind those decisions.
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：SIG Apps 面临的一些常见挑战是什么？你们是如何解决这些问题的？&lt;/p&gt;
&lt;p&gt;我们一直面临的最大挑战是需要拒绝许多功能、想法和改进。这需要大量的纪律性和耐心，
以便能够解释做出这些决定背后的原因。&lt;/p&gt;
&lt;!--
**Sandipan: How has the evolution of Kubernetes influenced the work of SIG Apps? Are there any
recent changes or upcoming features in Kubernetes that you find particularly relevant or beneficial
for SIG Apps?**

The main benefit for both us and the whole community around SIG Apps is the ability to extend
kubernetes with [Custom Resource Definitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
and the fact that users can build their own custom controllers leveraging the built-in ones to
achieve whatever sophisticated use cases they might have and we, as the core maintainers, haven’t
considered or weren’t able to efficiently resolve inside Kubernetes.
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：Kubernetes 的演进如何影响了 SIG Apps 的工作？
Kubernetes 最近是否有任何变化或即将推出的功能，你认为对
SIG Apps 特别相关或有益？&lt;/p&gt;
&lt;p&gt;对我们以及围绕 SIG Apps 的整个社区而言，
最大的好处是能够通过&lt;a href=&#34;https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/&#34;&gt;自定义资源定义（Custom Resource Definitions）&lt;/a&gt;扩展
Kubernetes。用户可以利用内置控制器构建自己的自定义控制器，
以实现他们可能面对的各种复杂用例，而我们作为核心维护者，
可能没有考虑过这些用例，或者无法在 Kubernetes 内部高效解决。&lt;/p&gt;
&lt;!--
## Contributing to SIG Apps

**Sandipan: What opportunities are available for new contributors who want to get involved with SIG
Apps, and what advice would you give them?**
--&gt;
&lt;h2 id=&#34;贡献于-sig-apps&#34;&gt;贡献于 SIG Apps&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：对于想要参与 SIG Apps 的新贡献者，有哪些机会？
你会给他们什么建议？&lt;/p&gt;
&lt;!--
We get the question, &#34;What good first issue might you recommend we start with?&#34; a lot :-) But
unfortunately, there’s no easy answer to it. We always tell everyone that the best option to start
contributing to core controllers is to find one you are willing to spend some time with. Read
through the code, then try running unit tests and integration tests focusing on that
controller. Once you grasp the general idea, try breaking it and the tests again to verify your
breakage. Once you start feeling confident you understand that particular controller, you may want
to search through open issues affecting that controller and either provide suggestions, explaining
the problem users have, or maybe attempt your first fix.
--&gt;
&lt;p&gt;我们经常被问道：“你们建议我们从哪个好的初始问题开始？” :-)
但遗憾的是，这个问题没有简单的答案。我们总是告诉大家，
为核心控制器做贡献的最佳方式是找到一个你愿意花时间研究的控制器。
阅读代码，然后尝试运行针对该控制器的单元测试和集成测试。一旦你掌握了大致的概念，
试着破坏它并再次运行测试以验证你的改动。当你开始有信心理解了这个特定的控制器后，
你可以搜索影响该控制器的待处理问题，提供一些建议，解释用户遇到的问题，
或者尝试提交你的第一个修复。&lt;/p&gt;
&lt;!--
Like we said, there are no shortcuts on that road; you need to spend the time with the codebase to
understand all the edge cases we’ve slowly built up to get to the point where we are. Once you’re
successful with one controller, you’ll need to repeat that same process with others all over again.

**Sandipan: How does SIG Apps gather feedback from the community, and how is this feedback
integrated into your work?**
--&gt;
&lt;p&gt;正如我们所说，在这条道路上没有捷径可走；你需要花时间研究代码库，
以理解我们逐步积累的所有边缘情况，从而达到我们现在的位置。
一旦你在一个控制器上取得了成功，你就需要在其他控制器上重复同样的过程。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：SIG Apps 如何从社区收集反馈，以及这些反馈是如何整合到你们的工作中的？&lt;/p&gt;
&lt;!--
We always encourage everyone to show up and present their problems and solutions during our
bi-weekly [meetings](https://github.com/kubernetes/community/tree/master/sig-apps#meetings). As long
as you’re solving an interesting problem on top of Kubernetes and you can provide valuable feedback
about any of the core controllers, we’re always happy to hear from everyone.
--&gt;
&lt;p&gt;我们总是鼓励每个人参加我们的双周&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps#meetings&#34;&gt;会议&lt;/a&gt;，
并在会上提出他们的问题和解决方案。只要你是在 Kubernetes 上解决一个有趣的问题，
并且能够对任何核心控制器提供有价值的反馈，我们都非常乐意听取每个人的意见。&lt;/p&gt;
&lt;!--
## Looking ahead

**Sandipan: Looking ahead, what are the key focus areas or upcoming trends in application management
within Kubernetes that SIG Apps is excited about? How is the SIG adapting to these trends?**

Definitely the current AI hype is the major driving factor; as mentioned above, we have two working
groups, each covering a different aspect of it.
--&gt;
&lt;h2 id=&#34;展望未来&#34;&gt;展望未来&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：展望未来，Kubernetes 中应用程序管理的关键关注领域或即将到来的趋势有哪些是
SIG Apps 感到兴奋的？SIG 是如何适应这些趋势的？&lt;/p&gt;
&lt;p&gt;当前的 AI 热潮无疑是主要的驱动因素；如上所述，我们有两个工作组，
每个工作组都涵盖了它的一个不同方面。&lt;/p&gt;
&lt;!--
**Sandipan: What are some of your favorite things about this SIG?**

Without a doubt, the people that participate in our meetings and on
[Slack](https://kubernetes.slack.com/messages/sig-apps), who tirelessly help triage issues, pull
requests and invest a lot of their time (very frequently their private time) into making kubernetes
great!
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan&lt;/strong&gt;：关于这个 SIG，你们最喜欢的事情有哪些？&lt;/p&gt;
&lt;p&gt;毫无疑问，参与我们会议和
&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-apps&#34;&gt;Slack&lt;/a&gt; 频道的人们是最让我们感到欣慰的。
他们不知疲倦地帮助处理问题、拉取请求，并投入大量的时间（很多时候是他们的私人时间）来让
Kubernetes 变得更好！&lt;/p&gt;
&lt;hr&gt;
&lt;!--
SIG Apps is an essential part of the Kubernetes community, helping to shape how applications are
deployed and managed at scale. From its work on improving Kubernetes&#39; workload APIs to driving
innovation in AI/ML application management, SIG Apps is continually adapting to meet the needs of
modern application developers and operators. Whether you’re a new contributor or an experienced
developer, there’s always an opportunity to get involved and make an impact.
--&gt;
&lt;p&gt;SIG Apps 是 Kubernetes 社区的重要组成部分，
帮助塑造了应用程序如何在大规模下部署和管理的方式。从改进 Kubernetes
的工作负载 API 到推动 AI/ML 应用程序管理的创新，SIG Apps
不断适应以满足现代应用程序开发者和操作人员的需求。无论你是新贡献者还是有经验的开发者，
都有机会参与其中并产生影响。&lt;/p&gt;
&lt;!--
If you’re interested in learning more or contributing to SIG Apps, be sure to check out their [SIG
README](https://github.com/kubernetes/community/tree/master/sig-apps) and join their bi-weekly [meetings](https://github.com/kubernetes/community/tree/master/sig-apps#meetings).

- [SIG Apps Mailing List](https://groups.google.com/a/kubernetes.io/g/sig-apps)
- [SIG Apps on Slack](https://kubernetes.slack.com/messages/sig-apps)
--&gt;
&lt;p&gt;如果你有兴趣了解更多关于 SIG Apps 的信息或为其做出贡献，务必查看他们的
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps&#34;&gt;SIG README&lt;/a&gt;，
并加入他们的双周&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps#meetings&#34;&gt;会议&lt;/a&gt;。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/sig-apps&#34;&gt;SIG Apps 邮件列表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-apps&#34;&gt;SIG Apps 在 Slack 上&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>kube-proxy 的 NFTables 模式</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/</link>
      <pubDate>Fri, 28 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;NFTables mode for kube-proxy&#34;
date: 2025-02-28
slug: nftables-kube-proxy
author: &gt;
  Dan Winship (Red Hat)
--&gt;
&lt;!--
A new nftables mode for kube-proxy was introduced as an alpha feature
in Kubernetes 1.29. Currently in beta, it is expected to be GA as of
1.33. The new mode fixes long-standing performance problems with the
iptables mode and all users running on systems with reasonably-recent
kernels are encouraged to try it out. (For compatibility reasons, even
once nftables becomes GA, iptables will still be the _default_.)
--&gt;
&lt;p&gt;Kubernetes 1.29 引入了一种新的 Alpha 特性：kube-proxy 的 nftables 模式。
目前该模式处于 Beta 阶段，并预计将在 1.33 版本中达到一般可用（GA）状态。
新模式解决了 iptables 模式长期存在的性能问题，建议所有运行在较新内核版本系统上的用户尝试使用。
出于兼容性原因，即使 nftables 成为 GA 功能，iptables 仍将是&lt;strong&gt;默认&lt;/strong&gt;模式。&lt;/p&gt;
&lt;!--
## Why nftables? Part 1: data plane latency

The iptables API was designed for implementing simple firewalls, and
has problems scaling up to support Service proxying in a large
Kubernetes cluster with tens of thousands of Services.

In general, the ruleset generated by kube-proxy in iptables mode has a
number of iptables rules proportional to the sum of the number of
Services and the total number of endpoints. In particular, at the top
level of the ruleset, there is one rule to test each possible Service
IP (and port) that a packet might be addressed to:
--&gt;
&lt;h2 id=&#34;为什么选择-nftables-第一部分-数据平面延迟&#34;&gt;为什么选择 nftables？第一部分：数据平面延迟&lt;/h2&gt;
&lt;p&gt;iptables API 是被设计用于实现简单的防火墙功能，在扩展到支持大型 Kubernetes 集群中的 Service
代理时存在局限性，尤其是在包含数万个 Service 的集群中。&lt;/p&gt;
&lt;p&gt;通常，kube-proxy 在 iptables 模式下生成的规则集中的 iptables 规则数量与
Service 数量和总端点数量的总和成正比。
特别是，在规则集的顶层，针对数据包可能指向的每个可能的 Service IP（以及端口），
都有一条规则用于测试。&lt;/p&gt;
&lt;!--
```
# If the packet is addressed to 172.30.0.41:80, then jump to the chain
# KUBE-SVC-XPGD46QRK7WJZT7O for further processing
-A KUBE-SERVICES -m comment --comment &#34;namespace1/service1:p80 cluster IP&#34; -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O

# If the packet is addressed to 172.30.0.42:443, then...
-A KUBE-SERVICES -m comment --comment &#34;namespace2/service2:p443 cluster IP&#34; -m tcp -p tcp -d 172.30.0.42 --dport 443 -j KUBE-SVC-GNZBNJ2PO5MGZ6GT

# etc...
-A KUBE-SERVICES -m comment --comment &#34;namespace3/service3:p80 cluster IP&#34; -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK
```
--&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# 如果数据包的目标地址是 172.30.0.41:80，则跳转到 KUBE-SVC-XPGD46QRK7WJZT7O 链进行进一步处理
-A KUBE-SERVICES -m comment --comment &amp;#34;namespace1/service1:p80 cluster IP&amp;#34; -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O

# 如果数据包的目标地址是 172.30.0.42:443，则...
-A KUBE-SERVICES -m comment --comment &amp;#34;namespace2/service2:p443 cluster IP&amp;#34; -m tcp -p tcp -d 172.30.0.42 --dport 443 -j KUBE-SVC-GNZBNJ2PO5MGZ6GT

# 等等...
-A KUBE-SERVICES -m comment --comment &amp;#34;namespace3/service3:p80 cluster IP&amp;#34; -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK
&lt;/code&gt;&lt;/pre&gt;&lt;!--
This means that when a packet comes in, the time it takes the kernel
to check it against all of the Service rules is **O(n)** in the number
of Services. As the number of Services increases, both the average and
the worst-case latency for the first packet of a new connection
increases (with the difference between best-case, average, and
worst-case being mostly determined by whether a given Service IP
address appears earlier or later in the `KUBE-SERVICES` chain).



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/iptables-only.svg&#34;
         alt=&#34;kube-proxy iptables first packet latency, at various percentiles, in clusters of various sizes&#34;/&gt; 
&lt;/figure&gt;

By contrast, with nftables, the normal way to write a ruleset like
this is to have a _single_ rule, using a &#34;verdict map&#34; to do the
dispatch:
--&gt;
&lt;p&gt;这意味着当数据包到达时，内核检查该数据包与所有 Service 规则所需的时间是 &lt;strong&gt;O(n)&lt;/strong&gt;，
其中 n 为 Service 的数量。随着 Service 数量的增加，新连接的第一个数据包的平均延迟和最坏情况下的延迟都会增加
（最佳情况、平均情况和最坏情况之间的差异主要取决于某个 Service IP 地址在 &lt;code&gt;KUBE-SERVICES&lt;/code&gt;
链中出现的顺序是靠前还是靠后）。&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/iptables-only.svg&#34;
         alt=&#34;kube-proxy iptables 在不同规模集群中各百分位数下的第一个数据包延迟&#34;/&gt; 
&lt;/figure&gt;
&lt;p&gt;相比之下，使用 nftables，编写此类规则集的常规方法是使用一个单一规则，
并通过&amp;quot;判决映射&amp;quot;（verdict map）来完成分发：&lt;/p&gt;
&lt;!--
```
table ip kube-proxy {

        # The service-ips verdict map indicates the action to take for each matching packet.
	map service-ips {
		type ipv4_addr . inet_proto . inet_service : verdict
		comment &#34;ClusterIP, ExternalIP and LoadBalancer IP traffic&#34;
		elements = { 172.30.0.41 . tcp . 80 : goto service-ULMVA6XW-namespace1/service1/tcp/p80,
                             172.30.0.42 . tcp . 443 : goto service-42NFTM6N-namespace2/service2/tcp/p443,
                             172.30.0.43 . tcp . 80 : goto service-4AT6LBPK-namespace3/service3/tcp/p80,
                             ... }
        }

        # Now we just need a single rule to process all packets matching an
        # element in the map. (This rule says, &#34;construct a tuple from the
        # destination IP address, layer 4 protocol, and destination port; look
        # that tuple up in &#34;service-ips&#34;; and if there&#39;s a match, execute the
        # associated verdict.)
	chain services {
		ip daddr . meta l4proto . th dport vmap @service-ips
	}

        ...
}
```
--&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-none&#34; data-lang=&#34;none&#34;&gt;table ip kube-proxy {

  # service-ips 判决映射指示了对每个匹配数据包应采取的操作。
  map service-ips {
    type ipv4_addr . inet_proto . inet_service : verdict
    comment &amp;#34;ClusterIP、ExternalIP 和 LoadBalancer IP 流量&amp;#34;
    elements = { 172.30.0.41 . tcp . 80 : goto service-ULMVA6XW-namespace1/service1/tcp/p80,
                 172.30.0.42 . tcp . 443 : goto service-42NFTM6N-namespace2/service2/tcp/p443,
                 172.30.0.43 . tcp . 80 : goto service-4AT6LBPK-namespace3/service3/tcp/p80,
                 ... }
    }

  # 现在我们只需要一条规则来处理所有与映射中元素匹配的数据包。
  # （此规则表示：&amp;#34;根据目标 IP 地址、第 4 层协议和目标端口构建一个元组；
  # 在 &amp;#39;service-ips&amp;#39; 中查找该元组；如果找到匹配项，则执行与之关联的判定。&amp;#34;）
  chain services {
    ip daddr . meta l4proto . th dport vmap @service-ips
  }

  ...
}
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Since there&#39;s only a single rule, with a roughly **O(1)** map lookup,
packet processing time is more or less constant regardless of cluster
size, and the best/average/worst cases are very similar:



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/nftables-only.svg&#34;
         alt=&#34;kube-proxy nftables first packet latency, at various percentiles, in clusters of various sizes&#34;/&gt; 
&lt;/figure&gt;
--&gt;
&lt;p&gt;由于只有一条规则，并且映射查找的时间复杂度大约为 &lt;strong&gt;O(1)&lt;/strong&gt;，因此数据包处理时间几乎与集群规模无关，
并且最佳、平均和最坏情况下的表现非常接近：&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/nftables-only.svg&#34;
         alt=&#34;kube-proxy nftables 在不同规模集群中各百分位数下的第一个数据包延迟&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
But note the huge difference in the vertical scale between the
iptables and nftables graphs! In the clusters with 5000 and 10,000
Services, the p50 (average) latency for nftables is about the same as
the p01 (approximately best-case) latency for iptables. In the 30,000
Service cluster, the p99 (approximately worst-case) latency for
nftables manages to beat out the p01 latency for iptables by a few
microseconds! Here&#39;s both sets of data together, but you may have to
squint to see the nftables results!:



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/iptables-vs-nftables.svg&#34;
         alt=&#34;kube-proxy iptables-vs-nftables first packet latency, at various percentiles, in clusters of various sizes&#34;/&gt; 
&lt;/figure&gt;
--&gt;
&lt;p&gt;但请注意图表中 iptables 和 nftables 之间在纵轴上的巨大差异！
在包含 5000 和 10,000 个 Service 的集群中，nftables 的 p50（平均）延迟与 iptables
的 p01（接近最佳情况）延迟大致相同。
在包含 30,000 个 Service 的集群中，nftables 的 p99（接近最坏情况）延迟比 iptables 的 p01 延迟快了几微秒！
以下是两组数据的对比图，但你可能需要仔细观察才能看到 nftables 的结果！&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/iptables-vs-nftables.svg&#34;
         alt=&#34;kube-proxy iptables 与 nftables 在不同规模集群中各百分位数下的第一个数据包延迟对比&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
## Why nftables? Part 2: control plane latency

While the improvements to data plane latency in large clusters are
great, there&#39;s another problem with iptables kube-proxy that often
keeps users from even being able to grow their clusters to that size:
the time it takes kube-proxy to program new iptables rules when
Services and their endpoints change.
--&gt;
&lt;h2 id=&#34;为什么选择-nftables-第二部分-控制平面延迟&#34;&gt;为什么选择 nftables？第二部分：控制平面延迟&lt;/h2&gt;
&lt;p&gt;虽然在大型集群中数据平面延迟的改进非常显著，但 iptables 模式的 kube-proxy 还存在另一个问题，
这往往使得用户无法将集群扩展到较大规模：那就是当 Service 及其端点发生变化时，kube-proxy
更新 iptables 规则所需的时间。&lt;/p&gt;
&lt;!--
With both iptables and nftables, the total size of the ruleset as a
whole (actual rules, plus associated data) is **O(n)** in the combined
number of Services and their endpoints. Originally, the iptables
backend would rewrite every rule on every update, and with tens of
thousands of Services, this could grow to be hundreds of thousands of
iptables rules. Starting in Kubernetes 1.26, we began improving
kube-proxy so that it could skip updating _most_ of the unchanged
rules in each update, but the limitations of `iptables-restore` as an
API meant that it was still always necessary to send an update that&#39;s
**O(n)** in the number of Services (though with a noticeably smaller
constant than it used to be). Even with those optimizations, it can
still be necessary to make use of kube-proxy&#39;s `minSyncPeriod` config
option to ensure that it doesn&#39;t spend every waking second trying to
push iptables updates.
--&gt;
&lt;p&gt;对于 iptables 和 nftables，规则集的整体大小（实际规则加上相关数据）与 Service
及其端点的总数呈 &lt;strong&gt;O(n)&lt;/strong&gt; 关系。原来，iptables 后端在每次更新时都会重写所有规则，
当集群中存在数万个 Service 时，这可能导致规则数量增长至数十万条 iptables 规则。
从 Kubernetes 1.26 开始，我们开始优化 kube-proxy，使其能够在每次更新时跳过对大多数未更改规则的更新，
但由于 &lt;code&gt;iptables-restore&lt;/code&gt; API 的限制，仍然需要发送与 Service 数量呈 &lt;strong&gt;O(n)&lt;/strong&gt;
比例的更新（尽管常数因子比以前明显减小）。即使进行了这些优化，有时仍需使用 kube-proxy 的
&lt;code&gt;minSyncPeriod&lt;/code&gt; 配置选项，以确保它不会每秒钟都在尝试推送 iptables 更新。&lt;/p&gt;
&lt;!--
The nftables APIs allow for doing much more incremental updates, and
when kube-proxy in nftables mode does an update, the size of the
update is only **O(n)** in the number of Services and endpoints that
have changed since the last sync, regardless of the total number of
Services and endpoints. The fact that the nftables API allows each
nftables-using component to have its own private table also means that
there is no global lock contention between components like with
iptables. As a result, kube-proxy&#39;s nftables updates can be done much
more efficiently than with iptables.

(Unfortunately I don&#39;t have cool graphs for this part.)
--&gt;
&lt;p&gt;nftables API 支持更为增量化的更新，当以 nftables 模式运行的 kube-proxy 执行更新时，
更新的规模仅与自上次同步以来发生变化的 Service 和端点数量呈 &lt;strong&gt;O(n)&lt;/strong&gt; 关系，而与总的 Service 和端点数量无关。
此外，由于 nftables API 允许每个使用 nftables 的组件拥有自己的私有表，因此不会像 iptables
那样在组件之间产生全局锁竞争。结果是，kube-proxy 在 nftables 模式下的更新可以比 iptables 模式下高效得多。&lt;/p&gt;
&lt;p&gt;（不幸的是，这部分我没有酷炫的图表。）&lt;/p&gt;
&lt;!--
## Why _not_ nftables? {#why-not-nftables}

All that said, there are a few reasons why you might not want to jump
right into using the nftables backend for now.

First, the code is still fairly new. While it has plenty of unit
tests, performs correctly in our CI system, and has now been used in
the real world by multiple users, it has not seen anything close to as
much real-world usage as the iptables backend has, so we can&#39;t promise
that it is as stable and bug-free.
--&gt;
&lt;h2 id=&#34;why-not-nftables&#34;&gt;不选择 nftables 的理由有哪些？ &lt;/h2&gt;
&lt;p&gt;尽管如此，仍有几个原因可能让你目前不希望立即使用 nftables 后端。&lt;/p&gt;
&lt;p&gt;首先，该代码仍然相对较新。虽然它拥有大量的单元测试，在我们的 CI 系统中表现正确，
并且已经在现实世界中被多个用户使用，但其实际使用量远远不及 iptables 后端，
因此我们无法保证它同样稳定且无缺陷。&lt;/p&gt;
&lt;!--
Second, the nftables mode will not work on older Linux distributions;
currently it requires a 5.13 or newer kernel. Additionally, because of
bugs in early versions of the `nft` command line tool, you should not
run kube-proxy in nftables mode on nodes that have an old (earlier
than 1.0.0) version of `nft` in the host filesystem (or else
kube-proxy&#39;s use of nftables may interfere with other uses of nftables
on the system).
--&gt;
&lt;p&gt;其次，nftables 模式无法在较旧的 Linux 发行版上工作；目前它需要 5.13 或更高版本的内核。
此外，由于早期版本的 &lt;code&gt;nft&lt;/code&gt; 命令行工具存在缺陷，不应在运行旧版本（早于 1.0.0）
&lt;code&gt;nft&lt;/code&gt; 的节点主机文件系统中上以 nftables 模式运行 kube-proxy（否则 kube-proxy
对 nftables 的使用可能会影响系统上其他程序对 nftables 的使用）。&lt;/p&gt;
&lt;!--
Third, you may have other networking components in your cluster, such
as the pod network or NetworkPolicy implementation, that do not yet
support kube-proxy in nftables mode. You should consult the
documentation (or forums, bug tracker, etc.) for any such components
to see if they have problems with nftables mode. (In many cases they
will not; as long as they don&#39;t try to directly interact with or
override kube-proxy&#39;s iptables rules, they shouldn&#39;t care whether
kube-proxy is using iptables or nftables.) Additionally, observability
and monitoring tools that have not been updated may report less data
for kube-proxy in nftables mode than they do for kube-proxy in
iptables mode.
--&gt;
&lt;p&gt;第三，你的集群中可能还存在其他网络组件，例如 Pod 网络或 NetworkPolicy 实现，
这些组件可能尚不支持以 nftables 模式运行的 kube-proxy。你应查阅相关组件的文档（或论坛、问题跟踪系统等），
以确认它们是否与 nftables 模式存在兼容性问题。（在许多情况下，它们并不会受到影响；
只要它们不尝试直接操作或覆盖 kube-proxy 的 iptables 规则，就不在乎 kube-proxy
使用的是 iptables 还是 nftables。）
此外，相较于 iptables 模式下，尚未更新的可观测性和监控工具在 nftables
模式下可能会为 kube-proxy 提供更少的数据。&lt;/p&gt;
&lt;!--
Finally, kube-proxy in nftables mode is intentionally not 100%
compatible with kube-proxy in iptables mode. There are a few old
kube-proxy features whose default behaviors are less secure, less
performant, or less intuitive than we&#39;d like, but where we felt that
changing the default would be a compatibility break. Since the
nftables mode is opt-in, this gave us a chance to fix those bad
defaults without breaking users who weren&#39;t expecting changes. (In
particular, with nftables mode, NodePort Services are now only
reachable on their nodes&#39; default IPs, as opposed to being reachable
on all IPs, including `127.0.0.1`, with iptables mode.) The
[kube-proxy documentation] has more information about this, including
information about metrics you can look at to determine if you are
relying on any of the changed functionality, and what configuration
options are available to get more backward-compatible behavior.

[kube-proxy documentation]: https://kubernetes.io/docs/reference/networking/virtual-ips/#migrating-from-iptables-mode-to-nftables
--&gt;
&lt;p&gt;最后，以 nftables 模式运行的 kube-proxy 有意不与以 iptables 模式运行的 kube-proxy 完全兼容。
有一些较旧的 kube-proxy 功能，默认行为不如我们期望的那样安全、高效或直观，但我们认为更改默认行为会导致兼容性问题。
由于 nftables 模式是可选的，这为我们提供了一个机会，在不影响期望稳定性的用户的情况下修复这些不良默认设置。
（特别是，在 nftables 模式下，NodePort 类型的 Service 现在仅在其节点的默认 IP 上可访问，而在 iptables 模式下，
它们在所有 IP 上均可访问，包括 &lt;code&gt;127.0.0.1&lt;/code&gt;。）&lt;a href=&#34;https://kubernetes.io/zh-cn/docs/reference/networking/virtual-ips/#migrating-from-iptables-mode-to-nftables&#34;&gt;kube-proxy 文档&lt;/a&gt; 提供了更多关于此方面的信息，
包括如何通过查看某些指标来判断你是否依赖于任何已更改的特性，以及有哪些配置选项可用于实现更向后兼容的行为。&lt;/p&gt;
&lt;!--
## Trying out nftables mode

Ready to try it out? In Kubernetes 1.31 and later, you just need to
pass `--proxy-mode nftables` to kube-proxy (or set `mode: nftables` in
your kube-proxy config file).

If you are using kubeadm to set up your cluster, the kubeadm
documentation explains [how to pass a `KubeProxyConfiguration` to
`kubeadm init`]. You can also [deploy nftables-based clusters with
`kind`].
--&gt;
&lt;h2 id=&#34;尝试使用-nftables-模式&#34;&gt;尝试使用 nftables 模式&lt;/h2&gt;
&lt;p&gt;准备尝试了吗？在 Kubernetes 1.31 及更高版本中，你只需将 &lt;code&gt;--proxy-mode nftables&lt;/code&gt;
参数传递给 kube-proxy（或在 kube-proxy 配置文件中设置 &lt;code&gt;mode: nftables&lt;/code&gt;）。&lt;/p&gt;
&lt;p&gt;如果你使用 kubeadm 部署集群，kubeadm 文档解释了&lt;a href=&#34;https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/#config-file&#34;&gt;如何向 &lt;code&gt;kubeadm init&lt;/code&gt; 传递 &lt;code&gt;KubeProxyConfiguration&lt;/code&gt;&lt;/a&gt;。
你还可以&lt;a href=&#34;https://kind.sigs.k8s.io/docs/user/configuration/#kube-proxy-mode&#34;&gt;通过 &lt;code&gt;kind&lt;/code&gt; 部署基于 nftables 的集群&lt;/a&gt;。&lt;/p&gt;
&lt;!--
You can also convert existing clusters from iptables (or ipvs) mode to
nftables by updating the kube-proxy configuration and restarting the
kube-proxy pods. (You do not need to reboot the nodes: when restarting
in nftables mode, kube-proxy will delete any existing iptables or ipvs
rules, and likewise, if you later revert back to iptables or ipvs
mode, it will delete any existing nftables rules.)

[how to pass a `KubeProxyConfiguration` to `kubeadm init`]: /docs/setup/production-environment/tools/kubeadm/control-plane-flags/#customizing-kube-proxy
[deploy nftables-based clusters with `kind`]: https://kind.sigs.k8s.io/docs/user/configuration/#kube-proxy-mode
--&gt;
&lt;p&gt;你还可以通过更新 kube-proxy 配置并重启 kube-proxy Pod，将现有集群从
iptables（或 ipvs）模式转换为 nftables 模式。（无需重启节点：
在以 nftables 模式重新启动时，kube-proxy 会删除现有的所有 iptables 或 ipvs 规则；
同样，如果你之后切换回 iptables 或 ipvs 模式，它将删除现有的所有 nftables 规则。）&lt;/p&gt;
&lt;!--
## Future plans

As mentioned above, while nftables is now the _best_ kube-proxy mode,
it is not the _default_, and we do not yet have a plan for changing
that. We will continue to support the iptables mode for a long time.

The future of the IPVS mode of kube-proxy is less certain: its main
advantage over iptables was that it was faster, but certain aspects of
the IPVS architecture and APIs were awkward for kube-proxy&#39;s purposes
(for example, the fact that the `kube-ipvs0` device needs to have
_every_ Service IP address assigned to it), and some parts of
Kubernetes Service proxying semantics were difficult to implement
using IPVS (particularly the fact that some Services had to have
different endpoints depending on whether you connected to them from a
local or remote client). And now, the nftables mode has the same
performance as IPVS mode (actually, slightly better), without any of
the downsides:
--&gt;
&lt;h2 id=&#34;未来计划&#34;&gt;未来计划&lt;/h2&gt;
&lt;p&gt;如上所述，虽然 nftables 现在是的 kube-proxy 的最佳模式，但它还不是默认模式，
我们目前还没有更改这一设置的计划。我们将继续长期支持 iptables 模式。&lt;/p&gt;
&lt;p&gt;kube-proxy 的 IPVS 模式的未来则不太确定：它相对于 iptables 的主要优势在于速度更快，
但 IPVS 的架构和 API 在某些方面对 kube-proxy 来说不够理想（例如，&lt;code&gt;kube-ipvs0&lt;/code&gt;
设备需要被分配所有 Service IP 地址），
并且 Kubernetes Service 代理的部分语义使用 IPVS 难以实现（特别是某些
Service 根据连接的客户端是本地还是远程，需要有不同的端点）。
现在，nftables 模式的性能与 IPVS 模式相同（实际上略胜一筹），而且没有任何缺点：&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/ipvs-vs-nftables.svg&#34;
         alt=&#34;kube-proxy ipvs-vs-nftables first packet latency, at various percentiles, in clusters of various sizes&#34;/&gt; 
&lt;/figure&gt;

(In theory the IPVS mode also has the advantage of being able to use
various other IPVS functionality, like alternative &#34;schedulers&#34; for
balancing endpoints. In practice, this ended up not being very useful,
because kube-proxy runs independently on every node, and the IPVS
schedulers on each node had no way of sharing their state with the
proxies on other nodes, thus thwarting the effort to balance traffic
more cleverly.)
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/28/nftables-kube-proxy/ipvs-vs-nftables.svg&#34;
         alt=&#34;kube-proxy IPVS 与 nftables 在不同规模集群中各百分位数下的第一个数据包延迟对比&#34;/&gt; 
&lt;/figure&gt;
&lt;p&gt;（理论上，IPVS 模式还具有可以使用其他 IPVS 功能的优势，例如使用替代的&amp;quot;调度器&amp;quot;来平衡端点。
但实际上，这并不太有用，因为 kube-proxy 在每个节点上独立运行，每个节点上的 IPVS
调度器无法与其他节点上的代理共享状态，从而无法实现更智能的流量均衡。）&lt;/p&gt;
&lt;!--
While the Kubernetes project does not have an immediate plan to drop
the IPVS backend, it is probably doomed in the long run, and people
who are currently using IPVS mode should try out the nftables mode
instead (and file bugs if you think there is missing functionality in
nftables mode that you can&#39;t work around).
--&gt;
&lt;p&gt;虽然 Kubernetes 项目目前没有立即放弃 IPVS 后端的计划，但从长远来看，IPVS 可能难逃被淘汰的命运。
目前使用 IPVS 模式的用户应尝试使用 nftables 模式（如果发现 nftables 模式中缺少某些无法绕过的功能，
请提交问题报告）。&lt;/p&gt;
&lt;!--
## Learn more

- &#34;[KEP-3866: Add an nftables-based kube-proxy backend]&#34; has the
  history of the new feature.

- &#34;[How the Tables Have Turned: Kubernetes Says Goodbye to IPTables]&#34;,
  from KubeCon/CloudNativeCon North America 2024, talks about porting
  kube-proxy and Calico from iptables to nftables.

- &#34;[From Observability to Performance]&#34;, from KubeCon/CloudNativeCon
  North America 2024. (This is where the kube-proxy latency data came
  from; the [raw data for the charts] is also available.)
--&gt;
&lt;h2 id=&#34;进一步了解&#34;&gt;进一步了解&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&amp;quot;&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/3866-nftables-proxy/README.md&#34;&gt;KEP-3866: Add an nftables-based kube-proxy backend&lt;/a&gt;&amp;quot; 记录了此新特性的历史。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&amp;quot;&lt;a href=&#34;https://youtu.be/yOGHb2HjslY?si=6O4PVJu7fGpReo1U&#34;&gt;How the Tables Have Turned: Kubernetes Says Goodbye to IPTables&lt;/a&gt;&amp;quot;，来自 2024 年
KubeCon/CloudNativeCon 北美大会，讨论了将 kube-proxy 和 Calico 从 iptables 迁移到 nftables 的过程。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&amp;quot;&lt;a href=&#34;https://youtu.be/uYo2O3jbJLk?si=py2AXzMJZ4PuhxNg&#34;&gt;From Observability to Performance&lt;/a&gt;&amp;quot;，同样来自 2024 年 KubeCon/CloudNativeCon 北美大会。
（kube-proxy 延迟数据来源于此；&lt;a href=&#34;https://docs.google.com/spreadsheets/d/1-ryDNc6gZocnMHEXC7mNtqknKSOv5uhXFKDx8Hu3AYA/edit&#34;&gt;raw data for the charts&lt;/a&gt; 也可用。）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>云控制器管理器（Cloud Controller Manager）&#39;鸡与蛋&#39;的问题</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/14/cloud-controller-manager-chicken-egg-problem/</link>
      <pubDate>Fri, 14 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/14/cloud-controller-manager-chicken-egg-problem/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;The Cloud Controller Manager Chicken and Egg Problem&#34;
date: 2025-02-14
slug: cloud-controller-manager-chicken-egg-problem
author: &gt;
  Antonio Ojea,
  Michael McCune
--&gt;
&lt;!--
Kubernetes 1.31
[completed the largest migration in Kubernetes history][migration-blog], removing the in-tree
cloud provider.  While the component migration is now done, this leaves some additional
complexity for users and installer projects (for example, kOps or Cluster API) .  We will go
over those additional steps and failure points and make recommendations for cluster owners.
This migration was complex and some logic had to be extracted from the core components,
building four new subsystems.
--&gt;
&lt;p&gt;Kubernetes 1.31&lt;br&gt;
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/20/completing-cloud-provider-migration/&#34;&gt;完成了 Kubernetes 历史上最大的迁移&lt;/a&gt;，移除了树内云驱动（in-tree cloud provider）。
虽然组件迁移已经完成，但这为用户和安装项目（例如 kOps 或 Cluster API）带来了一些额外的复杂性。
我们将回顾这些额外的步骤和可能的故障点，并为集群所有者提供改进建议。&lt;br&gt;
此次迁移非常复杂，必须从核心组件中提取部分逻辑，构建四个新的子系统。&lt;/p&gt;
&lt;!--
1. **Cloud controller manager** ([KEP-2392][kep2392])
2. **API server network proxy** ([KEP-1281][kep1281])
3. **kubelet credential provider plugins** ([KEP-2133][kep2133])
4. **Storage migration to use [CSI][csi]** ([KEP-625][kep625])

The [cloud controller manager is part of the control plane][ccm]. It is a critical component
that replaces some functionality that existed previously in the kube-controller-manager and the
kubelet.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;云控制器管理器&lt;/strong&gt; (&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2392-cloud-controller-manager/README.md&#34;&gt;KEP-2392&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API 服务器网络代理&lt;/strong&gt; (&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1281-network-proxy&#34;&gt;KEP-1281&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;kubelet 凭证提供程序插件&lt;/strong&gt; (&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2133-kubelet-credential-providers&#34;&gt;KEP-2133&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;存储迁移到使用 &lt;a href=&#34;https://github.com/container-storage-interface/spec?tab=readme-ov-file#container-storage-interface-csi-specification-&#34;&gt;CSI&lt;/a&gt;&lt;/strong&gt; (&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/625-csi-migration/README.md&#34;&gt;KEP-625&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cloud-controller/&#34;&gt;云控制器管理器是控制平面的一部分&lt;/a&gt;。这是一个关键组件，替换了之前存在于 kube-controller-manager
和 kubelet 中的某些特性。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/images/docs/components-of-kubernetes.svg&#34;
         alt=&#34;Components of Kubernetes&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Components of Kubernetes&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/images/components-of-kubernetes.svg&#34;
         alt=&#34;Kubernetes 组件&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Kubernetes 组件&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
One of the most critical functionalities of the cloud controller manager is the node controller,
which is responsible for the initialization of the nodes.

As you can see in the following diagram, when the **kubelet** starts, it registers the Node
object with the apiserver, Tainting the node so it can be processed first by the
cloud-controller-manager. The initial Node is missing the cloud-provider specific information,
like the Node Addresses and the Labels with the cloud provider specific information like the
Node, Region and Instance type information.
--&gt;
&lt;p&gt;云控制器管理器最重要的功能之一是节点控制器，它负责节点的初始化。&lt;/p&gt;
&lt;p&gt;从下图可以看出，当 &lt;strong&gt;kubelet&lt;/strong&gt; 启动时，它会向 apiserver 注册 Node 对象，并对节点设置污点，
以便云控制器管理器可以先处理该节点。初始的 Node 缺少与云提供商相关的信息，
例如节点地址和包含云提供商特定信息的标签，如节点、区域和实例类型信息。&lt;/p&gt;
&lt;!--


&lt;figure class=&#34;diagram-medium &#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/14/cloud-controller-manager-chicken-egg-problem/ccm-chicken-egg-problem-sequence-diagram.svg&#34;
         alt=&#34;Chicken and egg problem sequence diagram&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Chicken and egg problem sequence diagram&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure class=&#34;diagram-medium &#34;&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/02/14/cloud-controller-manager-chicken-egg-problem/ccm-chicken-egg-problem-sequence-diagram.svg&#34;
         alt=&#34;鸡和蛋问题时序图&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;鸡和蛋问题时序图&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
This new initialization process adds some latency to the node readiness. Previously, the kubelet
was able to initialize the node at the same time it created the node. Since the logic has moved
to the cloud-controller-manager, this can cause a [chicken and egg problem][chicken-and-egg]
during the cluster bootstrapping for those Kubernetes architectures that do not deploy the
controller manager as the other components of the control plane, commonly as static pods,
standalone binaries or daemonsets/deployments with tolerations to the taints and using
`hostNetwork` (more on this below)
--&gt;
&lt;p&gt;这一新的初始化过程会增加节点就绪的延迟。以前，kubelet 可以在创建节点的同时初始化节点。
对于某些 Kubernetes 架构而言，其控制平面其他组件以静态 Pod、独立二进制文件或具有容忍污点功能的、
用 &lt;code&gt;hostNetwork&lt;/code&gt; DaemonSet/Deployment 部署，由于节点初始化逻辑已移至云控制管理器中，
如果不将控制器管理器作为控制平面的一部分，则可能会导致集群引导过程中出现&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/running-cloud-controller/#chicken-and-egg&#34;&gt;鸡和蛋问题&lt;/a&gt;（更多内容见下文）。&lt;/p&gt;
&lt;!--
## Examples of the dependency problem

As noted above, it is possible during bootstrapping for the cloud-controller-manager to be
unschedulable and as such the cluster will not initialize properly. The following are a few
concrete examples of how this problem can be expressed and the root causes for why they might
occur.

These examples assume you are running your cloud-controller-manager using a Kubernetes resource
(e.g. Deployment, DaemonSet, or similar) to control its lifecycle. Because these methods
rely on Kubernetes to schedule the cloud-controller-manager, care must be taken to ensure it
will schedule properly.
--&gt;
&lt;h2 id=&#34;依赖问题的示例&#34;&gt;依赖问题的示例&lt;/h2&gt;
&lt;p&gt;如上所述，在引导过程中，云控制器管理器可能无法被调度，
因此集群将无法正确初始化。以下几个具体示例说明此问题的可能表现形式及其根本原因。&lt;/p&gt;
&lt;p&gt;这些示例假设你使用 Kubernetes 资源（例如 Deployment、DaemonSet
或类似资源）来控制云控制器管理器的生命周期。由于这些方法依赖于 Kubernetes 来调度云控制器管理器，
因此必须确保其能够正确调度。&lt;/p&gt;
&lt;!--
### Example: Cloud controller manager not scheduling due to uninitialized taint

As [noted in the Kubernetes documentation][kubedocs0], when the kubelet is started with the command line
flag `--cloud-provider=external`, its corresponding `Node` object will have a no schedule taint
named `node.cloudprovider.kubernetes.io/uninitialized` added. Because the cloud-controller-manager
is responsible for removing the no schedule taint, this can create a situation where a
cloud-controller-manager that is being managed by a Kubernetes resource, such as a `Deployment`
or `DaemonSet`, may not be able to schedule.
--&gt;
&lt;h3 id=&#34;示例-由于未初始化的污点导致云控制器管理器无法调度&#34;&gt;示例：由于未初始化的污点导致云控制器管理器无法调度&lt;/h3&gt;
&lt;p&gt;如 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager&#34;&gt;Kubernetes 文档中所述&lt;/a&gt;，当 kubelet 使用命令行标志 &lt;code&gt;--cloud-provider=external&lt;/code&gt;
启动时，其对应的 &lt;code&gt;Node&lt;/code&gt; 对象将添加一个名为 &lt;code&gt;node.cloudprovider.kubernetes.io/uninitialized&lt;/code&gt;
的不可调度污点。由于云控制器管理器负责移除该不可调度污点，这可能会导致由某个 Kubernetes
资源（例如 &lt;code&gt;Deployment&lt;/code&gt; 或 &lt;code&gt;DaemonSet&lt;/code&gt;）管理的云控制器管理器无法被调度的情况。&lt;/p&gt;
&lt;!--
If the cloud-controller-manager is not able to be scheduled during the initialization of the
control plane, then the resulting `Node` objects will all have the
`node.cloudprovider.kubernetes.io/uninitialized` no schedule taint. It also means that this taint
will not be removed as the cloud-controller-manager is responsible for its removal. If the no
schedule taint is not removed, then critical workloads, such as the container network interface
controllers, will not be able to schedule, and the cluster will be left in an unhealthy state.
--&gt;
&lt;p&gt;如果在控制平面初始化期间云控制器管理器无法被调度，那么生成的 &lt;code&gt;Node&lt;/code&gt; 对象将全部带有
&lt;code&gt;node.cloudprovider.kubernetes.io/uninitialized&lt;/code&gt; 不可调度污点。这也意味着该污点不会被移除，
因为云控制器管理器负责其移除工作。如果不可调度污点未被移除，关键工作负载（例如容器网络接口控制器）
将无法被调度，集群将处于不健康状态。&lt;/p&gt;
&lt;!--
### Example: Cloud controller manager not scheduling due to not-ready taint

The next example would be possible in situations where the container network interface (CNI) is
waiting for IP address information from the cloud-controller-manager (CCM), and the CCM has not
tolerated the taint which would be removed by the CNI.

The [Kubernetes documentation describes][kubedocs1] the `node.kubernetes.io/not-ready` taint as follows:

&gt; &#34;The Node controller detects whether a Node is ready by monitoring its health and adds or removes this taint accordingly.&#34;
--&gt;
&lt;h3 id=&#34;示例-由于未就绪污点导致云控制器管理器无法调度&#34;&gt;示例：由于未就绪污点导致云控制器管理器无法调度&lt;/h3&gt;
&lt;p&gt;下一个示例可能出现在容器网络接口（CNI）正在等待来自云控制器管理器（CCM）的
IP 地址信息，而 CCM 未容忍将由 CNI 移除的污点的情况下。&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/labels-annotations-taints/#node-kubernetes-io-not-ready&#34;&gt;Kubernetes 文档&lt;/a&gt; 对 &lt;code&gt;node.kubernetes.io/not-ready&lt;/code&gt; 污点的描述如下：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;quot;节点控制器通过监控节点的健康状态来检测节点是否已准备好，并据此添加或移除此污点。&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
One of the conditions that can lead to a Node resource having this taint is when the container
network has not yet been initialized on that node. As the cloud-controller-manager is responsible
for adding the IP addresses to a Node resource, and the IP addresses are needed by the container
network controllers to properly configure the container network, it is possible in some
circumstances for a node to become stuck as not ready and uninitialized permanently.

This situation occurs for a similar reason as the first example, although in this case, the
`node.kubernetes.io/not-ready` taint is used with the no execute effect and thus will cause the
cloud-controller-manager not to run on the node with the taint. If the cloud-controller-manager is
not able to execute, then it will not initialize the node. It will cascade into the container
network controllers not being able to run properly, and the node will end up carrying both the
`node.cloudprovider.kubernetes.io/uninitialized` and `node.kubernetes.io/not-ready` taints,
leaving the cluster in an unhealthy state.
--&gt;
&lt;p&gt;当容器网络尚未在某节点上初始化时，可能导致 Node 资源具有此污点。由于云控制器管理器负责为
Node 资源添加 IP 地址，而容器网络控制器需要这些 IP 地址来正确配置容器网络，因此在某些情况下，
节点可能会永久处于未就绪且未初始化的状态。&lt;/p&gt;
&lt;p&gt;这种情况的发生原因与第一个示例类似，但在此情况下，&lt;code&gt;node.kubernetes.io/not-ready&lt;/code&gt;
污点使用了 NoExecute 效果，从而导致云控制器管理器无法在带有该污点的节点上运行。
如果云控制器管理器无法执行，则它将无法初始化节点。这将进一步导致容器网络控制器无法正常运行，
节点最终会同时携带 &lt;code&gt;node.cloudprovider.kubernetes.io/uninitialized&lt;/code&gt; 和
&lt;code&gt;node.kubernetes.io/not-ready&lt;/code&gt; 两个污点，从而使集群处于不健康状态。&lt;/p&gt;
&lt;!--
## Our Recommendations

There is no one “correct way” to run a cloud-controller-manager. The details will depend on the
specific needs of the cluster administrators and users. When planning your clusters and the
lifecycle of the cloud-controller-managers please consider the following guidance:

For cloud-controller-managers running in the same cluster, they are managing.
--&gt;
&lt;h2 id=&#34;我们的建议&#34;&gt;我们的建议&lt;/h2&gt;
&lt;p&gt;运行云控制器管理器并没有唯一的“正确方式”。具体细节将取决于集群管理员和用户的特定需求。
在规划你的集群以及云控制器管理器的生命周期时，请考虑以下指导。&lt;/p&gt;
&lt;p&gt;对于在同一集群中运行的云控制器管理器，它们所管理的集群也是这一集群，需要特别注意。&lt;/p&gt;
&lt;!--
1. Use host network mode, rather than the pod network: in most cases, a cloud controller manager
  will need to communicate with an API service endpoint associated with the infrastructure.
  Setting “hostNetwork” to true will ensure that the cloud controller is using the host
  networking instead of the container network and, as such, will have the same network access as
  the host operating system. It will also remove the dependency on the networking plugin. This
  will ensure that the cloud controller has access to the infrastructure endpoint (always check
  your networking configuration against your infrastructure provider’s instructions).
2. Use a scalable resource type. `Deployments` and `DaemonSets` are useful for controlling the
  lifecycle of a cloud controller. They allow easy access to running multiple copies for redundancy
  as well as using the Kubernetes scheduling to ensure proper placement in the cluster. When using
  these primitives to control the lifecycle of your cloud controllers and running multiple
  replicas, you must remember to enable leader election, or else your controllers will collide
  with each other which could lead to nodes not being initialized in the cluster.
--&gt;
&lt;ol&gt;
&lt;li&gt;使用主机网络模式，而不是 Pod 网络：在大多数情况下，云控制器管理器需要与基础设施相关的 API 服务端点进行通信。
将 &amp;quot;hostNetwork&amp;quot; 设置为 &lt;code&gt;true&lt;/code&gt; 可确保云控制器使用主机网络而非容器网络，从而拥有与主机操作系统相同的网络访问权限。
这还将消除对网络插件的依赖。这可以确保云控制器能够访问基础设施端点
（你应该始终检查网络配置是否与基础设施提供商所给的指导相符）。&lt;/li&gt;
&lt;li&gt;使用规模可扩缩的资源类型。&lt;code&gt;Deployment&lt;/code&gt; 和 &lt;code&gt;DaemonSet&lt;/code&gt; 对于控制云控制器的生命周期非常有用。
它们支持轻松地运行多个副本以实现冗余，并利用 Kubernetes 调度来确保在集群中的正确放置。
当使用这些原语控制云控制器的生命周期并运行多个副本时，请务必启用领导者选举，
否则控制器之间可能会发生冲突，导致集群中的节点无法初始化。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Target the controller manager containers to the control plane. There might exist other
  controllers which need to run outside the control plane (for example, Azure’s node manager
  controller). Still, the controller managers themselves should be deployed to the control plane.
  Use a node selector or affinity stanza to direct the scheduling of cloud controllers to the
  control plane to ensure that they are running in a protected space. Cloud controllers are vital
  to adding and removing nodes to a cluster as they form a link between Kubernetes and the
  physical infrastructure. Running them on the control plane will help to ensure that they run
  with a similar priority as other core cluster controllers and that they have some separation
  from non-privileged user workloads.
   1. It is worth noting that an anti-affinity stanza to prevent cloud controllers from running
     on the same host is also very useful to ensure that a single node failure will not degrade
     the cloud controller performance.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;将控制器管理器容器定位到控制平面。可能存在一些需要在控制平面之外运行的其他控制器
（例如，Azure 的节点管理器控制器），但云控制器管理器本身应部署到控制平面。
使用节点选择算符或亲和性配置将云控制器管理器定向调度到控制平面节点，以确保它们运行在受保护的空间中。
云控制器管理器在集群中添加和移除节点时至关重要，因为它们构成了 Kubernetes 与物理基础设施之间的桥梁。
&lt;ol&gt;
&lt;li&gt;值得注意的是，使用反亲和性配置以防止多个云控制器管理器运行在同一主机上也非常有用，
这可以确保单个节点故障不会影响云控制器管理器的性能。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
4. Ensure that the tolerations allow operation. Use tolerations on the manifest for the cloud
  controller container to ensure that it will schedule to the correct nodes and that it can run
  in situations where a node is initializing. This means that cloud controllers should tolerate
  the `node.cloudprovider.kubernetes.io/uninitialized` taint, and it should also tolerate any
  taints associated with the control plane (for example, `node-role.kubernetes.io/control-plane`
  or `node-role.kubernetes.io/master`). It can also be useful to tolerate the
  `node.kubernetes.io/not-ready` taint to ensure that the cloud controller can run even when the
  node is not yet available for health monitoring.

For cloud-controller-managers that will not be running on the cluster they manage (for example,
in a hosted control plane on a separate cluster), then the rules are much more constrained by the
dependencies of the environment of the cluster running the cloud-controller-manager. The advice
for running on a self-managed cluster may not be appropriate as the types of conflicts and network
constraints will be different. Please consult the architecture and requirements of your topology
for these scenarios.
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;确保污点容忍规则允许操作。在云控制器管理器容器的清单中使用污点容忍规则，以确保其能够被调度到正确的节点，
并能够在节点初始化时运行。这意味着云控制器应容忍 &lt;code&gt;node.cloudprovider.kubernetes.io/uninitialized&lt;/code&gt;
污点，还应容忍与控制平面相关的任何污点（例如，&lt;code&gt;node-role.kubernetes.io/control-plane&lt;/code&gt; 或
&lt;code&gt;node-role.kubernetes.io/master&lt;/code&gt;）。容忍 &lt;code&gt;node.kubernetes.io/not-ready&lt;/code&gt; 污点也可能很有用，
以确保即使节点尚未准备好进行健康监控时，云控制器仍能运行。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;对于不在其所管理的集群上（例如，在其他集群上的托管控制平面上）运行的云控制器管理器，
其规则将更多地受限于运行云控制器管理器的集群环境的依赖项。针对自管集群的运行建议可能不适用，
因为冲突类型和网络约束会有所不同。请根据这些场景咨询你的拓扑结构的架构和需求。&lt;/p&gt;
&lt;!--
### Example

This is an example of a Kubernetes Deployment highlighting the guidance shown above. It is
important to note that this is for demonstration purposes only, for production uses please
consult your cloud provider’s documentation.
--&gt;
&lt;h3 id=&#34;示例&#34;&gt;示例&lt;/h3&gt;
&lt;p&gt;这是一个 Kubernetes Deployment 的示例，突显了上述指导原则。需要注意的是，
此示例仅用于演示目的，对于生产环境的使用，请参考你的云提供商的文档。&lt;/p&gt;
&lt;!--
```
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: cloud-controller-manager
  name: cloud-controller-manager
  namespace: kube-system
spec:
  replicas: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: cloud-controller-manager
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: cloud-controller-manager
      annotations:
        kubernetes.io/description: Cloud controller manager for my infrastructure
    spec:
      containers: # the container details will depend on your specific cloud controller manager
      - name: cloud-controller-manager
        command:
        - /bin/my-infrastructure-cloud-controller-manager
        - --leader-elect=true
        - -v=1
        image: registry/my-infrastructure-cloud-controller-manager@latest
        resources:
          requests:
            cpu: 200m
            memory: 50Mi
      hostNetwork: true # these Pods are part of the control plane
      nodeSelector:
        node-role.kubernetes.io/control-plane: &#34;&#34;
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - topologyKey: &#34;kubernetes.io/hostname&#34;
            labelSelector:
              matchLabels:
                app.kubernetes.io/name: cloud-controller-manager
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
        operator: Exists
      - effect: NoExecute
        key: node.kubernetes.io/unreachable
        operator: Exists
        tolerationSeconds: 120
      - effect: NoExecute
        key: node.kubernetes.io/not-ready
        operator: Exists
        tolerationSeconds: 120
      - effect: NoSchedule
        key: node.cloudprovider.kubernetes.io/uninitialized
        operator: Exists
      - effect: NoSchedule
        key: node.kubernetes.io/not-ready
        operator: Exists
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;apps/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Deployment&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app.kubernetes.io/name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;kube-system&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;replicas&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app.kubernetes.io/name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;strategy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Recreate&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app.kubernetes.io/name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;annotations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kubernetes.io/description&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Cloud controller manager for my infrastructure&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 容器的详细信息将取决于你具体的云控制器管理器&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- /bin/my-infrastructure-cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- --leader-elect=true&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- -v=1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;registry/my-infrastructure-cloud-controller-manager@latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requests&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cpu&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;200m&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;memory&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;50Mi&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostNetwork&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 这些 Pod 是控制平面的一部分&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;nodeSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;node-role.kubernetes.io/control-plane&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;affinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAntiAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;kubernetes.io/hostname&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;              &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;                &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app.kubernetes.io/name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cloud-controller-manager&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tolerations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;effect&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NoSchedule&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-role.kubernetes.io/master&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;effect&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NoExecute&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node.kubernetes.io/unreachable&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tolerationSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;120&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;effect&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NoExecute&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node.kubernetes.io/not-ready&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tolerationSeconds&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;120&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;effect&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NoSchedule&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node.cloudprovider.kubernetes.io/uninitialized&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;effect&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NoSchedule&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node.kubernetes.io/not-ready&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
When deciding how to deploy your cloud controller manager it is worth noting that
cluster-proportional, or resource-based, pod autoscaling is not recommended. Running multiple
replicas of a cloud controller manager is good practice for ensuring high-availability and
redundancy, but does not contribute to better performance. In general, only a single instance
of a cloud controller manager will be reconciling a cluster at any given time.
--&gt;
&lt;p&gt;在决定如何部署云控制器管理器时，需要注意的是，不建议使用与集群规模成比例的或基于资源的 Pod
自动规模扩缩。运行多个云控制器管理器副本是确保高可用性和冗余的良好实践，但这并不会提高性能。
通常情况下，任何时候只有一个云控制器管理器实例会负责协调集群。&lt;/p&gt;
&lt;!--
[migration-blog]: /blog/2024/05/20/completing-cloud-provider-migration/
[kep2392]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2392-cloud-controller-manager/README.md
[kep1281]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1281-network-proxy
[kep2133]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2133-kubelet-credential-providers
[csi]: https://github.com/container-storage-interface/spec?tab=readme-ov-file#container-storage-interface-csi-specification-
[kep625]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/625-csi-migration/README.md
[ccm]: /docs/concepts/architecture/cloud-controller/
[chicken-and-egg]: /docs/tasks/administer-cluster/running-cloud-controller/#chicken-and-egg
[kubedocs0]: /docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager
[kubedocs1]: /docs/reference/labels-annotations-taints/#node-kubernetes-io-not-ready
--&gt;

      </description>
    </item>
    
    <item>
      <title>聚焦 SIG Architecture: Enhancements</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/01/21/sig-architecture-enhancements/</link>
      <pubDate>Tue, 21 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2025/01/21/sig-architecture-enhancements/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Architecture: Enhancements&#34;
slug: sig-architecture-enhancements
canonicalUrl: https://www.kubernetes.dev/blog/2025/01/21/sig-architecture-enhancements
date: 2025-01-21
author: &#34;Frederico Muñoz (SAS Institute)&#34;
--&gt;
&lt;!--
_This is the fourth interview of a SIG Architecture Spotlight series that will cover the different
subprojects, and we will be covering [SIG Architecture:
Enhancements](https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#enhancements)._

In this SIG Architecture spotlight we talked with [Kirsten
Garrison](https://github.com/kikisdeliveryservice), lead of the Enhancements subproject.
--&gt;
&lt;p&gt;&lt;strong&gt;这是 SIG Architecture 聚光灯系列的第四次采访，我们将介绍
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#enhancements&#34;&gt;SIG Architecture: Enhancements&lt;/a&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在本次 SIG Architecture 专题采访中，我们访谈了 Enhancements
子项目的负责人 &lt;a href=&#34;https://github.com/kikisdeliveryservice&#34;&gt;Kirsten Garrison&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## The Enhancements subproject

**Frederico (FSM): Hi Kirsten, very happy to have the opportunity to talk about the Enhancements
subproject. Let&#39;s start with some quick information about yourself and your role.**
--&gt;
&lt;h2 id=&#34;enhancements-子项目&#34;&gt;Enhancements 子项目&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Frederico (FSM)：你好 Kirsten，很高兴有机会讨论 Enhancements
子项目。开始请先介绍一下你自己和所承担的职责。&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**Kirsten Garrison (KG)**: I’m a lead of the Enhancements subproject of SIG-Architecture and
currently work at Google. I first got involved by contributing to the service-catalog project with
the help of [Carolyn Van Slyck](https://github.com/carolynvs). With time, [I joined the Release
team](https://github.com/kubernetes/sig-release/blob/master/releases/release-1.17/release_team.md),
eventually becoming the Enhancements Lead and a Release Lead shadow. While on the release team, I
worked on some ideas to make the process better for the SIGs and Enhancements team (the opt-in
process) based on my team’s experiences. Eventually, I started attending Subproject meetings and
contributing to the Subproject’s work.
--&gt;
&lt;p&gt;&lt;strong&gt;Kirsten Garrison (KG)&lt;/strong&gt;：我是 SIG-Architecture 的 Enhancements 子项目的负责人，目前就职于 Google。
我最初在 &lt;a href=&#34;https://github.com/carolynvs&#34;&gt;Carolyn Van Slyck&lt;/a&gt; 的帮助下，为 service-catalog 项目贡献代码，
后来&lt;a href=&#34;https://github.com/kubernetes/sig-release/blob/master/releases/release-1.17/release_team.md&#34;&gt;加入了 Release 团队&lt;/a&gt;，
最终成为 Enhancements Lead 和 Release Lead 影子。
在发布团队工作期间，我根据团队的经验为 SIG 和 Enhancements 团队提出了一些改进流程的想法（如参与其中的流程）。
之后，我开始参加子项目会议，并为这个子项目的工作做贡献。&lt;/p&gt;
&lt;!--
**FSM: You mentioned the Enhancements subproject: how would you describe its main goals and areas of
intervention?**

**KG**: The [Enhancements
Subproject](https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#enhancements)
primarily concerns itself with the [Kubernetes Enhancement
Proposal](https://github.com/kubernetes/enhancements/blob/master/keps/sig-architecture/0000-kep-process/README.md)
(_KEP_ for short)—the &#34;design&#34; documents required for all features and significant changes
to the Kubernetes project.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：你提到了 Enhancements 子项目，你如何描述它的主要目标和干预范围？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#enhancements&#34;&gt;Enhancements 子项目&lt;/a&gt;的核心是管理
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-architecture/0000-kep-process/README.md&#34;&gt;Kubernetes 增强提案（KEP）&lt;/a&gt;，
这是 Kubernetes 项目所有特性和重大变更的“设计”文档。&lt;/p&gt;
&lt;!--
## The KEP and its impact

**FSM: The improvement of the KEP process was (and is) one in which SIG Architecture was heavily
involved. Could you explain the process to those that aren’t aware of it?**
--&gt;
&lt;h2 id=&#34;the-kep-and-its-impact&#34;&gt;KEP 及其影响   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：KEP 流程的改进一直是 SIG Architecture 深度参与的工作之一。你能为不了解的人介绍一下这个流程吗？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**KG**: [Every release](https://kubernetes.io/releases/release/#the-release-cycle), the SIGs let the
Release Team know which features they intend to work on to be put into the release. As mentioned
above, the prerequisite for these changes is a KEP - a standardized design document that all authors
must fill out and approve in the first weeks of the release cycle. Most features [will move
through 3
phases](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-stages):
alpha, beta and finally GA so approving a feature represents a significant commitment for the SIG.
--&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：在&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/releases/release/#the-release-cycle&#34;&gt;每次发布版本&lt;/a&gt;时，各个
SIG 需要告知 Release Team 各自计划将哪些特性放到当前的版本发布中。
正如前面提到的，所有变更的前提是有一个 KEP，这是一种标准化的设计文档，
所有 KEP 的作者必须在发布周期的最初几周内填写完并获得批准。
大多数特性&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/#feature-stages&#34;&gt;会经历三个阶段&lt;/a&gt;：
Alpha、Beta，最终进入 GA，因此批准一个特性对 SIG 来说是一项重大承诺。&lt;/p&gt;
&lt;!--
The KEP serves as the full source of truth of a feature. The [KEP
template](https://github.com/kubernetes/enhancements/blob/master/keps/NNNN-kep-template/README.md)
has different requirements based on what stage a feature is in, but it generally requires a detailed
discussion of the design and the impact as well as providing artifacts of stability and
performance. The KEP takes quite a bit of iterative work between authors, SIG reviewers, api review
team and the Production Readiness Review team[^1] before it is approved. Each set of reviewers is
looking to make sure that the proposal meets their standards in order to have a stable and
performant Kubernetes release. Only after all approvals are secured, can an author go forth and
merge their feature in the Kubernetes code base.
--&gt;
&lt;p&gt;KEP 作为某个特性真实、完整的信息来源。
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/NNNN-kep-template/README.md&#34;&gt;KEP 模板&lt;/a&gt;
对处于不同阶段的特性具有不同的要求，但通常需要详细讨论其设计、影响，并提供稳定性和性能的证明材料。
KEP 通常会在作者、SIG 审查人员、API 审查团队和 Production Readiness Review 团队&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;之间进行多轮迭代后才能获批。
每组审查者都会确保提案符合其标准，以保证 Kubernetes 版本的稳定性和性能。
只有在所有审批完成后，作者才能将其特性合并到 Kubernetes 代码库。&lt;/p&gt;
&lt;!--
**FSM: I see, quite a bit of additional structure was added. Looking back, what were the most
significant improvements of that approach?**

**KG**: In general, I think that the improvements with the most impact had to do with focusing on
the core intent of the KEP. KEPs exist not just to memorialize designs, but provide a structured way
to discuss and come to an agreement about different facets of the change. At the core of the KEP
process is communication and consideration.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：我懂了，新增了一些结构。回顾来看，你认为这种流程方法最重要的改进是什么？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：总体而言，我认为最有影响力的改进在于聚焦 KEP 的核心意图。
KEP 不仅仅是设计的存档文件，更是提供了一种结构化的方式来讨论和达成共识。
KEP 流程的核心是沟通和审慎考虑。&lt;/p&gt;
&lt;!--
To that end, some of the significant changes revolve around a more detailed and accessible KEP
template. A significant amount of work was put in over time to get the
[k/enhancements](https://github.com/kubernetes/enhancements) repo into its current form -- a
directory structure organized by SIG with the contours of the modern KEP template (with
Proposal/Motivation/Design Details subsections). We might take that basic structure for granted
today, but it really represents the work of many people trying to get the foundation of this process
in place over time.
--&gt;
&lt;p&gt;为此，一些重要的改进围绕着更详细且更易于访问的 KEP 模板展开。
我们投入了大量时间，使 &lt;a href=&#34;https://github.com/kubernetes/enhancements&#34;&gt;k/enhancements&lt;/a&gt;
仓库发展成当前的形式：目录结构按 SIG 小组划分，附带现代 KEP 模板文件，
其中包含 Proposal/Motivation/Design Details（提案/动机/设计细节）等小节。
我们今天可能认为这种基本结构是理所当然的，但它实际上代表付出了许多人力和时间努力工作才奠定了这一流程基础。&lt;/p&gt;
&lt;!--
As Kubernetes matures, we’ve needed to think about more than just the end goal of getting a single
feature merged. We need to think about things like: stability, performance, setting and meeting user
expectations. And as we’ve thought about those things the template has grown more detailed. The
addition of the Production Readiness Review was major as well as the enhanced testing requirements
(varying at different stages of a KEP’s lifecycle).
--&gt;
&lt;p&gt;随着 Kubernetes 的发展和成熟，我们需要考虑的不仅仅是如何合并单个特性，还需要关注稳定性、性能、设置和用户期望等问题。
因此随着我们的思考深入，KEP 模板变得更详细。例如增加了 Production Readiness Review 机制，同时对测试要求进行了强化
（这些要求会随着 KEP 生命周期的不同阶段动态调整）。&lt;/p&gt;
&lt;!--
## Current areas of focus

**FSM: Speaking of maturing, we’ve [recently released Kubernetes
v1.31](https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/), and work on v1.32 [has
started](https://github.com/fsmunoz/sig-release/tree/release-1.32/releases/release-1.32). Are there
any areas that the Enhancements sub-project is currently addressing that might change the way things
are done?**
--&gt;
&lt;h2 id=&#34;current-areas-of-focus&#34;&gt;当前关注领域  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：说到发展，我们&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/13/kubernetes-v1-31-release/&#34;&gt;最近发布了 Kubernetes v1.31&lt;/a&gt;，
而 v1.32 版本的开发工作&lt;a href=&#34;https://github.com/fsmunoz/sig-release/tree/release-1.32/releases/release-1.32&#34;&gt;已经开始&lt;/a&gt;。
Enhancements 子项目目前有哪些领域正在推进以改进这个流程？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**KG**: We’re currently working on two things:

  1) _Creating a Process KEP template._ Sometimes people want to harness the KEP process for
  significant changes that are more process oriented rather than feature oriented. We want to
  support this because memorializing changes is important and giving people a better tool to do so
  will only encourage more discussion and transparency.
  2) _KEP versioning._ While our template changes aim to be as non-disruptive as possible, we
  believe that it will be easier to track and communicate those changes to the community better with
  a versioned KEP template and the policies that go alongside such versioning.
--&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：我们目前正在进行两项工作：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;创建一个 Process KEP 模板&lt;/strong&gt;。有时，人们希望使用 KEP 流程来记录重要的流程变更，而不是特性变更。
我们希望支持这一点，因为记录变更很重要，为此提供更好的工具将鼓励更多的讨论和更透明。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;KEP 版本化&lt;/strong&gt;。虽然我们的模板变更旨在尽量减少破坏性影响，但我们认为引入 KEP 版本化及相应的策略，
可以让变更更易于追踪并更好地与社区沟通。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Both features will take some time to get right and fully roll out (just like a KEP feature) but we
believe that they will both provide improvements that will benefit the community at large.

**FSM: You mentioned improvements: I remember when project boards for Enhancement tracking were
introduced in recent releases, to great effect and unanimous applause from release team members. Was
this a particular area of focus for the subproject?**
--&gt;
&lt;p&gt;这两项改进都需要时间来完善和推广（就像 KEP 特性本身一样），但我们相信它们最终会给社区带来很大的好处。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;FSM：你提到了改进：我记得最近的发布引入了用于 Enhancement 追踪的项目看板（Project Board），
发布团队成员对此表示一致好评。这是 Enhancements 子项目的一个重点方向吗？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**KG**: The Subproject provided support to the Release Team’s Enhancement team in the migration away
from using the spreadsheet to a project board. The collection and tracking of enhancements has
always been a logistical challenge. During my time on the Release Team, I helped with the transition
to an opt-in system of enhancements, whereby the SIG leads &#34;opt-in&#34; KEPs for release tracking. This
helped to enhance communication between authors and SIGs before any significant work was undertaken
on a KEP and removed toil from the Enhancements team. This change used the existing tools to avoid
introducing too many changes at once to the community. Later, the Release Team approached the
Subproject with an idea of leveraging GitHub Project Boards to further improve the collection
process. This was to be a move away from the use of complicated spreadsheets to using repo-native
labels on [k/enhancement](https://github.com/kubernetes/enhancements) issues and project boards.
--&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：Enhancements 子项目为 Release Team 的 Enhancement 团队提供支持，从使用电子表格迁移到一个项目看板。
增强提案的收集和跟踪一直是后勤支持的一项挑战。在我担任 Release Team 成员期间，我帮助推动了增强的“选择加入”机制，
即 SIG 负责人需要主动“选择加入” KEP 进行发布追踪。
这有助于在对 KEP 实施重大工作之前，加强作者与 SIG 之间的沟通，并减少 Enhancements 团队的重复工作。
这一变更利用了现有工具，以避免一次性向社区引入过多变化。
后来，Release Team 向子项目提出了利用 GitHub 项目看板进一步改进收集流程的想法。
这一举措旨在从使用复杂的电子表格转为使用 &lt;a href=&#34;https://github.com/kubernetes/enhancements&#34;&gt;k/enhancement&lt;/a&gt;
Issues 和项目看板上的原生仓库标签。&lt;/p&gt;
&lt;!--
**FSM: That surely adds an impact on simplifying the workflow...**

**KG**: Removing sources of friction and promoting clear communication is very important to the
Enhancements Subproject.  At the same time, it’s important to give careful consideration to
decisions that impact the community as a whole. We want to make sure that changes are balanced to
give an upside and while not causing any regressions and pain in the rollout. We supported the
Release Team in ideation as well as through the actual migration to the project boards. It was a
great success and exciting to see the team make high impact changes that helped everyone involved in
the KEP process!
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：这无疑简化了工作流程...&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：减少摩擦来源、促进清晰沟通对 Enhancements 子项目至关重要。同时，我们也需要谨慎考虑影响整个社区的决策。
我们希望确保变更既带来好处，又不会在推广过程中造成回归或额外负担。
我们支持 Release Team 进行头脑风暴，并协助完成迁移到项目看板的工作。
这次变更取得了巨大成功，很高兴看到团队做出了高影响力的改进，使所有参与 KEP 流程的每个人受益！&lt;/p&gt;
&lt;!--
## Getting involved

**FSM: For those reading that might be curious and interested in helping, how would you describe the
required skills for participating in the sub-project?**

**KG**: Familiarity with KEPs either via experience or taking time to look through the
kubernetes/enhancements repo is helpful. All are welcome to participate if interested - we can take
it from there.
--&gt;
&lt;h2 id=&#34;getting-involved&#34;&gt;如何参与  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：如果有人想要参与 Enhancements 子项目，你认为需要具备哪些技能？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：熟悉 KEP 机制，无论是通过体验，还是花时间阅读
&lt;a href=&#34;https://github.com/kubernetes/enhancements&#34;&gt;kubernetes/enhancements&lt;/a&gt; 仓库都会有所帮助。
我们欢迎所有感兴趣的人参与，我们可以一步步引导他们。&lt;/p&gt;
&lt;!--
**FSM: Excellent! Many thanks for your time and insight -- any final comments you would like to
share with our readers?**

**KG**: The Enhancements process is one of the most important parts of Kubernetes and requires
enormous amounts of coordination and collaboration of people and teams across the project to make it
successful. I’m thankful and inspired by everyone’s continued hard work and dedication to making the
project great. This is truly a wonderful community.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：太棒了！非常感谢你的时间和分享——最后你有什么想对读者们说的吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KG&lt;/strong&gt;：Enhancements 流程是 Kubernetes 生态中最重要组成部分之一，需要各个团队的密切协作才能成功。
我很感激并敬佩大家持续不断的努力工作和奉献，让这个项目越来越好。这真是一个很棒的社区。&lt;/p&gt;
&lt;!--
[^1]: For more information, check the [Production Readiness Review spotlight
    interview](https://kubernetes.io/blog/2023/11/02/sig-architecture-production-readiness-spotlight-2023/)
    in this series.
--&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;更多信息参考 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2023/11/02/sig-architecture-production-readiness-spotlight-2023/&#34;&gt;Production Readiness Review 专题采访&lt;/a&gt;。&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

      </description>
    </item>
    
    <item>
      <title>使用 API 流式传输来增强 Kubernetes API 服务器效率</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/17/kube-apiserver-api-streaming/</link>
      <pubDate>Tue, 17 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/17/kube-apiserver-api-streaming/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Enhancing Kubernetes API Server Efficiency with API Streaming&#39;
date: 2024-12-17
slug: kube-apiserver-api-streaming
author: &gt;
 Stefan Schimanski (Upbound),
 Wojciech Tyczynski (Google),
 Lukasz Szaszkiewicz (Red Hat)
--&gt;
&lt;!--
Managing Kubernetes clusters efficiently is critical, especially as their size is growing. 
A significant challenge with large clusters is the memory overhead caused by **list** requests.
--&gt;
&lt;p&gt;高效管理 Kubernetes 集群至关重要，特别是在集群规模不断增长的情况下更是如此。
大型集群面临的一个重大挑战是 &lt;strong&gt;list&lt;/strong&gt; 请求所造成的内存开销。&lt;/p&gt;
&lt;!--
In the existing implementation, the kube-apiserver processes **list** requests by assembling the entire response in-memory before transmitting any data to the client. 
But what if the response body is substantial, say hundreds of megabytes? Additionally, imagine a scenario where multiple **list** requests flood in simultaneously, perhaps after a brief network outage. 
While [API Priority and Fairness](/docs/concepts/cluster-administration/flow-control) has proven to reasonably protect kube-apiserver from CPU overload, its impact is visibly smaller for memory protection. 
This can be explained by the differing nature of resource consumption by a single API request - the CPU usage at any given time is capped by a constant, whereas memory, being uncompressible, can grow proportionally with the number of processed objects and is unbounded.
This situation poses a genuine risk, potentially overwhelming and crashing any kube-apiserver within seconds due to out-of-memory (OOM) conditions. To better visualize the issue, let&#39;s consider the below graph.
--&gt;
&lt;p&gt;在现有的实现中，kube-apiserver 在处理 &lt;strong&gt;list&lt;/strong&gt; 请求时，先在内存中组装整个响应，再将所有数据传输给客户端。
但如果响应体非常庞大，比如数百兆字节呢？另外再想象这样一种场景，有多个 &lt;strong&gt;list&lt;/strong&gt; 请求同时涌入，可能是在短暂的网络中断后涌入。
虽然 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/flow-control&#34;&gt;API 优先级和公平性&lt;/a&gt;已经证明可以合理地保护
kube-apiserver 免受 CPU 过载，但其对内存保护的影响却明显较弱。这可以解释为各个 API 请求的资源消耗性质有所不同。
在任何给定时间，CPU 使用量都会受到某个常量的限制，而内存由于不可压缩，会随着处理对象数量的增加而成比例增长，且没有上限。
这种情况会带来真正的风险，kube-apiserver 可能会在几秒钟内因内存不足（OOM）状况而淹没和崩溃。
为了更直观地查验这个问题，我们看看下面的图表。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/17/kube-apiserver-api-streaming/kube-apiserver-memory_usage.png&#34;
         alt=&#34;Monitoring graph showing kube-apiserver memory usage&#34;/&gt; 
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/17/kube-apiserver-api-streaming/kube-apiserver-memory_usage.png&#34;
         alt=&#34;显示 kube-apiserver 内存使用量的监控图表&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
The graph shows the memory usage of a kube-apiserver during a synthetic test.
(see the [synthetic test](#the-synthetic-test) section for more details).
The results clearly show that increasing the number of informers significantly boosts the server&#39;s memory consumption. 
Notably, at approximately 16:40, the server crashed when serving only 16 informers.
--&gt;
&lt;p&gt;以上图表显示了 kube-apiserver 在一次模拟测试中的内存使用情况。
（有关更多细节，参见&lt;a href=&#34;#the-synthetic-test&#34;&gt;模拟测试&lt;/a&gt;一节）。
结果清楚地表明，增加 informer 的数量显著提高了服务器的内存消耗量。
值得注意的是，在大约 16:40 时，服务器在仅提供了 16 个 informer 时就崩溃了。&lt;/p&gt;
&lt;!--
## Why does kube-apiserver allocate so much memory for list requests?

Our investigation revealed that this substantial memory allocation occurs because the server before sending the first byte to the client must:
* fetch data from the database,
* deserialize the data from its stored format,
* and finally construct the final response by converting and serializing the data into a client requested format
--&gt;
&lt;h2 id=&#34;why-does-kube-apiserver-allocates-so-much-memory-for-list-requests&#34;&gt;为什么 kube-apiserver 为 list 请求分配这么多内存？  &lt;/h2&gt;
&lt;p&gt;我们的调查显示，这种大量内存分配的发生是因为在向客户端发送第一个字节之前，服务器必须：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;从数据库中获取数据&lt;/li&gt;
&lt;li&gt;对数据执行从其存储格式的反序列化&lt;/li&gt;
&lt;li&gt;最后通过将数据转换和序列化为客户端所请求的格式来构造最终的响应。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
This sequence results in significant temporary memory consumption. 
The actual usage depends on many factors like the page size, applied filters (e.g. label selectors), query parameters, and sizes of individual objects. 

Unfortunately, neither [API Priority and Fairness](/docs/concepts/cluster-administration/flow-control) nor Golang&#39;s garbage collection or Golang memory limits can prevent the system from exhausting memory under these conditions. 
The memory is allocated suddenly and rapidly, and just a few requests can quickly deplete the available memory, leading to resource exhaustion.
--&gt;
&lt;p&gt;这个序列导致了显著的临时内存消耗。实际使用量取决于许多因素，
比如分页大小、所施加的过滤器（例如标签选择算符）、查询参数和单个对象的体量。&lt;/p&gt;
&lt;p&gt;不巧的是，无论是 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/flow-control&#34;&gt;API 优先级和公平性&lt;/a&gt;，
还是 Golang 的垃圾收集或 Golang 的内存限制，都无法在这些状况下防止系统耗尽内存。
内存是被突然且快速分配的，仅仅几个请求就可能迅速耗尽可用内存，导致资源耗尽。&lt;/p&gt;
&lt;!--
Depending on how the API server is run on the node, it might either be killed through OOM by the kernel when exceeding the configured memory limits during these uncontrolled spikes, or if limits are not configured it might have even worse impact on the control plane node.
And worst, after the first API server failure, the same requests will likely hit another control plane node in an HA setup with probably the same impact. 
Potentially a situation that is hard to diagnose and hard to recover from.
--&gt;
&lt;p&gt;取决于 API 服务器在节点上的运行方式，API 服务器可能在这些不受控制的峰值期间因为超过所配置的内存限制而被内核通过 OOM 杀死，
或者如果没有为服务器配置限制值，则其可能对控制平面节点产生更糟糕的影响。最糟糕的是，
在第一个 API 服务器出现故障后，相同的请求将很可能会影响高可用（HA）部署中的另一个控制平面节点，
并可能产生相同的影响。这可能是一个难以诊断和难以恢复的情况。&lt;/p&gt;
&lt;!--
## Streaming list requests

Today, we&#39;re excited to announce a major improvement. 
With the graduation of the _watch list_ feature to beta in Kubernetes 1.32, client-go users can opt-in (after explicitly enabling `WatchListClient` feature gate) 
to streaming lists by switching from **list** to (a special kind of) **watch** requests.
--&gt;
&lt;h2 id=&#34;streaming-list-requests&#34;&gt;流式处理 list 请求  &lt;/h2&gt;
&lt;p&gt;今天，我们很高兴地宣布一项重大改进。随着 Kubernetes 1.32 中 &lt;em&gt;watch list&lt;/em&gt; 特性进阶至 Beta，
client-go 用户可以选择（在显式启用 &lt;code&gt;WatchListClient&lt;/code&gt; 特性门控后）通过将 &lt;strong&gt;list&lt;/strong&gt; 请求切换为（某种特殊类别的）
&lt;strong&gt;watch&lt;/strong&gt; 请求来进行流式处理。&lt;/p&gt;
&lt;!--
**Watch** requests are served from the _watch cache_, an in-memory cache designed to improve scalability of read operations. 
By streaming each item individually instead of returning the entire collection, the new method maintains constant memory overhead. 
The API server is bound by the maximum allowed size of an object in etcd plus a few additional allocations. 
This approach drastically reduces the temporary memory usage compared to traditional **list** requests, ensuring a more efficient and stable system, 
especially in clusters with a large number of objects of a given type or large average object sizes where despite paging memory consumption used to be high.
--&gt;
&lt;p&gt;&lt;strong&gt;watch&lt;/strong&gt; 请求使用 &lt;strong&gt;监视缓存（watch cache）&lt;/strong&gt; 提供服务，监视缓存是设计来提高读操作扩缩容能力的一个内存缓存。
通过逐个流式传输每一项，而不是返回整个集合，这种新方法保持了恒定的内存开销。
API 服务器受限于 etcd 中对象的最大允许体量加上少量额外分配的内存。
与传统的 &lt;strong&gt;list&lt;/strong&gt; 请求相比，尤其是在分页情况下内存消耗仍较高的、具有大量特定类别的对象或对象体量平均较大的集群中，
这种方法大幅降低了临时内存使用量，确保了系统更高效和更稳定。&lt;/p&gt;
&lt;!--
Building on the insight gained from the synthetic test (see the [synthetic test](#the-synthetic-test), we developed an automated performance test to systematically evaluate the impact of the _watch list_ feature. 
This test replicates the same scenario, generating a large number of Secrets with a large payload, and scaling the number of informers to simulate heavy **list** request patterns. 
The automated test is executed periodically to monitor memory usage of the server with the feature enabled and disabled.
--&gt;
&lt;p&gt;基于模拟测试所了解的情况（参见&lt;a href=&#34;#the-synthetic-test&#34;&gt;模拟测试&lt;/a&gt;），我们开发了一种自动化的性能测试，
以系统地评估 &lt;em&gt;watch list&lt;/em&gt; 特性的影响。此测试能够重现相同的场景，生成大量载荷较大的 Secret，
并扩缩容 informer 的数量以模拟高频率的 &lt;strong&gt;list&lt;/strong&gt; 请求模式。
这种自动化测试被定期执行，以监控启用和禁用此特性后服务器的内存使用情况。&lt;/p&gt;
&lt;!--
The results showed significant improvements with the _watch list_ feature enabled. 
With the feature turned on, the kube-apiserver’s memory consumption stabilized at approximately **2 GB**. 
By contrast, with the feature disabled, memory usage increased to approximately **20GB**, a **10x** increase! 
These results confirm the effectiveness of the new streaming API, which reduces the temporary memory footprint.
--&gt;
&lt;p&gt;结果表明，启用 &lt;em&gt;watch list&lt;/em&gt; 特性后有显著改善。
启用此特性时，kube-apiserver 的内存消耗稳定在大约 &lt;strong&gt;2 GB&lt;/strong&gt;。
相比之下，禁用此特性时，内存使用量增加到约 &lt;strong&gt;20 GB&lt;/strong&gt;，增长了 &lt;strong&gt;10 倍&lt;/strong&gt;！
这些结果证实了新的流式 API 的有效性，减少了临时内存占用。&lt;/p&gt;
&lt;!--
## Enabling API Streaming for your component

Upgrade to Kubernetes 1.32. Make sure your cluster uses etcd in version 3.4.31+ or 3.5.13+.
Change your client software to use watch lists. If your client code is written in Golang, you&#39;ll want to enable `WatchListClient` for client-go. 
For details on enabling that feature, read [Introducing Feature Gates to Client-Go: Enhancing Flexibility and Control](/blog/2024/08/12/feature-gates-in-client-go).
--&gt;
&lt;h2 id=&#34;enabling-api-streaming-for-your-component&#34;&gt;为你的组件启用 API 流式传输  &lt;/h2&gt;
&lt;p&gt;升级到 Kubernetes 1.32。确保你的集群使用 etcd v3.4.31+ 或 v3.5.13+。将你的客户端软件更改为使用 watch list。
如果你的客户端代码是用 Golang 编写的，你将需要为 client-go 启用 &lt;code&gt;WatchListClient&lt;/code&gt;。有关启用该特性的细节，
参阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/12/feature-gates-in-client-go&#34;&gt;为 client-go 引入特性门控：增强灵活性和控制&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## What&#39;s next?
In Kubernetes 1.32, the feature is enabled in kube-controller-manager by default despite its beta state. 
This will eventually be expanded to other core components like kube-scheduler or kubelet; once the feature becomes generally available, if not earlier.
Other 3rd-party components are encouraged to opt-in to the feature during the beta phase, especially when they are at risk of accessing a large number of resources or kinds with potentially large object sizes.
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;接下来  &lt;/h2&gt;
&lt;p&gt;在 Kubernetes 1.32 中，尽管此特性处于 Beta 状态，但在 kube-controller-manager 中默认被启用。
一旦此特性进阶至正式发布（GA），或许更早，此特性最终将被扩展到 kube-scheduler 或 kubelet 这类其他核心组件。
我们鼓励其他第三方组件在此特性处于 Beta 阶段时选择使用此特性，特别是这些组件在有可能访问大量资源或对象体量较大的情况下。&lt;/p&gt;
&lt;!--
For the time being, [API Priority and Fairness](/docs/concepts/cluster-administration/flow-control) assigns a reasonable small cost to **list** requests. 
This is necessary to allow enough parallelism for the average case where **list** requests are cheap enough. 
But it does not match the spiky exceptional situation of many and large objects. 
Once the majority of the Kubernetes ecosystem has switched to _watch list_, the **list** cost estimation can be changed to larger values without risking degraded performance in the average case,
and with that increasing the protection against this kind of requests that can still hit the API server in the future.
--&gt;
&lt;p&gt;目前，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/flow-control&#34;&gt;API 优先级和公平性&lt;/a&gt;为
&lt;strong&gt;list&lt;/strong&gt; 请求带来了少量但合理的开销。这是必要的，以允许在通常 &lt;strong&gt;list&lt;/strong&gt; 请求开销足够低的情况下实现足够的并行性。
但这并不适用于对象数量众多、体量巨大的峰值异常情形。一旦大多数 Kubernetes 生态体系切换到 &lt;em&gt;watch list&lt;/em&gt; ，
就可以将 &lt;strong&gt;list&lt;/strong&gt; 开销估算调整为更大的值，而不必担心在平均情况下出现性能下降，
从而提高对未来可能仍会影响 API 服务器的此类请求的保护。&lt;/p&gt;
&lt;!--
## The synthetic test

In order to reproduce the issue, we conducted a manual test to understand the impact of **list** requests on kube-apiserver memory usage. 
In the test, we created 400 Secrets, each containing 1 MB of data, and used informers to retrieve all Secrets.
--&gt;
&lt;h2 id=&#34;the-synthetic-test&#34;&gt;模拟测试  &lt;/h2&gt;
&lt;p&gt;为了重现此问题，我们实施了手动测试，以了解 &lt;strong&gt;list&lt;/strong&gt; 请求对 kube-apiserver 内存使用量的影响。
在测试中，我们创建了 400 个 Secret，每个 Secret 包含 1 MB 的数据，并使用 informer 检索所有 Secret。&lt;/p&gt;
&lt;!--
The results were alarming, only 16 informers were needed to cause the test server to run out of memory and crash, demonstrating how quickly memory consumption can grow under such conditions.

Special shout out to [@deads2k](https://github.com/deads2k) for his help in shaping this feature.
--&gt;
&lt;p&gt;结果令人担忧，仅需 16 个 informer 就足以导致测试服务器内存耗尽并崩溃，展示了在这些状况下内存消耗快速增长的方式。&lt;/p&gt;
&lt;p&gt;特别感谢 &lt;a href=&#34;https://github.com/deads2k&#34;&gt;@deads2k&lt;/a&gt; 在构造此特性所提供的帮助。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.32 增加了新的 CPU Manager 静态策略选项用于严格 CPU 预留</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/16/cpumanager-strict-cpu-reservation/</link>
      <pubDate>Mon, 16 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/16/cpumanager-strict-cpu-reservation/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.32 Adds A New CPU Manager Static Policy Option For Strict CPU Reservation&#39;
date: 2024-12-16
slug: cpumanager-strict-cpu-reservation
author: &gt;
  [Jing Zhang](https://github.com/jingczhang) (Nokia)
--&gt;
&lt;!--
In Kubernetes v1.32, after years of community discussion, we are excited to introduce a
`strict-cpu-reservation` option for the [CPU Manager static policy](/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options).
This feature is currently in alpha, with the associated policy hidden by default. You can only use the
policy if you explicitly enable the alpha behavior in your cluster.
--&gt;
&lt;p&gt;在 Kubernetes v1.32 中，经过社区多年的讨论，我们很高兴地引入了
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options&#34;&gt;CPU Manager 静态策略&lt;/a&gt;的
&lt;code&gt;strict-cpu-reservation&lt;/code&gt; 选项。此特性当前处于 Alpha 阶段，默认情况下关联的策略是隐藏的。
只有在你的集群中明确启用了此 Alpha 行为后，才能使用此策略。&lt;/p&gt;
&lt;!--
## Understanding the feature

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.

If you want to protect your system daemons and interrupt processing, the obvious way is to use the `reservedSystemCPUs` option.
--&gt;
&lt;h2 id=&#34;理解此特性&#34;&gt;理解此特性&lt;/h2&gt;
&lt;p&gt;CPU Manager 静态策略用于减少延迟或提高性能。&lt;code&gt;reservedSystemCPUs&lt;/code&gt;
定义了一个明确的 CPU 集合，供操作系统系统守护进程和 Kubernetes 系统守护进程使用。
此选项专为 Telco/NFV 类型的使用场景设计，在这些场景中，不受控制的中断/计时器可能会影响工作负载的性能。
你可以使用此选项为系统/Kubernetes 守护进程以及中断/计时器定义明确的 CPU 集合，
从而使系统上的其余 CPU 可以专用于工作负载，并减少不受控制的中断/计时器带来的影响。
有关此参数的更多详细信息，请参阅
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/reserve-compute-resources/#explicitly-reserved-cpu-list&#34;&gt;显式预留的 CPU 列表&lt;/a&gt;
页面。&lt;/p&gt;
&lt;p&gt;如果你希望保护系统守护进程和中断处理，显而易见的方法是使用 &lt;code&gt;reservedSystemCPUs&lt;/code&gt; 选项。&lt;/p&gt;
&lt;!--
However, until the Kubernetes v1.32 release, this isolation was only implemented for guaranteed
pods that made requests for a whole number of CPUs. At pod admission time, the kubelet only
compares the CPU _requests_ against the allocatable CPUs. In Kubernetes, limits can be higher than
the requests; the previous implementation allowed burstable and best-effort pods to use up
the capacity of `reservedSystemCPUs`, which could then starve host OS services of CPU - and we
know that people saw this in real life deployments.
The existing behavior also made benchmarking (for both infrastructure and workloads) results inaccurate.

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.
--&gt;
&lt;p&gt;然而，在 Kubernetes v1.32 发布之前，这种隔离仅针对请求整数个 CPU
的 Guaranteed 类型 Pod 实现。在 Pod 准入时，kubelet 仅将 CPU
&lt;strong&gt;请求量&lt;/strong&gt;与可分配的 CPU 进行比较。在 Kubernetes 中，限制值可以高于请求值；
之前的实现允许 Burstable 和 BestEffort 类型的 Pod 使用 &lt;code&gt;reservedSystemCPUs&lt;/code&gt; 的容量，
这可能导致主机操作系统服务缺乏足够的 CPU 资源 —— 并且我们已经知道在实际部署中确实发生过这种情况。
现有的行为还导致基础设施和工作负载的基准测试结果不准确。&lt;/p&gt;
&lt;p&gt;当启用这个新的 &lt;code&gt;strict-cpu-reservation&lt;/code&gt; 策略选项后，CPU Manager
静态策略将不允许任何工作负载使用预留的系统 CPU 核心。&lt;/p&gt;
&lt;!--
## Enabling the feature

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.

With the following kubelet configuration:
--&gt;
&lt;h2 id=&#34;启用此特性&#34;&gt;启用此特性&lt;/h2&gt;
&lt;p&gt;要启用此特性，你需要同时开启 &lt;code&gt;CPUManagerPolicyAlphaOptions&lt;/code&gt; 特性门控和
&lt;code&gt;strict-cpu-reservation&lt;/code&gt; 策略选项。并且如果存在 &lt;code&gt;/var/lib/kubelet/cpu_manager_state&lt;/code&gt;
文件，则需要删除该文件并重启 kubelet。&lt;/p&gt;
&lt;p&gt;使用以下 kubelet 配置：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;KubeletConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;kubelet.config.k8s.io/v1beta1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;featureGates&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CPUManagerPolicyOptions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;CPUManagerPolicyAlphaOptions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cpuManagerPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;static&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cpuManagerPolicyOptions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;strict-cpu-reservation&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;reservedSystemCPUs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0,32,1,33,16,48&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
When `strict-cpu-reservation` is not set or set to false:
--&gt;
&lt;p&gt;当未设置 &lt;code&gt;strict-cpu-reservation&lt;/code&gt; 或将其设置为 false 时：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; cat /var/lib/kubelet/cpu_manager_state
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;{&amp;#34;policyName&amp;#34;:&amp;#34;static&amp;#34;,&amp;#34;defaultCpuSet&amp;#34;:&amp;#34;0-63&amp;#34;,&amp;#34;checksum&amp;#34;:1058907510}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
When `strict-cpu-reservation` is set to true:
--&gt;
&lt;p&gt;当 &lt;code&gt;strict-cpu-reservation&lt;/code&gt; 设置为 true 时：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; cat /var/lib/kubelet/cpu_manager_state
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;{&amp;#34;policyName&amp;#34;:&amp;#34;static&amp;#34;,&amp;#34;defaultCpuSet&amp;#34;:&amp;#34;2-15,17-31,34-47,49-63&amp;#34;,&amp;#34;checksum&amp;#34;:4141502832}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Monitoring the feature

You can monitor the feature impact by checking the following CPU Manager counters:
- `cpu_manager_shared_pool_size_millicores`: report shared pool size, in millicores (e.g. 13500m)
- `cpu_manager_exclusive_cpu_allocation_count`: report exclusively allocated cores, counting full cores (e.g. 16)
--&gt;
&lt;h2 id=&#34;监控此特性&#34;&gt;监控此特性&lt;/h2&gt;
&lt;p&gt;你可以通过检查以下 CPU Manager 计数器来监控该特性的影响：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cpu_manager_shared_pool_size_millicores&lt;/code&gt;：报告共享池大小，以毫核为单位（例如 13500m）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cpu_manager_exclusive_cpu_allocation_count&lt;/code&gt;：报告独占分配的核心数，按完整核心计数（例如 16）&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Your best-effort workloads may starve if the `cpu_manager_shared_pool_size_millicores` count is zero for prolonged time.

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.
--&gt;
&lt;p&gt;如果 &lt;code&gt;cpu_manager_shared_pool_size_millicores&lt;/code&gt; 计数在长时间内为零，
你的 BestEffort 类型工作负载可能会因资源匮乏而受到影响。&lt;/p&gt;
&lt;p&gt;我们建议，任何用于操作目的的 Pod（如日志转发器）都不应以 BestEffort 方式运行，
但你可以根据需要审查并调整预留的 CPU 核心数量。&lt;/p&gt;
&lt;!--
## Conclusion

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.

We want you to start using the feature and looking forward to your feedback.
--&gt;
&lt;h2 id=&#34;总结&#34;&gt;总结&lt;/h2&gt;
&lt;p&gt;严格的 CPU 预留对于 Telco/NFV 使用场景至关重要。
它也是启用一体化部署类型（其中工作负载被放置在同时担任控制面节点、工作节点和存储角色的节点上）的前提条件。&lt;/p&gt;
&lt;p&gt;我们希望你开始使用该特性，并期待你的反馈。&lt;/p&gt;
&lt;!--
## Further reading

Please check out the [Control CPU Management Policies on the Node](/docs/tasks/administer-cluster/cpu-management-policies/)
task page to learn more about the CPU Manager, and how it fits in relation to the other node-level resource managers.
--&gt;
&lt;h2 id=&#34;进一步阅读&#34;&gt;进一步阅读&lt;/h2&gt;
&lt;p&gt;请查看&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/&#34;&gt;节点上的控制 CPU 管理策略&lt;/a&gt;任务页面，
以了解更多关于 CPU Manager 的信息，以及它如何与其他节点级资源管理器相关联。&lt;/p&gt;
&lt;!--
## Getting involved

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.
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;此特性由 &lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-node/README.md&#34;&gt;SIG Node&lt;/a&gt;
推动。如果你有兴趣帮助开发此特性、分享反馈或参与任何其他正在进行的 SIG Node 项目，
请参加 SIG Node 会议以获取更多详情。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.32：内存管理器进阶至 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/13/memory-manager-goes-ga/</link>
      <pubDate>Fri, 13 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/13/memory-manager-goes-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.32: Memory Manager Goes GA&#34;
date: 2024-12-13
slug: memory-manager-goes-ga
author: &gt;
  [Talor Itzhak](https://github.com/Tal-or) (Red Hat)
--&gt;
&lt;!--
With Kubernetes 1.32, the memory manager has officially graduated to General Availability (GA),
marking a significant milestone in the journey toward efficient and predictable memory allocation for containerized applications.
Since Kubernetes v1.22, where it graduated to beta, the memory manager has proved itself reliable, stable and a good complementary feature for the
[CPU Manager](/docs/tasks/administer-cluster/cpu-management-policies/).
--&gt;
&lt;p&gt;随着 Kubernetes 1.32 的发布，内存管理器已进阶至正式发布（GA），
这标志着在为容器化应用实现高效和可预测的内存分配的旅程中迈出了重要的一步。
内存管理器自 Kubernetes v1.22 进阶至 Beta 后，其可靠性、稳定性已得到证实，
是 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/&#34;&gt;CPU 管理器&lt;/a&gt;的一个良好补充特性。&lt;/p&gt;
&lt;!--
As part of kubelet&#39;s workload admission process, 
the memory manager provides topology hints 
to optimize memory allocation and alignment. 
This enables users to allocate exclusive
memory for Pods in the [Guaranteed](/docs/concepts/workloads/pods/pod-qos/#guaranteed) QoS class.
More details about the process can be found in the memory manager goes to beta [blog](/blog/2021/08/11/kubernetes-1-22-feature-memory-manager-moves-to-beta/).
--&gt;
&lt;p&gt;作为 kubelet 的工作负载准入过程的一部分，内存管理器提供拓扑提示以优化内存分配和对齐。这使得用户能够为
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-qos/#guaranteed&#34;&gt;Guaranteed&lt;/a&gt; QoS 类的 Pod 分配独占的内存。
有关此过程的细节，参见博客：&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2021/08/11/kubernetes-1-22-feature-memory-manager-moves-to-beta/&#34;&gt;内存管理器进阶至 Beta&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Most of the changes introduced since the Beta are bug fixes, internal refactoring and 
observability improvements, such as metrics and better logging.
--&gt;
&lt;p&gt;自 Beta 以来引入的大部分变更是修复 Bug、内部重构以及改进可观测性（例如优化指标和日志）。&lt;/p&gt;
&lt;!--
## Observability improvements

As part of the effort
to increase the observability of memory manager, new metrics have been added
to provide some statistics on memory allocation patterns.
--&gt;
&lt;h2 id=&#34;observability-improvements&#34;&gt;改进可观测性  &lt;/h2&gt;
&lt;p&gt;作为提高内存管理器可观测性工作的一部分，新增了一些指标以提供关于内存分配模式的某些统计信息。&lt;/p&gt;
&lt;!--
* **memory_manager_pinning_requests_total** -
tracks the number of times the pod spec required the memory manager to pin memory pages.

* **memory_manager_pinning_errors_total** - 
tracks the number of times the pod spec required the memory manager 
to pin memory pages, but the allocation failed.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;memory_manager_pinning_requests_total&lt;/strong&gt; -
跟踪 Pod 规约要求内存管理器锁定内存页的次数。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;memory_manager_pinning_errors_total&lt;/strong&gt; -
跟踪 Pod 规约要求内存管理器锁定内存页但分配失败的次数。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Improving memory manager reliability and consistency

The kubelet does not guarantee pod ordering
when admitting pods after a restart or reboot.

In certain edge cases, this behavior could cause
the memory manager to reject some pods,
and in more extreme cases, it may cause kubelet to fail upon restart.
--&gt;
&lt;h2 id=&#34;improving-memory-manager-reliability-and-consistency&#34;&gt;提高内存管理器可靠性和一致性  &lt;/h2&gt;
&lt;p&gt;kubelet 不保证在 Pod 重启或重新引导后准入 Pod 的顺序。&lt;/p&gt;
&lt;p&gt;在某些边缘情况下，这种行为可能导致内存管理器拒绝某些 Pod，
在更极端的情况下，可能导致 kubelet 在重启时失败。&lt;/p&gt;
&lt;!--
Previously, the beta implementation lacked certain checks and logic to prevent 
these issues.

To stabilize the memory manager for general availability (GA) readiness,
small but critical refinements have been
made to the algorithm, improving its robustness and handling of edge cases.
--&gt;
&lt;p&gt;以前，Beta 实现缺乏某些检查和逻辑来防止这些问题的发生。&lt;/p&gt;
&lt;p&gt;为了使内存管理器更为稳定，以便为进阶至正式发布（GA）做好准备，
我们对算法进行了小而美的改进，提高了其稳健性和对边缘场景的处理能力。&lt;/p&gt;
&lt;!--
## Future development

There is more to come for the future of Topology Manager in general,
and memory manager in particular.
Notably, ongoing efforts are underway
to extend [memory manager support to Windows](https://github.com/kubernetes/kubernetes/pull/128560),
enabling CPU and memory affinity on a Windows operating system.
--&gt;
&lt;h2 id=&#34;future-development&#34;&gt;未来发展  &lt;/h2&gt;
&lt;p&gt;总体而言，未来对拓扑管理器（Topology Manager），特别是内存管理器，会有更多特性推出。
值得一提的是，目前的工作重心是将&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/128560&#34;&gt;内存管理器支持扩展到 Windows&lt;/a&gt;，
使得在 Windows 操作系统上实现 CPU 和内存亲和性成为可能。&lt;/p&gt;
&lt;!--
## Getting involved

This feature is driven by the [SIG Node](https://github.com/Kubernetes/community/blob/master/sig-node/README.md) community.
Please join us to connect with the community
and share your ideas and feedback around the above feature and
beyond.
We look forward to hearing from you!
--&gt;
&lt;h2 id=&#34;getting-involved&#34;&gt;参与其中  &lt;/h2&gt;
&lt;p&gt;此特性由 &lt;a href=&#34;https://github.com/Kubernetes/community/blob/master/sig-node/README.md&#34;&gt;SIG Node&lt;/a&gt;
社区推动。请加入我们，与社区建立联系，分享你对上述特性及其他方面的想法和反馈。
我们期待听到你的声音！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.32：QueueingHint 为优化 Pod 调度带来了新的可能</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/</link>
      <pubDate>Thu, 12 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.32: QueueingHint Brings a New Possibility to Optimize Pod Scheduling&#34;
date: 2024-12-12
slug: scheduler-queueinghint
Author: &gt;
  [Kensei Nakada](https://github.com/sanposhiho) (Tetrate.io)
--&gt;
&lt;!--
The Kubernetes [scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/) is the core
component that selects the nodes on which new Pods run. The scheduler processes
these new Pods **one by one**. Therefore, the larger your clusters, the more important
the throughput of the scheduler becomes.

Over the years, Kubernetes SIG Scheduling has improved the throughput
of the scheduler in multiple enhancements. This blog post describes a major improvement to the
scheduler in Kubernetes v1.32: a 
[scheduling context element](/docs/concepts/scheduling-eviction/scheduling-framework/#extension-points)
named _QueueingHint_. This page provides background knowledge of the scheduler and explains how
QueueingHint improves scheduling throughput.
--&gt;
&lt;p&gt;Kubernetes &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/kube-scheduler/&#34;&gt;调度器&lt;/a&gt;是为新
Pod 选择运行节点的核心组件，调度器会&lt;strong&gt;逐一&lt;/strong&gt;处理这些新 Pod。
因此，集群规模越大，调度器的吞吐量就越重要。&lt;/p&gt;
&lt;p&gt;多年来，Kubernetes SIG Scheduling 通过多次增强改进了调度器的吞吐量。
本博客文章描述了 Kubernetes v1.32 中对调度器的一项重大改进：
一个名为 &lt;strong&gt;QueueingHint&lt;/strong&gt; 的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/#extension-points&#34;&gt;调度上下文元素&lt;/a&gt;。
本页面提供了关于调度器的背景知识，并解释了 QueueingHint 如何提升调度吞吐量。&lt;/p&gt;
&lt;!--
## Scheduling queue

The scheduler stores all unscheduled Pods in an internal component called the _scheduling queue_. 

The scheduling queue consists of the following data structures:
- **ActiveQ**: holds newly created Pods or Pods that are ready to be retried for scheduling.
- **BackoffQ**: holds Pods that are ready to be retried but are waiting for a backoff period to end. The
   backoff period depends on the number of unsuccessful scheduling attempts performed by the scheduler on that Pod.
- **Unschedulable Pod Pool**: holds Pods that the scheduler won&#39;t attempt to schedule for one of the
   following reasons:
   - The scheduler previously attempted and was unable to schedule the Pods. Since that attempt, the cluster
      hasn&#39;t changed in a way that could make those Pods schedulable.
   - The Pods are blocked from entering the scheduling cycles by PreEnqueue Plugins, 
for example, they have a [scheduling gate](/docs/concepts/scheduling-eviction/pod-scheduling-readiness/#configuring-pod-schedulinggates),
and get blocked by the scheduling gate plugin.
--&gt;
&lt;h2 id=&#34;调度队列&#34;&gt;调度队列&lt;/h2&gt;
&lt;p&gt;调度器将所有未调度的 Pod 存储在一个名为&lt;strong&gt;调度队列&lt;/strong&gt;的内部组件中。&lt;/p&gt;
&lt;p&gt;调度队列由以下数据结构组成：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ActiveQ&lt;/strong&gt;：保存新创建的 Pod 或准备重试调度的 Pod。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BackoffQ&lt;/strong&gt;：保存准备重试但正在等待退避期结束的 Pod。退避期取决于调度器对该 Pod 执行的不成功调度尝试次数。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;无法调度的 Pod 池&lt;/strong&gt;：保存调度器不会尝试调度的 Pod，原因可能包括以下几点：
&lt;ul&gt;
&lt;li&gt;调度器之前尝试调度这些 Pod 但未能成功。自那次尝试以来，集群没有发生任何使得这些 Pod 可以被调度的变化。&lt;/li&gt;
&lt;li&gt;这些 Pod 被 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/pod-scheduling-readiness/#configuring-pod-schedulinggates&#34;&gt;PreEnqueue 插件&lt;/a&gt;阻止进入调度周期，
例如，它们具有一个&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/pod-scheduling-readiness/#configuring-pod-schedulinggates&#34;&gt;调度门控&lt;/a&gt;，并被调度门控插件阻止。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Scheduling framework and plugins

The Kubernetes scheduler is implemented following the Kubernetes
[scheduling framework](/docs/concepts/scheduling-eviction/scheduling-framework/).

And, all scheduling features are implemented as plugins
(e.g., [Pod affinity](/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
is implemented in the `InterPodAffinity` plugin.)
--&gt;
&lt;h2 id=&#34;调度框架和插件&#34;&gt;调度框架和插件&lt;/h2&gt;
&lt;p&gt;Kubernetes 调度器的实现遵循 Kubernetes 的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;调度框架&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;并且，所有的调度特性都是以插件的形式实现的
（例如，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity&#34;&gt;Pod 亲和性&lt;/a&gt;是在
&lt;code&gt;InterPodAffinity&lt;/code&gt; 插件中实现的。）&lt;/p&gt;
&lt;!--
The scheduler processes pending Pods in phases called _cycles_ as follows:
1. **Scheduling cycle**: the scheduler takes pending Pods from the activeQ component of the scheduling
    queue  _one by one_. For each Pod, the scheduler runs the filtering/scoring logic from every scheduling plugin. The
    scheduler then decides on the best node for the Pod, or decides that the Pod can&#39;t be scheduled at that time.
    
    If the scheduler decides that a Pod can&#39;t be scheduled, that Pod enters the Unschedulable Pod Pool
    component of the scheduling queue. However, if the scheduler decides to place the Pod on a node, 
    the Pod goes to the binding cycle.
    
1. **Binding cycle**: the scheduler communicates the node placement decision to the Kubernetes API
    server. This operation bounds the Pod to the selected node. 
--&gt;
&lt;p&gt;调度器按照称为&lt;strong&gt;周期&lt;/strong&gt;的阶段来处理待调度的 Pod，具体如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;调度周期（Scheduling cycle）&lt;/strong&gt;：调度器从调度队列的 activeQ 组件中&lt;strong&gt;逐一&lt;/strong&gt;取出待调度的 Pod。
对于每个 Pod，调度器会运行来自每个调度插件的过滤/评分逻辑。然后，调度器决定最适合该 Pod 的节点，
或者决定当前无法调度该 Pod。&lt;/p&gt;
&lt;p&gt;如果调度器决定一个 Pod 无法被调度，该 Pod 将进入调度队列的无法调度的 Pod
池（Unschedulable Pod Pool）组件。然而，如果调度器决定将 Pod 放置到某个节点上，
该 Pod 将进入绑定周期（Binding cycle）。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;绑定周期（Binding cycle）&lt;/strong&gt;：调度器将节点分配决策传达给 Kubernetes API 服务器。
这一操作将 Pod 绑定到选定的节点。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Aside from some exceptions, most unscheduled Pods enter the unschedulable pod pool after each scheduling
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
Pods to the Unschedulable Pod Pool, multiple scheduling cycles would be wasted on those Pods.
--&gt;
&lt;p&gt;除了少数例外情况，大多数未调度的 Pod 在每次调度周期后都会进入无法调度的 Pod 池。
无法调度的 Pod 池组件至关重要，因为调度周期是逐个处理 Pod 的。
如果调度器需要不断重试放置那些无法调度的 Pod，而不是将这些 Pod 分载到无法调度的 Pod 池中，
将会在这些 Pod 上浪费很多调度周期。&lt;/p&gt;
&lt;!--
## Improvements to retrying Pod scheduling with QueuingHint

Unschedulable Pods only move back into the ActiveQ or BackoffQ components of the scheduling
queue if changes in the cluster might allow the scheduler to place those Pods on nodes. 

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_),
with `EnqueueExtensions` (`EventsToRegister`),
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.

Additionally, we had an internal feature called `preCheck`, which helped further filtering of events for efficiency, based on Kubernetes core scheduling constraints;
For example, `preCheck` could filter out node-related events when the node status is `NotReady`. 
--&gt;
&lt;h2 id=&#34;使用-queueinghint-改进-pod-调度重试&#34;&gt;使用 QueueingHint 改进 Pod 调度重试&lt;/h2&gt;
&lt;p&gt;无法调度的 Pod 仅在集群发生可能允许调度器将这些 Pod 放置到节点上的变化时，
才会重新移入调度队列的 ActiveQ 或 BackoffQ 组件。&lt;/p&gt;
&lt;p&gt;在 v1.32 之前，每个插件通过 &lt;code&gt;EnqueueExtensions&lt;/code&gt;（&lt;code&gt;EventsToRegister&lt;/code&gt;）注册哪些集群变化
（称为&lt;strong&gt;集群事件&lt;/strong&gt;，即集群中的对象创建、更新或删除）可以解决其失败情况。当某个插件在之前的调度周期中拒绝了某个 Pod 后，
调度队列会在出现该插件注册的事件时重试该 Pod 的调度。&lt;/p&gt;
&lt;p&gt;此外，我们还拥有一个名为 &lt;code&gt;preCheck&lt;/code&gt; 的内部特性，它基于 Kubernetes 核心调度约束进一步过滤事件以提高效率；
例如，&lt;code&gt;preCheck&lt;/code&gt; 可以在节点状态为 &lt;code&gt;NotReady&lt;/code&gt; 时过滤掉与节点相关的事件。&lt;/p&gt;
&lt;!--
However, we had two issues for those approaches:
- Requeueing with events was too broad, could lead to scheduling retries for no reason.
   - A new scheduled Pod _might_ solve the `InterPodAffinity`&#39;s failure, but not all of them do.
For example, if a new Pod is created, but without a label matching `InterPodAffinity` of the unschedulable pod, the pod wouldn&#39;t be schedulable.
- `preCheck` relied on the logic of in-tree plugins and was not extensible to custom plugins,
like in issue [#110175](https://github.com/kubernetes/kubernetes/issues/110175).
--&gt;
&lt;p&gt;然而，这些方法存在两个问题：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;基于事件的重新排队过于宽泛，可能会导致毫无来由的调度重试。
&lt;ul&gt;
&lt;li&gt;新调度的 Pod &lt;strong&gt;可能&lt;/strong&gt;解决 &lt;code&gt;InterPodAffinity&lt;/code&gt; 失败的问题，但并非所有新 Pod 都能做到。
例如，如果创建了一个新的 Pod，但该 Pod 没有与无法调度的 Pod 的 &lt;code&gt;InterPodAffinity&lt;/code&gt; 匹配的标签，
则该 Pod 仍然无法被调度。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;preCheck&lt;/code&gt; 依赖于 in-tree 插件的逻辑，并且不适用于自定义插件，如在问题
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/110175&#34;&gt;#110175&lt;/a&gt; 中所述。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Here QueueingHints come into play; 
a QueueingHint subscribes to a particular kind of cluster event, and make a decision about whether each incoming event could make the Pod schedulable.

For example, consider a Pod named `pod-a` that has a required Pod affinity. `pod-a` was rejected in
the scheduling cycle by the `InterPodAffinity` plugin because no node had an existing Pod that matched
the Pod affinity specification for `pod-a`.
--&gt;
&lt;p&gt;在这里，QueueingHints 发挥了作用；QueueingHint 订阅特定类型的集群事件，并决定每个传入的事件是否可以使 Pod 变得可调度。&lt;/p&gt;
&lt;p&gt;例如，考虑一个名为 &lt;code&gt;pod-a&lt;/code&gt; 的 Pod，它具有必需的 Pod 亲和性。&lt;code&gt;pod-a&lt;/code&gt; 在调度周期中被
&lt;code&gt;InterPodAffinity&lt;/code&gt; 插件拒绝，因为没有节点上有现有的 Pod 符合 &lt;code&gt;pod-a&lt;/code&gt; 的 Pod 亲和性规约。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/queueinghint1.svg&#34;
         alt=&#34;A diagram showing the scheduling queue and pod-a rejected by InterPodAffinity plugin&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;A diagram showing the scheduling queue and pod-a rejected by InterPodAffinity plugin&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

`pod-a` moves into the Unschedulable Pod Pool. The scheduling queue records which plugin caused
the scheduling failure for the Pod. For `pod-a`, the scheduling queue records that the `InterPodAffinity`
plugin rejected the Pod.
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/queueinghint1.svg&#34;
         alt=&#34;显示调度队列和被 InterPodAffinity 插件拒绝的 pod-a 的图示&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;显示调度队列和被 InterPodAffinity 插件拒绝的 pod-a 的图示&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;&lt;code&gt;pod-a&lt;/code&gt; 移入无法调度的 Pod 池 (Unschedulable Pod Pool)。调度队列记录了导致 Pod
调度失败的插件。对于 &lt;code&gt;pod-a&lt;/code&gt;，调度队列记录了 &lt;code&gt;InterPodAffinity&lt;/code&gt; 插件拒绝了该 Pod。&lt;/p&gt;
&lt;!--
`pod-a` will never be schedulable until the InterPodAffinity failure is resolved. 
There&#39;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.
For this scenario, the `InterPodAffinity` plugin&#39;s `QueuingHint` callback function checks every Pod label update that occurs in the cluster. 
Then, if a Pod gets a label update that matches the Pod affinity requirement of `pod-a`, the `InterPodAffinity`,
plugin&#39;s `QueuingHint` prompts the scheduling queue to move `pod-a` back into the ActiveQ or
the BackoffQ component.



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/queueinghint2.svg&#34;
         alt=&#34;A diagram showing the scheduling queue and pod-a being moved by InterPodAffinity QueueingHint&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;A diagram showing the scheduling queue and pod-a being moved by InterPodAffinity QueueingHint&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;
&lt;p&gt;&lt;code&gt;pod-a&lt;/code&gt; 在 &lt;code&gt;InterPodAffinity&lt;/code&gt; 失败被解决之前将永远不会被调度。
有一些情景可以解决这一失败，例如，一个现有的运行中的 Pod 获取了标签更新并符合 Pod 亲和性要求。
在这种情况下，&lt;code&gt;InterPodAffinity&lt;/code&gt; 插件的 &lt;code&gt;QueuingHint&lt;/code&gt; 回调函数会检查集群中发生的每一个 Pod 标签更新。
然后，如果一个 Pod 的标签更新符合 &lt;code&gt;pod-a&lt;/code&gt; 的 Pod 亲和性要求，&lt;code&gt;InterPodAffinity&lt;/code&gt; 插件的
&lt;code&gt;QueuingHint&lt;/code&gt; 会提示调度队列将 &lt;code&gt;pod-a&lt;/code&gt; 重新移入 ActiveQ 或 BackoffQ 组件。&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/12/12/scheduler-queueinghint/queueinghint2.svg&#34;
         alt=&#34;显示调度队列和由 InterPodAffinity QueuingHint 移动的 pod-a 的图示&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;显示调度队列和由 InterPodAffinity QueuingHint 移动的 pod-a 的图示&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
## QueueingHint&#39;s history and what&#39;s new in v1.32

At SIG Scheduling, we have been working on the development of QueueingHint since
Kubernetes v1.28.

While QueuingHint isn&#39;t user-facing, we implemented the `SchedulerQueueingHints` feature gate as a
safety measure when we originally added this feature. In v1.28, we implemented QueueingHints with a
few in-tree plugins experimentally, and made the feature gate enabled by default.
--&gt;
&lt;h2 id=&#34;queueinghint-的历史及-v1-32-中的新变化&#34;&gt;QueueingHint 的历史及 v1.32 中的新变化&lt;/h2&gt;
&lt;p&gt;在 SIG Scheduling，我们自 Kubernetes v1.28 开始就致力于 QueueingHint 的开发。&lt;/p&gt;
&lt;p&gt;尽管 QueueingHint 并不是面向用户的特性，我们在最初添加此特性时还是实现了 &lt;code&gt;SchedulerQueueingHints&lt;/code&gt;
特性门控作为安全措施。在 v1.28 中，我们实验性地为几个 in-tree 插件实现了 QueueingHints，并将该特性门控默认启用。&lt;/p&gt;
&lt;!--
However, users reported a memory leak, and consequently we disabled the feature gate in a
patch release of v1.28.  From v1.28 until v1.31, we kept working on the QueueingHint implementation
within the rest of the in-tree plugins and fixing bugs.

In v1.32, we made this feature enabled by default again. We finished implementing QueueingHints
in all plugins and also identified the cause of the memory leak!

We thank all the contributors who participated in the development of this feature and those who reported and investigated the earlier issues.
--&gt;
&lt;p&gt;然而，用户报告了一个内存泄漏问题，因此我们在 v1.28 的一个补丁版本中禁用了该特性门控。从 v1.28 到 v1.31，
我们一直在其余的 in-tree 插件中继续开发 QueueingHint，并修复相关 bug。&lt;/p&gt;
&lt;p&gt;在 v1.32 中，我们再次默认启用了这一特性。我们完成了所有插件中 QueueingHints 的实现，并且找到了内存泄漏的原因！&lt;/p&gt;
&lt;p&gt;我们感谢所有参与此特性开发的贡献者，以及那些报告和调查早期问题的用户。&lt;/p&gt;
&lt;!--
## Getting involved

These features are managed by Kubernetes [SIG Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).

Please join us and share your feedback.
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;这些特性由 Kubernetes &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-scheduling&#34;&gt;SIG Scheduling&lt;/a&gt; 管理。&lt;/p&gt;
&lt;p&gt;请加入我们并分享你的反馈。&lt;/p&gt;
&lt;!--
## How can I learn more?

- [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)
--&gt;
&lt;h2 id=&#34;如何了解更多&#34;&gt;如何了解更多？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/4247-queueinghint/README.md&#34;&gt;KEP-4247：为调度队列中的高效重新排队实现每插件回调函数&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.32 预览</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/11/08/kubernetes-1-32-upcoming-changes/</link>
      <pubDate>Fri, 08 Nov 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/11/08/kubernetes-1-32-upcoming-changes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.32 sneak peek&#39;
date: 2024-11-08
slug: kubernetes-1-32-upcoming-changes
author: &gt;
  Matteo Bianchi,
  Edith Puclla,
  William Rizzo,
  Ryota Sawada,
  Rashan Smith
--&gt;
&lt;!--
As we get closer to the release date for Kubernetes v1.32, the project develops and matures.
Features may be deprecated, removed, or replaced with better ones for the project&#39;s overall health. 

This blog outlines some of the planned changes for the Kubernetes v1.32 release,
that the release team feels you should be aware of, for the continued maintenance
of your Kubernetes environment and keeping up to date with the latest changes.
Information listed below is based on the current status of the v1.32 release
and may change before the actual release date. 
--&gt;
&lt;p&gt;随着 Kubernetes v1.32 发布日期的临近，Kubernetes 项目继续发展和成熟。
在这个过程中，某些特性可能会被弃用、移除或被更好的特性取代，以确保项目的整体健康与发展。&lt;/p&gt;
&lt;p&gt;本文概述了 Kubernetes v1.32 发布的一些计划变更，发布团队认为你应该了解这些变更，
以确保你的 Kubernetes 环境得以持续维护并跟上最新的变化。以下信息基于 v1.32
发布的当前状态，实际发布日期前可能会有所变动。&lt;/p&gt;
&lt;!--
### The Kubernetes API removal and deprecation process

The Kubernetes project has a well-documented [deprecation policy](/docs/reference/using-api/deprecation-policy/)
for features. This policy states that stable APIs may only be deprecated when a newer,
stable version of that API is available and that APIs have a minimum lifetime for each stability level.
A deprecated API has been marked for removal in a future Kubernetes release will continue to function until
removal (at least one year from the deprecation). Its usage will result in a warning being displayed.
Removed APIs are no longer available in the current version, so you must migrate to use the replacement instead.
--&gt;
&lt;h3 id=&#34;kubernetes-api-的移除和弃用流程&#34;&gt;Kubernetes API 的移除和弃用流程&lt;/h3&gt;
&lt;p&gt;Kubernetes 项目对功能特性有一个文档完备的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-policy/&#34;&gt;弃用策略&lt;/a&gt;。
该策略规定，只有当较新的、稳定的相同 API 可用时，原有的稳定 API 才可能被弃用，每个稳定级别的 API 都有一个最短的生命周期。
弃用的 API 指的是已标记为将在后续发行某个 Kubernetes 版本时移除的 API；
移除之前该 API 将继续发挥作用（从弃用起至少一年时间），但使用时会显示一条警告。
移除的 API 将在当前版本中不再可用，此时你必须迁移以使用替换的 API。&lt;/p&gt;
&lt;!--
* Generally available (GA) or stable API versions may be marked as deprecated but must not be removed within a major version of Kubernetes.

* Beta or pre-release API versions must be supported for 3 releases after the deprecation.

* Alpha or experimental API versions may be removed in any release without prior deprecation notice;
  this process can become a withdrawal in cases where a different implementation for the same feature is already in place.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;正式发布的（GA）或稳定的 API 版本可被标记为已弃用，但不得在 Kubernetes 主要版本未变时删除。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Beta 或预发布 API 版本，必须保持在被弃用后 3 个发布版本中仍然可用。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alpha 或实验性 API 版本可以在任何版本中删除，不必提前通知；
如果同一特性已有不同实施方案，则此过程可能会成为撤销。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Whether an API is removed due to a feature graduating from beta to stable or because that API did not succeed,
all removals comply with this deprecation policy. Whenever an API is removed,
migration options are communicated in the [deprecation guide](/docs/reference/using-api/deprecation-guide/).
--&gt;
&lt;p&gt;无论 API 是因为特性从 Beta 升级到稳定状态还是因为未能成功而被移除，
所有移除操作都遵守此弃用策略。每当 API 被移除时，
迁移选项都会在&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/&#34;&gt;弃用指南&lt;/a&gt;中进行说明。&lt;/p&gt;
&lt;!--
## Note on the withdrawal of the old DRA implementation

The enhancement [#3063](https://github.com/kubernetes/enhancements/issues/3063)
introduced Dynamic Resource Allocation (DRA) in Kubernetes 1.26.
--&gt;
&lt;h2 id=&#34;关于撤回-dra-的旧的实现的说明&#34;&gt;关于撤回 DRA 的旧的实现的说明&lt;/h2&gt;
&lt;p&gt;增强特性 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3063&#34;&gt;#3063&lt;/a&gt; 在 Kubernetes 1.26
中引入了动态资源分配（DRA）。&lt;/p&gt;
&lt;!--
However, in Kubernetes v1.32, this approach to DRA will be significantly changed.
Code related to the original implementation will be removed, leaving KEP
[#4381](https://github.com/kubernetes/enhancements/issues/4381) as the &#34;new&#34; base functionality. 
--&gt;
&lt;p&gt;然而，在 Kubernetes v1.32 中，这种 DRA 的实现方法将发生重大变化。与原来实现相关的代码将被删除，
只留下 KEP &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4381&#34;&gt;#4381&lt;/a&gt; 作为&amp;quot;新&amp;quot;的基础特性。&lt;/p&gt;
&lt;!--
The decision to change the existing approach originated from its incompatibility with cluster autoscaling
as resource availability was non-transparent, complicating decision-making for both Cluster Autoscaler and controllers. 
The newly added Structured Parameter model substitutes the functionality.
--&gt;
&lt;p&gt;改变现有方法的决定源于其与集群自动伸缩的不兼容性，因为资源可用性是不透明的，
这使得 Cluster Autoscaler 和控制器的决策变得复杂。
新增的结构化参数模型替换了原有特性。&lt;/p&gt;
&lt;!--
This removal will allow Kubernetes to handle new hardware requirements and resource claims more predictably,
bypassing the complexities of back and forth API calls to the kube-apiserver.

Please also see the enhancement issue [#3063](https://github.com/kubernetes/enhancements/issues/3063) to find out more.
--&gt;
&lt;p&gt;这次移除将使 Kubernetes 能够更可预测地处理新的硬件需求和资源声明，
避免了与 kube-apiserver 之间复杂的来回 API 调用。&lt;/p&gt;
&lt;p&gt;请参阅增强问题 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3063&#34;&gt;#3063&lt;/a&gt; 以了解更多信息。&lt;/p&gt;
&lt;!--
## API removal

There is only a single API removal planned for [Kubernetes v1.32](/docs/reference/using-api/deprecation-guide/#v1-32):
--&gt;
&lt;h2 id=&#34;api-移除&#34;&gt;API 移除&lt;/h2&gt;
&lt;p&gt;在 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/#v1-32&#34;&gt;Kubernetes v1.32&lt;/a&gt; 中，计划仅移除一个 API：&lt;/p&gt;
&lt;!--
* The `flowcontrol.apiserver.k8s.io/v1beta3` API version of FlowSchema and PriorityLevelConfiguration has been removed. 
  To prepare for this, you can edit your existing manifests and rewrite client software to use the
  `flowcontrol.apiserver.k8s.io/v1 API` version, available since v1.29. 
  All existing persisted objects are accessible via the new API. Notable changes in `flowcontrol.apiserver.k8s.io/v1beta3`
  include that the PriorityLevelConfiguration `spec.limited.nominalConcurrencyShares` field only defaults to 30 when unspecified,
  and an explicit value of 0 is not changed to 30.

For more information, please refer to the [API deprecation guide](/docs/reference/using-api/deprecation-guide/#v1-32).
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; 版本的 FlowSchema 和 PriorityLevelConfiguration 已被移除。
为了对此做好准备，你可以编辑现有的清单文件并重写客户端软件，使用自 v1.29 起可用的 &lt;code&gt;flowcontrol.apiserver.k8s.io/v1&lt;/code&gt; API 版本。
所有现有的持久化对象都可以通过新 API 访问。&lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; 中的重要变化包括：
当未指定时，PriorityLevelConfiguration 的 &lt;code&gt;spec.limited.nominalConcurrencyShares&lt;/code&gt;
字段仅默认为 30，而显式设置的 0 值不会被更改为此默认值。&lt;/p&gt;
&lt;p&gt;有关更多信息，请参阅 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/#v1-32&#34;&gt;API 弃用指南&lt;/a&gt;。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Sneak peek of Kubernetes v1.32

The following list of enhancements is likely to be included in the v1.32 release.
This is not a commitment and the release content is subject to change.
--&gt;
&lt;h2 id=&#34;kubernetes-v1-32-的抢先预览&#34;&gt;Kubernetes v1.32 的抢先预览&lt;/h2&gt;
&lt;p&gt;以下增强特性有可能会被包含在 v1.32 发布版本中。请注意，这并不是最终承诺，发布内容可能会发生变化。&lt;/p&gt;
&lt;!--
### Even more DRA enhancements!

In this release, like the previous one, the Kubernetes project continues proposing a number
of enhancements to the Dynamic Resource Allocation (DRA), a key component of the Kubernetes resource management system.
These enhancements aim to improve the flexibility and efficiency of resource allocation for workloads that require specialized hardware,
such as GPUs, FPGAs and network adapters. This release introduces improvements,
including the addition of resource health status in the Pod status, as outlined in
KEP [#4680](https://github.com/kubernetes/enhancements/issues/4680).
--&gt;
&lt;h3 id=&#34;更多-dra-增强特性&#34;&gt;更多 DRA 增强特性！&lt;/h3&gt;
&lt;p&gt;在此次发布中，就像上一次一样，Kubernetes 项目继续提出多项对动态资源分配（DRA）的增强。
DRA 是 Kubernetes 资源管理系统的关键组件，这些增强旨在提高对需要专用硬件（如 GPU、FPGA 和网络适配器）
的工作负载进行资源分配的灵活性和效率。此次发布引入了多项改进，包括在 Pod 状态中添加资源健康状态，
具体内容详见 KEP &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4680&#34;&gt;#4680&lt;/a&gt;。&lt;/p&gt;
&lt;!--
#### Add resource health status to the Pod status

It isn&#39;t easy to know when a Pod uses a device that has failed or is temporarily unhealthy.
KEP [#4680](https://github.com/kubernetes/enhancements/issues/4680) proposes exposing device
health via Pod `status`, making troubleshooting of Pod crashes easier.
--&gt;
&lt;h4 id=&#34;在-pod-状态中添加资源健康状态&#34;&gt;在 Pod 状态中添加资源健康状态&lt;/h4&gt;
&lt;p&gt;当 Pod 使用的设备出现故障或暂时不健康时，很难及时发现。
KEP &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4680&#34;&gt;#4680&lt;/a&gt;
提议通过 Pod 的 &lt;code&gt;status&lt;/code&gt; 暴露设备健康状态，从而使 Pod 崩溃的故障排除更加容易。&lt;/p&gt;
&lt;!--
### Windows strikes back!

KEP [#4802](https://github.com/kubernetes/enhancements/issues/4802) adds support
for graceful shutdowns of Windows nodes in Kubernetes clusters.
Before this release, Kubernetes provided graceful node shutdown functionality for
Linux nodes but lacked equivalent support for Windows.
This enhancement enables the kubelet on Windows nodes to handle system shutdown events properly.
Doing so, it ensures that Pods running on Windows nodes are gracefully terminated,
allowing workloads to be rescheduled without disruption.
This improvement enhances the reliability and stability of clusters that include Windows nodes,
especially during a planned maintenance or any system updates.
--&gt;
&lt;h3 id=&#34;windows-工作继续&#34;&gt;Windows 工作继续&lt;/h3&gt;
&lt;p&gt;KEP &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4802&#34;&gt;#4802&lt;/a&gt; 为
Kubernetes 集群中的 Windows 节点添加了体面关机支持。
在此之前，Kubernetes 为 Linux 节点提供了体面关机特性，但缺乏对 Windows 节点的同等支持。
这一增强特性使 Windows 节点上的 kubelet 能够正确处理系统关机事件，确保在 Windows 节点上运行的 Pod 能够体面终止，
从而允许工作负载在不受干扰的情况下重新调度。这一改进提高了包含 Windows 节点的集群的可靠性和稳定性，
特别是在计划维护或系统更新期间。&lt;/p&gt;
&lt;!--
### Allow special characters in environment variables

With the graduation of this [enhancement](https://github.com/kubernetes/enhancements/issues/4369) to beta,
Kubernetes now allows almost all printable ASCII characters (excluding &#34;=&#34;) to be used as environment variable names.
This change addresses the limitations previously imposed on variable naming, facilitating a broader adoption of
Kubernetes by accommodating various application needs. The relaxed validation will be enabled by default via the
`RelaxedEnvironmentVariableValidation` feature gate, ensuring that users can easily utilize environment
variables without strict constraints, enhancing flexibility for developers working with applications like
.NET Core that require special characters in their configurations.
--&gt;
&lt;h3 id=&#34;允许环境变量中使用特殊字符&#34;&gt;允许环境变量中使用特殊字符&lt;/h3&gt;
&lt;p&gt;随着这一&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4369&#34;&gt;增强特性&lt;/a&gt;升级到 Beta 阶段，
Kubernetes 现在允许几乎所有的可打印 ASCII 字符（不包括 &lt;code&gt;=&lt;/code&gt;）作为环境变量名称。
这一变化解决了此前对变量命名的限制，通过适应各种应用需求，促进了 Kubernetes 的更广泛采用。
放宽的验证将通过 &lt;code&gt;RelaxedEnvironmentVariableValidation&lt;/code&gt; 特性门控默认启用，
确保用户可以轻松使用环境变量而不受严格限制，增强了开发者在处理需要特殊字符配置的应用（如 .NET Core）时的灵活性。&lt;/p&gt;
&lt;!--
### Make Kubernetes aware of the LoadBalancer behavior

KEP [#1860](https://github.com/kubernetes/enhancements/issues/1860) graduates to GA,
introducing the `ipMode` field for a Service of `type: LoadBalancer`, which can be set to either
`&#34;VIP&#34;` or `&#34;Proxy&#34;`. This enhancement is aimed at improving how cloud providers load balancers
interact with kube-proxy and it is a change transparent to the end user.
The existing behavior of kube-proxy is preserved when using `&#34;VIP&#34;`, where kube-proxy handles the load balancing.
Using `&#34;Proxy&#34;` results in traffic sent directly to the load balancer,
providing cloud providers greater control over relying on kube-proxy;
this means that you could see an improvement in the performance of your load balancer for some cloud providers.
--&gt;
&lt;h3 id=&#34;使-kubernetes-感知到-loadbalancer-的行为&#34;&gt;使 Kubernetes 感知到 LoadBalancer 的行为&lt;/h3&gt;
&lt;p&gt;KEP &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/1860&#34;&gt;#1860&lt;/a&gt; 升级到 GA 阶段，
为 &lt;code&gt;type: LoadBalancer&lt;/code&gt; 类型的 Service 引入了 &lt;code&gt;ipMode&lt;/code&gt; 字段，该字段可以设置为 &lt;code&gt;&amp;quot;VIP&amp;quot;&lt;/code&gt; 或 &lt;code&gt;&amp;quot;Proxy&amp;quot;&lt;/code&gt;。
这一增强旨在改善云提供商负载均衡器与 kube-proxy 的交互方式，对最终用户来说是透明的。
使用 &lt;code&gt;&amp;quot;VIP&amp;quot;&lt;/code&gt; 时，kube-proxy 会继续处理负载均衡，保持现有的行为。使用 &lt;code&gt;&amp;quot;Proxy&amp;quot;&lt;/code&gt; 时，
流量将直接发送到负载均衡器，提供云提供商对依赖 kube-proxy 的更大控制权；
这意味着对于某些云提供商，你可能会看到负载均衡器性能的提升。&lt;/p&gt;
&lt;!--
### Retry generate name for resources

This [enhancement](https://github.com/kubernetes/enhancements/issues/4420)
improves how name conflicts are handled for Kubernetes resources created with the `generateName` field.
Previously, if a name conflict occurred, the API server returned a 409 HTTP Conflict error and clients
had to manually retry the request. With this update, the API server automatically retries generating
a new name up to seven times in case of a conflict. This significantly reduces the chances of collision,
ensuring smooth generation of up to 1 million names with less than a 0.1% probability of a conflict,
providing more resilience for large-scale workloads.
--&gt;
&lt;h3 id=&#34;为资源生成名称时重试&#34;&gt;为资源生成名称时重试&lt;/h3&gt;
&lt;p&gt;这一&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4420&#34;&gt;增强特性&lt;/a&gt;改进了使用
&lt;code&gt;generateName&lt;/code&gt; 字段创建 Kubernetes 资源时的名称冲突处理。此前，如果发生名称冲突，
API 服务器会返回 409 HTTP 冲突错误，客户端需要手动重试请求。通过此次更新，
API 服务器在发生冲突时会自动重试生成新名称，最多重试七次。这显著降低了冲突的可能性，
确保生成多达 100 万个名称时冲突的概率低于 0.1%，为大规模工作负载提供了更高的弹性。&lt;/p&gt;
&lt;!--
## Want to know more?
New features and deprecations are also announced in the Kubernetes release notes.
We will formally announce what&#39;s new in
[Kubernetes v1.32](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.32.md)
as part of the CHANGELOG for this release.

You can see the announcements of changes in the release notes for:
--&gt;
&lt;h2 id=&#34;想了解更多&#34;&gt;想了解更多？&lt;/h2&gt;
&lt;p&gt;新特性和弃用特性也会在 Kubernetes 发布说明中宣布。我们将在此次发布的
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.32.md&#34;&gt;Kubernetes v1.32&lt;/a&gt;
的 CHANGELOG 中正式宣布新内容。&lt;/p&gt;
&lt;p&gt;你可以在以下版本的发布说明中查看变更公告：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md&#34;&gt;Kubernetes v1.31&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.30.md&#34;&gt;Kubernetes v1.30&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.29.md&#34;&gt;Kubernetes v1.29&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.28.md&#34;&gt;Kubernetes v1.28&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>关于日本的 Kubernetes 上游培训的特别报道</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/10/28/k8s-upstream-training-japan-spotlight/</link>
      <pubDate>Mon, 28 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/10/28/k8s-upstream-training-japan-spotlight/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on Kubernetes Upstream Training in Japan&#34;
slug: k8s-upstream-training-japan-spotlight
date: 2024-10-28
canonicalUrl: https://www.k8s.dev/blog/2024/10/28/k8s-upstream-training-japan-spotlight/
author: &gt;
  [Junya Okabe](https://github.com/Okabe-Junya) (University of Tsukuba) / 
  Organizing team of Kubernetes Upstream Training in Japan
--&gt;
&lt;!--
We are organizers of [Kubernetes Upstream Training in Japan](https://github.com/kubernetes-sigs/contributor-playground/tree/master/japan).
Our team is composed of members who actively contribute to Kubernetes, including individuals who hold roles such as member, reviewer, approver, and chair.
--&gt;
&lt;p&gt;我们是&lt;a href=&#34;https://github.com/kubernetes-sigs/contributor-playground/tree/master/japan&#34;&gt;日本 Kubernetes 上游培训&lt;/a&gt;的组织者。
我们的团队由积极向 Kubernetes 做贡献的成员组成，他们在社区中担任了 Member、Reviewer、Approver 和 Chair 等角色。&lt;/p&gt;
&lt;!--
Our goal is to increase the number of Kubernetes contributors and foster the growth of the community.
While Kubernetes community is friendly and collaborative, newcomers may find the first step of contributing to be a bit challenging.
Our training program aims to lower that barrier and create an environment where even beginners can participate smoothly.
--&gt;
&lt;p&gt;我们的目标是增加 Kubernetes 贡献者的数量，并促进社区的成长。
虽然 Kubernetes 社区友好协作，但新手可能会发现迈出贡献的第一步有些困难。
我们的培训项目旨在降低壁垒，创造一个即使是初学者也能顺利参与的环境。&lt;/p&gt;
&lt;!--
## What is Kubernetes upstream training in Japan?

![Upstream Training in 2022](ood-2022-01.png)

Our training started in 2019 and is held 1 to 2 times a year.
Initially, Kubernetes Upstream Training was conducted as a co-located event of KubeCon (Kubernetes Contributor Summit),
but we launched Kubernetes Upstream Training in Japan with the aim of increasing Japanese contributors by hosting a similar event in Japan.
--&gt;
&lt;h2 id=&#34;what-is-kubernetes-upstream-training-in-japan&#34;&gt;日本 Kubernetes 上游培训是什么？  &lt;/h2&gt;
&lt;p&gt;&lt;img alt=&#34;2022 年上游培训&#34; src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/10/28/k8s-upstream-training-japan-spotlight/ood-2022-01.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;我们的培训始于 2019 年，每年举办 1 到 2 次。
最初，Kubernetes 上游培训曾作为 KubeCon（Kubernetes 贡献者峰会）的同场地活动进行，
后来我们在日本推出了 Kubernetes 上游培训，目的是通过在日本举办类似活动来增加日本的贡献者。&lt;/p&gt;
&lt;!--
Before the pandemic, the training was held in person, but since 2020, it has been conducted online.
The training offers the following content for those who have not yet contributed to Kubernetes:

* Introduction to Kubernetes community
* Overview of Kubernetes codebase and how to create your first PR
* Tips and encouragement to lower participation barriers, such as language
* How to set up the development environment
* Hands-on session using [kubernetes-sigs/contributor-playground](https://github.com/kubernetes-sigs/contributor-playground)
--&gt;
&lt;p&gt;在疫情之前，培训是面对面进行的，但自 2020 年以来，我们已转为在线上进行。
培训为尚未参与过 Kubernetes 贡献的学员提供以下内容：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Kubernetes 社区简介&lt;/li&gt;
&lt;li&gt;Kubernetes 代码库概述以及如何创建你的第一个 PR&lt;/li&gt;
&lt;li&gt;各种降低参与壁垒（如语言）的提示和鼓励&lt;/li&gt;
&lt;li&gt;如何搭建开发环境&lt;/li&gt;
&lt;li&gt;使用 &lt;a href=&#34;https://github.com/kubernetes-sigs/contributor-playground&#34;&gt;kubernetes-sigs/contributor-playground&lt;/a&gt;
开展实践课程&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
At the beginning of the program, we explain why contributing to Kubernetes is important and who can contribute.
We emphasize that contributing to Kubernetes allows you to make a global impact and that Kubernetes community is looking forward to your contributions!

We also explain Kubernetes community, SIGs, and Working Groups.
Next, we explain the roles and responsibilities of Member, Reviewer, Approver, Tech Lead, and Chair.
Additionally, we introduce the communication tools we primarily use, such as Slack, GitHub, and mailing lists.
Some Japanese speakers may feel that communicating in English is a barrier.
Additionally, those who are new to the community need to understand where and how communication takes place.
We emphasize the importance of taking that first step, which is the most important aspect we focus on in our training!
--&gt;
&lt;p&gt;在培训开始时，我们讲解为什么贡献 Kubernetes 很重要以及谁可以做贡献。
我们强调，贡献 Kubernetes 可以让你产生全球影响，而 Kubernetes 社区期待着你的贡献！&lt;/p&gt;
&lt;p&gt;我们还讲解 Kubernetes 社区、SIG（特别兴趣小组）和 WG（工作组）。
接下来，我们讲解 Member、Reviewer、Approver、Tech Lead 和 Chair 的角色与职责。
此外，我们介绍大家所使用的主要沟通工具，如 Slack、GitHub 和邮件列表。
一些讲日语的人可能会觉得用英语沟通是一个障碍。
此外，社区的新人需要理解在哪儿以及如何与人交流。
我们强调迈出第一步的重要性，这是我们培训中最关注的方面！&lt;/p&gt;
&lt;!--
We then go over the structure of Kubernetes codebase, the main repositories, how to create a PR, and the CI/CD process using [Prow](https://docs.prow.k8s.io/).
We explain in detail the process from creating a PR to getting it merged.

After several lectures, participants get to experience hands-on work using [kubernetes-sigs/contributor-playground](https://github.com/kubernetes-sigs/contributor-playground), where they can create a simple PR.
The goal is for participants to get a feel for the process of contributing to Kubernetes.

At the end of the program, we also provide a detailed explanation of setting up the development environment for contributing to the `kubernetes/kubernetes` repository,
including building code locally, running tests efficiently, and setting up clusters.
--&gt;
&lt;p&gt;然后，我们讲解 Kubernetes 代码库的结构、主要的仓库、如何创建 PR 以及使用
&lt;a href=&#34;https://docs.prow.k8s.io/&#34;&gt;Prow&lt;/a&gt; 的 CI/CD 流程。
我们详细讲解从创建 PR 到合并 PR 的过程。&lt;/p&gt;
&lt;p&gt;经过几节课后，参与者将体验使用
&lt;a href=&#34;https://github.com/kubernetes-sigs/contributor-playground&#34;&gt;kubernetes-sigs/contributor-playground&lt;/a&gt;
开展实践工作，在那里他们可以创建一个简单的 PR。
目标是让参与者体验贡献 Kubernetes 的过程。&lt;/p&gt;
&lt;p&gt;在项目结束时，我们还提供关于为贡献 &lt;code&gt;kubernetes/kubernetes&lt;/code&gt; 仓库搭建开发环境的详细说明，
包括如何在本地构建代码、如何高效运行测试以及如何搭建集群。&lt;/p&gt;
&lt;!--
## Interview with participants

We conducted interviews with those who participated in our training program.
We asked them about their reasons for joining, their impressions, and their future goals.
--&gt;
&lt;h2 id=&#34;interview-with-participants&#34;&gt;与参与者的访谈  &lt;/h2&gt;
&lt;p&gt;我们对参与我们培训项目的人进行了访谈。
我们询问了他们参加的原因、印象和未来目标。&lt;/p&gt;
&lt;!--
### [Keita Mochizuki](https://github.com/mochizuki875) ([NTT DATA Group Corporation](https://www.nttdata.com/global/en/about-us/profile))

Keita Mochizuki is a contributor who consistently contributes to Kubernetes and related projects.
Keita is also a professional in container security and has recently published a book.
Additionally, he has made available a [Roadmap for New Contributors](https://github.com/mochizuki875/KubernetesFirstContributionRoadMap), which is highly beneficial for those new to contributing.

**Junya:** Why did you decide to participate in Kubernetes Upstream Training?
--&gt;
&lt;h3 id=&#34;keita-mochizuki-https-github-com-mochizuki875-ntt-data-集团公司-https-www-nttdata-com-global-en-about-us-profile&#34;&gt;&lt;a href=&#34;https://github.com/mochizuki875&#34;&gt;Keita Mochizuki&lt;/a&gt;（&lt;a href=&#34;https://www.nttdata.com/global/en/about-us/profile&#34;&gt;NTT DATA 集团公司&lt;/a&gt;）&lt;/h3&gt;
&lt;p&gt;Keita Mochizuki 是一位持续为 Kubernetes 及相关项目做贡献的贡献者。
他还是容器安全领域的专业人士，他最近出版了一本书。此外，
他还发布了一份&lt;a href=&#34;https://github.com/mochizuki875/KubernetesFirstContributionRoadMap&#34;&gt;新贡献者路线图&lt;/a&gt;，
对新贡献者非常有帮助。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你为什么决定参加 Kubernetes 上游培训？&lt;/p&gt;
&lt;!--
**Keita:** Actually, I participated twice, in 2020 and 2022.
In 2020, I had just started learning about Kubernetes and wanted to try getting involved in activities outside of work, so I signed up after seeing the event on Twitter by chance.
However, I didn&#39;t have much knowledge at the time, and contributing to OSS felt like something beyond my reach.
As a result, my understanding after the training was shallow, and I left with more of a &#34;hmm, okay&#34; feeling.

In 2022, I participated again when I was at a stage where I was seriously considering starting contributions.
This time, I did prior research and was able to resolve my questions during the lectures, making it a very productive experience.
--&gt;
&lt;p&gt;&lt;strong&gt;Keita：&lt;/strong&gt; 实际上，我分别在 2020 年和 2022 年参加过两次培训。
在 2020 年，我刚开始学习 Kubernetes，想尝试参与工作以外的活动，
所以在 Twitter 上偶然看到活动后报了名参加了活动。
然而，那时我的知识积累还不多，贡献 OSS 感觉超出了我的能力。
因此，在培训后的理解比较肤浅，离开时更多是“嗯，好吧”的感觉。&lt;/p&gt;
&lt;p&gt;在 2022 年，我再次参加，那时我认真考虑开始贡献。
我事先进行了研究，并能够在讲座中解决我的问题，那次经历非常有成效。&lt;/p&gt;
&lt;!--
**Junya:** How did you feel after participating?

**Keita:** I felt that the significance of this training greatly depends on the participant&#39;s mindset.
The training itself consists of general explanations and simple hands-on exercises, but it doesn&#39;t mean that attending the training will immediately lead to contributions.

**Junya:** What is your purpose for contributing?

**Keita:** My initial motivation was to &#34;gain a deep understanding of Kubernetes and build a track record,&#34; meaning &#34;contributing itself was the goal.&#34;
Nowadays, I also contribute to address bugs or constraints I discover during my work.
Additionally, through contributing, I&#39;ve become less hesitant to analyze undocumented features directly from the source code.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 参加后你有什么感受？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keita：&lt;/strong&gt; 我觉得培训的意义很大程度上取决于参与者的心态。
培训本身包括常规的讲解和简单的实践练习，但这并不意味着参加培训就会立即会去做贡献。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你贡献的目的是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keita：&lt;/strong&gt; 我最初的动机是“深入理解 Kubernetes 并生成成绩记录”，也就是说“贡献本身就是目标”。
如今，我还会通过贡献来解决我在工作中发现的 Bug 或约束。
此外，通过贡献，我变得不再那么犹豫，会去直接基于源代码分析了解没有文档记录的特性。&lt;/p&gt;
&lt;!--
**Junya:** What has been challenging about contributing?

**Keita:** The most difficult part was taking the first step. Contributing to OSS requires a certain level of knowledge, and leveraging resources like this training and support from others was essential.
One phrase that stuck with me was, &#34;Once you take the first step, it becomes easier to move forward.&#34;
Also, in terms of continuing contributions as part of my job, the most challenging aspect is presenting the outcomes as achievements.
To keep contributing over time, it&#39;s important to align it with business goals and strategies, but upstream contributions don&#39;t always lead to immediate results that can be directly tied to performance.
Therefore, it&#39;s crucial to ensure mutual understanding with managers and gain their support.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 贡献中遇到的挑战是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keita：&lt;/strong&gt; 最困难的部分是迈出第一步。贡献 OSS 需要一定的知识水平，利用像这样的培训和他人的支持至关重要。
一句让我印象深刻的话是，“一旦你迈出第一步，后续就会变得更容易。”&lt;br&gt;
此外，在作为工作的一部分继续贡献时，最具挑战性的是将输出的结果变为成就感。
要保持长期贡献，将贡献与业务目标和策略对齐非常重要，但上游贡献并不总是能直接产生与表现相关的即时结果。
因此，确保与管理人员的相互理解并获得他们的支持至关重要。&lt;/p&gt;
&lt;!--
**Junya:** What are your future goals?

**Keita:** My goal is to contribute to areas with a larger impact.
So far, I&#39;ve mainly contributed by fixing smaller bugs as my primary focus was building a track record,
but moving forward, I&#39;d like to challenge myself with contributions that have a greater impact on Kubernetes users or that address issues related to my work.
Recently, I&#39;ve also been working on reflecting the changes I&#39;ve made to the codebase into the official documentation,
and I see this as a step toward achieving my goals.

**Junya:** Thank you very much!
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你未来的目标是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keita：&lt;/strong&gt; 我的目标是对影响更大的领域做出贡献。
到目前为止，我主要通过修复较小的 Bug 来做贡献，因为我的主要关注是生成一份成绩单，
但未来，我希望挑战自己对 Kubernetes 用户产生更大影响的贡献，或解决与我工作相关的问题。
最近，我还在努力将我对代码库所做的更改反映到官方文档中，
我将这视为实现我目标的一步。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 非常感谢！&lt;/p&gt;
&lt;!--
### [Yoshiki Fujikane](https://github.com/ffjlabo) ([CyberAgent, Inc.](https://www.cyberagent.co.jp/en/))

Yoshiki Fujikane is one of the maintainers of [PipeCD](https://pipecd.dev/), a CNCF Sandbox project.
In addition to developing new features for Kubernetes support in PipeCD,
Yoshiki actively participates in community management and speaks at various technical conferences.
--&gt;
&lt;h3 id=&#34;yoshiki-fujikane-https-github-com-ffjlabo-cyberagent-inc-https-www-cyberagent-co-jp-en&#34;&gt;&lt;a href=&#34;https://github.com/ffjlabo&#34;&gt;Yoshiki Fujikane&lt;/a&gt;（&lt;a href=&#34;https://www.cyberagent.co.jp/en/&#34;&gt;CyberAgent, Inc.&lt;/a&gt;）&lt;/h3&gt;
&lt;p&gt;Yoshiki Fujikane 是 CNCF 沙盒项目 &lt;a href=&#34;https://pipecd.dev/&#34;&gt;PipeCD&lt;/a&gt; 的维护者之一。
除了在 PipeCD 中开发对 Kubernetes 支持的新特性外，
Yoshiki 还积极参与社区管理，并在各种技术会议上发言。&lt;/p&gt;
&lt;!--
**Junya:** Why did you decide to participate in the Kubernetes Upstream Training?

**Yoshiki:** At the time I participated, I was still a student.
I had only briefly worked with EKS, but I thought Kubernetes seemed complex yet cool, and I was casually interested in it.
Back then, OSS felt like something out of reach, and upstream development for Kubernetes seemed incredibly daunting.
While I had always been interested in OSS, I didn&#39;t know where to start.
It was during this time that I learned about the Kubernetes Upstream Training and decided to take the challenge of contributing to Kubernetes.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你为什么决定参加 Kubernetes 上游培训？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 当我参与培训时，我还是一名学生。
我只简短地接触过 EKS，我觉得 Kubernetes 看起来复杂但很酷，我对此有一种随意的兴趣。
当时，OSS 对我来说感觉像是遥不可及，而 Kubernetes 的上游开发似乎非常令人生畏。
虽然我一直对 OSS 感兴趣，但我不知道从哪里开始。
也就在那个时候，我了解到 Kubernetes 上游培训，并决定挑战自己为 Kubernetes 做贡献。&lt;/p&gt;
&lt;!--
**Junya:** What were your impressions after participating?

**Yoshiki:** I found it extremely valuable as a way to understand what it&#39;s like to be part of an OSS community.
At the time, my English skills weren&#39;t very strong, so accessing primary sources of information felt like a big hurdle for me.
Kubernetes is a very large project, and I didn&#39;t have a clear understanding of the overall structure, let alone what was necessary for contributing.
The upstream training provided a Japanese explanation of the community structure and allowed me to gain hands-on experience with actual contributions.
Thanks to the guidance I received, I was able to learn how to approach primary sources and use them as entry points for further investigation, which was incredibly helpful.
This experience made me realize the importance of organizing and reviewing primary sources, and now I often dive into GitHub issues and documentation when something piques my interest.
As a result, while I am no longer contributing to Kubernetes itself, the experience has been a great foundation for contributing to other projects.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 参加后你的印象是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 我发现对于了解如何成为 OSS 社区的一部分，这种培训是一种非常有价值的方式。
当时，我的英语水平不是很好，所以获取主要信息源对我来说是一个很大的障碍。
Kubernetes 是一个非常大的项目，我对整体结构没有清晰的理解，更不用说贡献所需的内容了。
上游培训提供了对社区结构的日文解释，并让我获得了实际贡献的实践经验。
得益于我所得到的指导，我学会了如何接触主要信息源，并将其作为进一步研究的切入点，这对我帮助很大。
这次经历让我意识到组织和评审主要信息源的重要性，现在我经常在 GitHub Issue 和文档中深入研究我感兴趣的内容。
因此，虽然我不再直接向 Kubernetes 做贡献，但这次经历为我在其他项目中做贡献奠定了很好的基础。&lt;/p&gt;
&lt;!--
**Junya:** What areas are you currently contributing to, and what are the other projects you&#39;re involved in?

**Yoshiki:** Right now, I&#39;m no longer working with Kubernetes, but instead, I&#39;m a maintainer of PipeCD, a CNCF Sandbox project.
PipeCD is a CD tool that supports GitOps-style deployments for various application platforms.
The tool originally started as an internal project at CyberAgent.
With different teams adopting different platforms, PipeCD was developed to provide a unified CD platform with a consistent user experience.
Currently, it supports Kubernetes, AWS ECS, Lambda, Cloud Run, and Terraform.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你目前在哪些领域做贡献？你参与了哪些其他项目？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 目前，我不再从事 Kubernetes 的工作，而是担任 CNCF 沙盒项目 PipeCD 的维护者。
PipeCD 是一个支持各种应用平台的 GitOps 式部署的 CD 工具。
此工具最初作为 CyberAgent 的内部项目启动。
随着不同团队采用不同的平台，PipeCD 设计为提供一个统一的 CD 平台，确保用户体验一致。
目前，它支持 Kubernetes、AWS ECS、Lambda、Cloud Run 和 Terraform。&lt;/p&gt;
&lt;!--
**Junya:** What role do you play within the PipeCD team?

**Yoshiki:** I work full-time on improving and developing Kubernetes-related features within the team.
Since we provide PipeCD as a SaaS internally, my main focus is on adding new features and improving existing ones as part of that support.
In addition to code contributions, I also contribute by giving talks at various events and managing community meetings to help grow the PipeCD community.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你在 PipeCD 团队中扮演什么角色？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 我全职负责团队中与 Kubernetes 相关特性的改进和开发。
由于我们将 PipeCD 作为内部 SaaS 提供，我的主要关注点是添加新特性和改进现有特性，
确保 PipeCD 能够持续良好支持 Kubernetes 等平台。
除了代码贡献外，我还通过在各种活动上发言和管理社区会议来帮助发展 PipeCD 社区。&lt;/p&gt;
&lt;!--
**Junya:** Could you explain what kind of improvements or developments you are working on with regards to Kubernetes?

**Yoshiki:** PipeCD supports GitOps and Progressive Delivery for Kubernetes, so I&#39;m involved in the development of those features.
Recently, I&#39;ve been working on features that streamline deployments across multiple clusters.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你能讲解一下你对于 Kubernetes 正在进行哪些改进或开发吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; PipeCD 支持 Kubernetes 的 GitOps 和渐进式交付，因此我参与这些特性的开发。
最近，我一直在开发简化跨多个集群部署的特性。&lt;/p&gt;
&lt;!--
**Junya:** Have you encountered any challenges while contributing to OSS?

**Yoshiki:** One challenge is developing features that maintain generality while meeting user use cases.
When we receive feature requests while operating the internal SaaS, we first consider adding features to solve those issues.
At the same time, we want PipeCD to be used by a broader audience as an OSS tool.
So, I always think about whether a feature designed for one use case could be applied to another, ensuring the software remains flexible and widely usable.
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 在贡献 OSS 的过程中，你遇到过哪些挑战？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 一个挑战是开发在满足用户用例的同时保持通用性的特性。
当我们在运营内部 SaaS 期间收到特性请求时，我们首先考虑添加特性来解决这些问题。
与此同时，我们希望 PipeCD 作为一个 OSS 工具被更广泛的受众使用。
因此，我总是思考为一个用例设计的特性是否可以应用于其他用例，以确保 PipeCD 这个软件保持灵活且广泛可用。&lt;/p&gt;
&lt;!--
**Junya:** What are your goals moving forward?

**Yoshiki:** I want to focus on expanding PipeCD&#39;s functionality.
Currently, we are developing PipeCD under the slogan &#34;One CD for All.&#34;
As I mentioned earlier, it supports Kubernetes, AWS ECS, Lambda, Cloud Run, and Terraform, but there are many other platforms out there, and new platforms may emerge in the future.
For this reason, we are currently developing a plugin system that will allow users to extend PipeCD on their own, and I want to push this effort forward.
I&#39;m also working on features for multi-cluster deployments in Kubernetes, and I aim to continue making impactful contributions.

**Junya:** Thank you very much!
--&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 你未来的目标是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yoshiki：&lt;/strong&gt; 我希望专注于扩展 PipeCD 的功能。
目前，我们正在以“普遍可用的持续交付”（One CD for All）的口号开发 PipeCD。
正如我之前提到的，它支持 Kubernetes、AWS ECS、Lambda、Cloud Run 和 Terraform，
但还有许多其他平台，以及未来可能会出现的新平台。
因此，我们目前正在开发一个插件系统，允许用户自行扩展 PipeCD，我希望将这一努力向前推进。
我也在处理 Kubernetes 的多集群部署特性，目标是继续做出有影响力的贡献。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Junya：&lt;/strong&gt; 非常感谢！&lt;/p&gt;
&lt;!--
## Future of Kubernetes upstream training

We plan to continue hosting Kubernetes Upstream Training in Japan and look forward to welcoming many new contributors.
Our next session is scheduled to take place at the end of November during [CloudNative Days Winter 2024](https://event.cloudnativedays.jp/cndw2024).
--&gt;
&lt;h2 id=&#34;future-of-kubernetes-upstream-training&#34;&gt;Kubernetes 上游培训的未来  &lt;/h2&gt;
&lt;p&gt;我们计划继续在日本举办 Kubernetes 上游培训，并期待欢迎更多的新贡献者。
我们的下一次培训定于 11 月底在
&lt;a href=&#34;https://event.cloudnativedays.jp/cndw2024&#34;&gt;CloudNative Days Winter 2024&lt;/a&gt; 期间举行。&lt;/p&gt;
&lt;!--
Moreover, our goal is to expand these training programs not only in Japan but also around the world.
[Kubernetes celebrated its 10th anniversary](https://kubernetes.io/blog/2024/06/06/10-years-of-kubernetes/) this year, and for the community to become even more active, it&#39;s crucial for people across the globe to continue contributing.
While Upstream Training is already held in several regions, we aim to bring it to even more places.

We hope that as more people join Kubernetes community and contribute, our community will become even more vibrant!
--&gt;
&lt;p&gt;此外，我们的目标不仅是在日本推广这些培训项目，还希望推广到全球。
今年的 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/&#34;&gt;Kubernetes 十周年庆&lt;/a&gt;，
以及为了使社区更加活跃，让全球各地的人们持续贡献至关重要。
虽然上游培训已经在多个地区举行，但我们希望将其带到更多地方。&lt;/p&gt;
&lt;p&gt;我们希望随着越来越多的人加入 Kubernetes 社区并做出贡献，我们的社区将变得更加生机勃勃！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>公布 2024 年指导委员会选举结果</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/10/02/steering-committee-results-2024/</link>
      <pubDate>Wed, 02 Oct 2024 15:10:00 -0500</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/10/02/steering-committee-results-2024/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Announcing the 2024 Steering Committee Election Results&#34;
slug: steering-committee-results-2024
canonicalUrl: https://www.kubernetes.dev/blog/2024/10/02/steering-committee-results-2024
date: 2024-10-02T15:10:00-05:00
author: &gt;
  Bridget Kromhout
--&gt;
&lt;!--
The [2024 Steering Committee Election](https://github.com/kubernetes/community/tree/master/elections/steering/2024) is now complete. The Kubernetes Steering Committee consists of 7 seats, 3 of which were up for election in 2024. Incoming committee members serve a term of 2 years, and all members are elected by the Kubernetes Community.

This community body is significant since it oversees the governance of the entire Kubernetes project. With that great power comes great responsibility. You can learn more about the steering committee’s role in their [charter](https://github.com/kubernetes/steering/blob/master/charter.md).

Thank you to everyone who voted in the election; your participation helps support the community’s continued health and success.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/elections/steering/2024&#34;&gt;2024 年指导委员会选举&lt;/a&gt;现已完成。
Kubernetes 指导委员会由 7 个席位组成，其中 3 个席位于 2024 年进行选举。
新任委员会成员的任期为 2 年，所有成员均由 Kubernetes 社区选举产生。&lt;/p&gt;
&lt;p&gt;这个社区机构非常重要，因为它负责监督整个 Kubernetes 项目的治理。
权力越大责任越大，你可以在其
&lt;a href=&#34;https://github.com/kubernetes/steering/blob/master/charter.md&#34;&gt;章程&lt;/a&gt;中了解有关指导委员会角色的更多信息。&lt;/p&gt;
&lt;p&gt;感谢所有在选举中投票的人；你们的参与有助于支持社区的持续健康和成功。&lt;/p&gt;
&lt;!--
## Results

Congratulations to the elected committee members whose two year terms begin immediately (listed in alphabetical order by GitHub handle):
--&gt;
&lt;h2 id=&#34;结果&#34;&gt;结果&lt;/h2&gt;
&lt;p&gt;祝贺当选的委员会成员，其两年任期立即开始（按 GitHub 句柄按字母顺序列出）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Antonio Ojea (&lt;a href=&#34;https://github.com/aojea&#34;&gt;@aojea&lt;/a&gt;), Google&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Benjamin Elder (&lt;a href=&#34;https://github.com/bentheelder&#34;&gt;@BenTheElder&lt;/a&gt;), Google&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sascha Grunert (&lt;a href=&#34;https://github.com/saschagrunert&#34;&gt;@saschagrunert&lt;/a&gt;), Red Hat&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
They join continuing members:
--&gt;
&lt;p&gt;他们将与以下连任成员一起工作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stephen Augustus (&lt;a href=&#34;https://github.com/justaugustus&#34;&gt;@justaugustus&lt;/a&gt;), Cisco&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Paco Xu 徐俊杰 (&lt;a href=&#34;https://github.com/pacoxu&#34;&gt;@pacoxu&lt;/a&gt;), DaoCloud&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Patrick Ohly (&lt;a href=&#34;https://github.com/pohly&#34;&gt;@pohly&lt;/a&gt;), Intel&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maciej Szulik (&lt;a href=&#34;https://github.com/soltysh&#34;&gt;@soltysh&lt;/a&gt;), Defense Unicorns&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Benjamin Elder is a returning Steering Committee Member.
--&gt;
&lt;p&gt;Benjamin Elder 是一位回归的指导委员会成员。&lt;/p&gt;
&lt;!--
## Big Thanks!

Thank you and congratulations on a successful election to this round’s election officers:
--&gt;
&lt;h2 id=&#34;十分感谢&#34;&gt;十分感谢！&lt;/h2&gt;
&lt;p&gt;感谢并祝贺本轮选举官员成功完成选举工作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bridget Kromhout (&lt;a href=&#34;https://github.com/bridgetkromhout&#34;&gt;@bridgetkromhout&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Christoph Blecker (&lt;a href=&#34;https://github.com/cblecker&#34;&gt;@cblecker&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Priyanka Saggu (&lt;a href=&#34;https://github.com/Priyankasaggu11929&#34;&gt;@Priyankasaggu11929&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Thanks to the Emeritus Steering Committee Members. Your service is appreciated by the community:
--&gt;
&lt;p&gt;感谢名誉指导委员会成员，你们的服务受到社区的赞赏：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bob Killen (&lt;a href=&#34;https://github.com/mrbobbytables&#34;&gt;@mrbobbytables&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Nabarun Pal (&lt;a href=&#34;https://github.com/palnabarun&#34;&gt;@palnabarun&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
And thank you to all the candidates who came forward to run for election.
--&gt;
&lt;p&gt;感谢所有前来竞选的候选人。&lt;/p&gt;
&lt;!--
## Get involved with the Steering Committee

This governing body, like all of Kubernetes, is open to all. You can follow along with Steering Committee [meeting notes](https://bit.ly/k8s-steering-wd) and weigh in by filing an issue or creating a PR against their [repo](https://github.com/kubernetes/steering). They have an open meeting on [the first Monday at 8am PT of every month](https://github.com/kubernetes/steering). They can also be contacted at their public mailing list steering@kubernetes.io.
--&gt;
&lt;h2 id=&#34;参与指导委员会&#34;&gt;参与指导委员会&lt;/h2&gt;
&lt;p&gt;这个管理机构与所有 Kubernetes 一样，向所有人开放。
你可以关注指导委员会&lt;a href=&#34;https://github.com/orgs/kubernetes/projects/40&#34;&gt;会议记录&lt;/a&gt;，
并通过提交 Issue 或针对其 &lt;a href=&#34;https://github.com/kubernetes/steering&#34;&gt;repo&lt;/a&gt; 创建 PR 来参与。
他们在&lt;a href=&#34;https://github.com/kubernetes/steering&#34;&gt;太平洋时间每月第一个周一上午 8:00&lt;/a&gt; 举行开放的会议。
你还可以通过其公共邮件列表 &lt;a href=&#34;mailto:steering@kubernetes.io&#34;&gt;steering@kubernetes.io&lt;/a&gt; 与他们联系。&lt;/p&gt;
&lt;!--
You can see what the Steering Committee meetings are all about by watching past meetings on the [YouTube Playlist](https://www.youtube.com/playlist?list=PL69nYSiGNLP1yP1B_nd9-drjoxp0Q14qM).

If you want to meet some of the newly elected Steering Committee members, join us for the [Steering AMA](https://www.kubernetes.dev/events/2024/kcsna/schedule/#steering-ama) at the Kubernetes Contributor Summit North America 2024 in Salt Lake City.
--&gt;
&lt;p&gt;你可以通过在 &lt;a href=&#34;https://www.youtube.com/playlist?list=PL69nYSiGNLP1yP1B_nd9-drjoxp0Q14qM&#34;&gt;YouTube 播放列表&lt;/a&gt;上观看过去的会议来了解指导委员会会议的全部内容。&lt;/p&gt;
&lt;p&gt;如果你想认识一些新当选的指导委员会成员，
欢迎参加在盐湖城举行的 2024 年北美 Kubernetes 贡献者峰会上的
&lt;a href=&#34;https://www.kubernetes.dev/events/2024/kcsna/schedule/#steering-ama&#34;&gt;Steering AMA&lt;/a&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;!--
_This post was adapted from one written by the [Contributor Comms Subproject](https://github.com/kubernetes/community/tree/master/communication/contributor-comms). If you want to write stories about the Kubernetes community, learn more about us._
--&gt;
&lt;p&gt;&lt;strong&gt;这篇文章是由&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/communication/contributor-comms&#34;&gt;贡献者通信子项目&lt;/a&gt;撰写的。
如果你想撰写有关 Kubernetes 社区的故事，请了解有关我们的更多信息。&lt;/strong&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>SIG Scheduling 访谈</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/09/24/sig-scheduling-spotlight-2024/</link>
      <pubDate>Tue, 24 Sep 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/09/24/sig-scheduling-spotlight-2024/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Scheduling&#34;
slug: sig-scheduling-spotlight-2024
canonicalUrl: https://www.kubernetes.dev/blog/2024/09/24/sig-scheduling-spotlight-2024
date: 2024-09-24
author: &#34;Arvind Parekh&#34;
--&gt;
&lt;!--
In this SIG Scheduling spotlight we talked with [Kensei Nakada](https://github.com/sanposhiho/), an
approver in SIG Scheduling.

## Introductions

**Arvind:** **Hello, thank you for the opportunity to learn more about SIG Scheduling! Would you
like to introduce yourself and tell us a bit about your role, and how you got involved with
Kubernetes?**
--&gt;
&lt;p&gt;在本次 SIG Scheduling 的访谈中，我们与 &lt;a href=&#34;https://github.com/sanposhiho/&#34;&gt;Kensei Nakada&lt;/a&gt;
进行了交流，他是 SIG Scheduling 的一名 Approver。&lt;/p&gt;
&lt;h2 id=&#34;介绍&#34;&gt;介绍&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Arvind:&lt;/strong&gt; &lt;strong&gt;你好，感谢你让我们有机会了解 SIG Scheduling！
你能介绍一下自己，告诉我们你的角色以及你是如何参与 Kubernetes 的吗？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**Kensei**: Hi, thanks for the opportunity! I’m Kensei Nakada
([@sanposhiho](https://github.com/sanposhiho/)), a software engineer at
[Tetrate.io](https://tetrate.io/). I have been contributing to Kubernetes in my free time for more
than 3 years, and now I’m an approver of SIG Scheduling in Kubernetes. Also, I’m a founder/owner of
two SIG subprojects,
[kube-scheduler-simulator](https://github.com/kubernetes-sigs/kube-scheduler-simulator) and
[kube-scheduler-wasm-extension](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension).
--&gt;
&lt;p&gt;&lt;strong&gt;Kensei&lt;/strong&gt;: 嗨，感谢你给我这个机会！我是 Kensei Nakada
(&lt;a href=&#34;https://github.com/sanposhiho/&#34;&gt;@sanposhiho&lt;/a&gt;)，是来自 &lt;a href=&#34;https://tetrate.io/&#34;&gt;Tetrate.io&lt;/a&gt; 的一名软件工程师。
我在业余时间为 Kubernetes 贡献了超过 3 年的时间，现在我是 Kubernetes 中 SIG Scheduling 的一名 Approver。
同时，我还是两个 SIG 子项目的创始人/负责人：
&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator&#34;&gt;kube-scheduler-simulator&lt;/a&gt; 和
&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension&#34;&gt;kube-scheduler-wasm-extension&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## About SIG Scheduling

**AP: That&#39;s awesome! You&#39;ve been involved with the project since a long time. Can you provide a
brief overview of SIG Scheduling and explain its role within the Kubernetes ecosystem?**

**KN**: As the name implies, our responsibility is to enhance scheduling within
Kubernetes. Specifically, we develop the components that determine which Node is the best place for
each Pod. In Kubernetes, our main focus is on maintaining the
[kube-scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/), along
with other scheduling-related components as part of our SIG subprojects.
--&gt;
&lt;h2 id=&#34;关于-sig-scheduling&#34;&gt;关于 SIG Scheduling&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;AP: 太棒了！你参与这个项目已经很久了。你能简要概述一下 SIG Scheduling，并说明它在 Kubernetes 生态系统中的角色吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 正如名字所示，我们的责任是增强 Kubernetes 中的调度特性。
具体来说，我们开发了一些组件，将每个 Pod 调度到最合适的 Node。
在 Kubernetes 中，我们的主要关注点是维护
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/kube-scheduler/&#34;&gt;kube-scheduler&lt;/a&gt;，
以及其他调度相关的组件，这些组件是 SIG Scheduling 的子项目。&lt;/p&gt;
&lt;!--
**AP: I see, got it! That makes me curious--what recent innovations or developments has SIG
Scheduling introduced to Kubernetes scheduling?**

**KN**: From a feature perspective, there have been
[several enhancements](/blog/2023/04/17/fine-grained-pod-topology-spread-features-beta/)
to `PodTopologySpread` recently. `PodTopologySpread` is a relatively new feature in the scheduler,
and we are still in the process of gathering feedback and making improvements.
--&gt;
&lt;p&gt;&lt;strong&gt;AP: 明白了！我有点好奇，SIG Scheduling 最近为 Kubernetes 调度引入了哪些创新或发展？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 从特性的角度来看，最近对 &lt;code&gt;PodTopologySpread&lt;/code&gt;
进行了&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/17/fine-grained-pod-topology-spread-features-beta/&#34;&gt;几项增强&lt;/a&gt;。
&lt;code&gt;PodTopologySpread&lt;/code&gt; 是调度器中一个相对较新的特性，我们仍在收集反馈并进行改进。&lt;/p&gt;
&lt;!--
Most recently, we have been focusing on a new internal enhancement called
[QueueingHint](https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/4247-queueinghint/README.md)
which aims to enhance scheduling throughput. Throughput is one of our crucial metrics in
scheduling. Traditionally, we have primarily focused on optimizing the latency of each scheduling
cycle. QueueingHint takes a different approach, optimizing when to retry scheduling, thereby
reducing the likelihood of wasting scheduling cycles.
--&gt;
&lt;p&gt;最近，我们专注于一个内部增强特性，称为
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/4247-queueinghint/README.md&#34;&gt;QueueingHint&lt;/a&gt;，
这个特性旨在提高调度的吞吐量。吞吐量是我们调度中的关键指标之一。传统上，我们主要关注优化每个调度周期的延迟。
而 QueueingHint 采取了一种不同的方法，它可以优化何时重试调度，从而减少浪费调度周期的可能性。&lt;/p&gt;
&lt;!--
**A: That sounds interesting! Are there any other interesting topics or projects you are currently
working on within SIG Scheduling?**

**KN**: I’m leading the development of `QueueingHint` which I just shared. Given that it’s a big new
challenge for us, we’ve been facing many unexpected challenges, especially around the scalability,
and we’re trying to solve each of them to eventually enable it by default.
--&gt;
&lt;p&gt;&lt;strong&gt;A: 听起来很有趣！你目前在 SIG Scheduling 中还有其他有趣的主题或项目吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 我正在牵头刚刚提到的 &lt;code&gt;QueueingHint&lt;/code&gt; 的开发。考虑到这是我们面临的一项重大新挑战，
我们遇到了许多意想不到的问题，特别是在可扩展性方面，我们正在努力解决每一个问题，使这项特性最终能够默认启用。&lt;/p&gt;
&lt;!--
And also, I believe
[kube-scheduler-wasm-extension](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension)
(a SIG subproject) that I started last year would be interesting to many people. Kubernetes has
various extensions from many components. Traditionally, extensions are provided via webhooks
([extender](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/scheduler_extender.md)
in the scheduler) or Go SDK ([Scheduling Framework](/docs/concepts/scheduling-eviction/scheduling-framework/)
in the scheduler). However, these come with drawbacks - performance issues with webhooks and the need to
rebuild and replace schedulers with Go SDK, posing difficulties for those seeking to extend the
scheduler but lacking familiarity with it. The project is trying to introduce a new solution to
this general challenge - a [WebAssembly](https://webassembly.org/) based extension. Wasm allows
users to build plugins easily, without worrying about recompiling or replacing their scheduler, and
sidestepping performance concerns.
--&gt;
&lt;p&gt;此外，我认为我去年启动的
&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension&#34;&gt;kube-scheduler-wasm-extension&lt;/a&gt;（SIG 子项目）
对许多人来说也会很有趣。Kubernetes 有各种扩展来自许多组件。传统上，扩展通过 Webhook
（调度器中的 &lt;a href=&#34;https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/scheduler_extender.md&#34;&gt;extender&lt;/a&gt;）或
Go SDK（调度器中的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;调度框架&lt;/a&gt;）提供。
然而，这些方法存在缺点，首先是 Webhook 的性能问题以及需要重建和替换调度器的 Go SDK，这就给那些希望扩展调度器但对其不熟悉的人带来了困难。
此项目尝试引入一种新的解决方案来应对这一普遍挑战，即基于 &lt;a href=&#34;https://webassembly.org/&#34;&gt;WebAssembly&lt;/a&gt; 的扩展。
Wasm 允许用户轻松构建插件，而无需担心重新编译或替换调度器，还能规避性能问题。&lt;/p&gt;
&lt;!--
Through this project, SIG Scheduling has been learning valuable insights about WebAssembly&#39;s
interaction with large Kubernetes objects. And I believe the experience that we’re gaining should be
useful broadly within the community, beyond SIG Scheduling.

**A: Definitely! Now, there are 8 subprojects inside SIG Scheduling. Would you like to
talk about them? Are there some interesting contributions by those teams you want to highlight?**

**KN**: Let me pick up three subprojects: Kueue, KWOK and descheduler.
--&gt;
&lt;p&gt;通过这个项目，SIG Scheduling 正在积累 WebAssembly 与大型 Kubernetes 对象交互的宝贵洞察。
我相信我们所获得的经验应该对整个社区都很有用，而不仅限于 SIG Scheduling 的范围。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: 当然！目前 SIG Scheduling 有 8 个子项目。你想谈谈它们吗？有没有一些你想强调的有趣贡献？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 让我挑选三个子项目：Kueue、KWOK 和 Descheduler。&lt;/p&gt;
&lt;!--
[Kueue](https://github.com/kubernetes-sigs/kueue)
: Recently, many people have been trying to manage batch workloads with Kubernetes, and in 2022,
  Kubernetes community founded
  [WG-Batch](https://github.com/kubernetes/community/blob/master/wg-batch/README.md) for better
  support for such batch workloads in Kubernetes. [Kueue](https://github.com/kubernetes-sigs/kueue)
  is a project that takes a crucial role for it. It’s a job queueing controller, deciding when a job
  should wait, when a job should be admitted to start, and when a job should be preempted. Kueue aims
  to be installed on a vanilla Kubernetes cluster while cooperating with existing matured controllers
  (scheduler, cluster-autoscaler, kube-controller-manager, etc).
--&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kueue&#34;&gt;Kueue&lt;/a&gt;:&lt;/dt&gt;
&lt;dd&gt;最近，许多人尝试使用 Kubernetes 管理批处理工作负载，2022 年，Kubernetes 社区成立了
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/wg-batch/README.md&#34;&gt;WG-Batch&lt;/a&gt;，
以更好地支持 Kubernetes 中的此类批处理工作负载。
&lt;a href=&#34;https://github.com/kubernetes-sigs/kueue&#34;&gt;Kueue&lt;/a&gt; 是一个在其中扮演关键角色的项目。
它是一个作业队列控制器，决定何时一个作业应该等待，何时一个作业应该被准许启动，以及何时一个作业应该被抢占。
Kueue 旨在安装在一个普通的 Kubernetes 集群上，
同时与现有的成熟控制器（调度器、cluster-autoscaler、kube-controller-manager 等）协作。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
[KWOK](https://github.com/kubernetes-sigs/kwok)
: KWOK is a component in which you can create a cluster of thousands of Nodes in seconds. It’s
  mostly useful for simulation/testing as a lightweight cluster, and actually another SIG sub
  project [kube-scheduler-simulator](https://github.com/kubernetes-sigs/kube-scheduler-simulator)
  uses KWOK background.

[descheduler](https://github.com/kubernetes-sigs/descheduler)
: Descheduler is a component recreating pods that are running on undesired Nodes. In Kubernetes,
  scheduling constraints (`PodAffinity`, `NodeAffinity`, `PodTopologySpread`, etc) are honored only at
  Pod schedule, but it’s not guaranteed that the contrtaints are kept being satisfied afterwards.
  Descheduler evicts Pods violating their scheduling constraints (or other undesired conditions) so
  that they’re recreated and rescheduled.
--&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kwok&#34;&gt;KWOK&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;KWOK 这个组件可以在几秒钟内创建一个包含数千个节点的集群。它主要用于模拟/测试轻量级集群，实际上另一个 SIG 子项目
&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-simulator&#34;&gt;kube-scheduler-simulator&lt;/a&gt; 就在后端使用了 KWOK。&lt;/dd&gt;
&lt;dt&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/descheduler&#34;&gt;Descheduler&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;Descheduler 这个组件可以将运行在不理想的节点上的 Pod 重新创建。
在 Kubernetes 中，调度约束（&lt;code&gt;PodAffinity&lt;/code&gt;、&lt;code&gt;NodeAffinity&lt;/code&gt;、&lt;code&gt;PodTopologySpread&lt;/code&gt; 等）仅在 Pod 调度时被考虑，
但不能保证这些约束在之后仍然被满足。Descheduler 会驱逐违反其调度约束（或其他不符合预期状况）的 Pod，
以便这些 Pod 被重新创建和重新调度。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
[Descheduling Framework](https://github.com/kubernetes-sigs/descheduler/blob/master/keps/753-descheduling-framework/README.md)
: One very interesting on-going project, similar to
  [Scheduling Framework](/docs/concepts/scheduling-eviction/scheduling-framework/) in the
  scheduler, aiming to make descheduling logic extensible and allow maintainers to focus on building
  a core engine of descheduler.
--&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/descheduler/blob/master/keps/753-descheduling-framework/README.md&#34;&gt;Descheduling Framework&lt;/a&gt;:&lt;/dt&gt;
&lt;dd&gt;一个非常有趣的正在进行的项目，类似于调度器中的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;调度框架&lt;/a&gt;，
旨在使去调度逻辑可扩展，并允许维护者们专注于构建 Descheduler 的核心引擎。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
**AP: Thank you for letting us know! And I have to ask, what are some of your favorite things about
this SIG?**

**KN**: What I really like about this SIG is how actively engaged everyone is. We come from various
companies and industries, bringing diverse perspectives to the table. Instead of these differences
causing division, they actually generate a wealth of opinions. Each view is respected, and this
makes our discussions both rich and productive.

I really appreciate this collaborative atmosphere, and I believe it has been key to continuously
improving our components over the years.
--&gt;
&lt;p&gt;&lt;strong&gt;AP: 感谢你告诉我们这些！我想问一下，你最喜欢这个 SIG 的哪些方面？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 我真正喜欢这个 SIG 的地方在于每个人都积极参与。
我们来自不同的公司和行业，带来了多样的视角。
这些差异并没有造成分歧，实际上产生了丰富的观点。
每种观点都会受到尊重，这使我们的讨论既丰富又富有成效。&lt;/p&gt;
&lt;p&gt;我非常欣赏这种协作氛围，我相信这对我们多年来不断改进组件至关重要。&lt;/p&gt;
&lt;!--
## Contributing to SIG Scheduling

**AP: Kubernetes is a community-driven project. Any recommendations for new contributors or
beginners looking to get involved and contribute to SIG scheduling? Where should they start?**

**KN**: Let me start with a general recommendation for contributing to any SIG: a common approach is to look for
[good-first-issue](https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
However, you&#39;ll soon realize that many people worldwide are trying to contribute to the Kubernetes
repository.
--&gt;
&lt;h2 id=&#34;给-sig-scheduling-做贡献&#34;&gt;给 SIG Scheduling 做贡献&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;AP: Kubernetes 是一个社区驱动的项目。你对新贡献者或希望参与并为
SIG Scheduling 做出贡献的初学者有什么建议？他们应该从哪里开始？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 让我先给出一个关于为任何 SIG 贡献的通用建议：一种常见的方法是寻找
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22&#34;&gt;good-first-issue&lt;/a&gt;。
然而，你很快就会意识到，世界各地有很多人正在尝试为 Kubernetes 仓库做贡献。&lt;/p&gt;
&lt;!--
I suggest starting by examining the implementation of a component that interests you. If you have
any questions about it, ask in the corresponding Slack channel (e.g., #sig-scheduling for the
scheduler, #sig-node for kubelet, etc). Once you have a rough understanding of the implementation,
look at issues within the SIG (e.g.,
[sig-scheduling](https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue+label%3Asig%2Fscheduling)),
where you&#39;ll find more unassigned issues compared to good-first-issue ones. You may also want to
filter issues with the
[kind/cleanup](https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue++label%3Akind%2Fcleanup+)
label, which often indicates lower-priority tasks and can be starting points.
--&gt;
&lt;p&gt;我建议先查看你感兴趣的某个组件的实现。如果你对该组件有任何疑问，可以在相应的
Slack 频道中提问（例如，调度器的 #sig-scheduling，kubelet 的 #sig-node 等）。
一旦你对实现有了大致了解，就可以查看 SIG 中的 Issue
（例如，&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue+label%3Asig%2Fscheduling&#34;&gt;sig-scheduling&lt;/a&gt;），
相比 good-first-issue，在这里你会发现更多未分配的 Issue。你可能还想过滤带有
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues?q=is%3Aopen+is%3Aissue++label%3Akind%2Fcleanup+&#34;&gt;kind/cleanup&lt;/a&gt;
标签的 Issue，这通常表示较低优先级的任务，可以作为起点。&lt;/p&gt;
&lt;!--
Specifically for SIG Scheduling, you should first understand the
[Scheduling Framework](/docs/concepts/scheduling-eviction/scheduling-framework/), which is
the fundamental architecture of kube-scheduler. Most of the implementation is found in
[pkg/scheduler](https://github.com/kubernetes/kubernetes/tree/master/pkg/scheduler).
I suggest starting with
[ScheduleOne](https://github.com/kubernetes/kubernetes/blob/0590bb1ac495ae8af2a573f879408e48800da2c5/pkg/scheduler/schedule_one.go#L66)
function and then exploring deeper from there.

Additionally, apart from the main kubernetes/kubernetes repository, consider looking into
sub-projects. These typically have fewer maintainers and offer more opportunities to make a
significant impact. Despite being called &#34;sub&#34; projects, many have a large number of users and a
considerable impact on the community.
--&gt;
&lt;p&gt;具体对于 SIG Scheduling 而言，你应该先了解&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;调度框架&lt;/a&gt;，
这是 kube-scheduler 的基本架构。大多数实现都可以在
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/tree/master/pkg/scheduler&#34;&gt;pkg/scheduler&lt;/a&gt;中找到。我建议从
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/0590bb1ac495ae8af2a573f879408e48800da2c5/pkg/scheduler/schedule_one.go#L66&#34;&gt;ScheduleOne&lt;/a&gt;
函数开始，然后再深入探索。&lt;/p&gt;
&lt;p&gt;此外，除了 kubernetes/kubernetes 主仓库外，还可以考虑查看一些子项目。
这些子项目的维护者通常比较少，你有更多的机会来对其产生重大影响。尽管被称为“子”项目，
但许多项目实际上有大量用户，并对社区产生了相当大的影响。&lt;/p&gt;
&lt;!--
And last but not least, remember contributing to the community isn’t just about code. While I
talked a lot about the implementation contribution, there are many ways to contribute, and each one
is valuable. One comment to an issue, one feedback to an existing feature, one review comment in PR,
one clarification on the documentation; every small contribution helps drive the Kubernetes
ecosystem forward.

**AP: Those are some pretty useful tips! And if I may ask, how do you assist new contributors in
getting started, and what skills are contributors likely to learn by participating in SIG Scheduling?**
--&gt;
&lt;p&gt;最后但同样重要的是，记住为社区做贡献不仅仅是编写代码。
虽然我谈到了很多关于实现的贡献，但还有许多其他方式可以做贡献，每一种都很有价值。
对某个 Issue 的一条评论，对现有特性的一个反馈，对 PR 的一个审查建议，对文档的一个说明阐述；
每一个小贡献都有助于推动 Kubernetes 生态系统向前发展。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AP: 这些建议非常有用！冒昧问一下，你是如何帮助新贡献者入门的，参与 SIG Scheduling 的贡献者可能会学习到哪些技能？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**KN**: Our maintainers are available to answer your questions in the #sig-scheduling Slack
channel. By participating, you&#39;ll gain a deeper understanding of Kubernetes scheduling and have the
opportunity to collaborate and network with maintainers from diverse backgrounds. You&#39;ll learn not
just how to write code, but also how to maintain a large project, design and discuss new features,
address bugs, and much more.

## Future Directions

**AP: What are some Kubernetes-specific challenges in terms of scheduling? Are there any particular
pain points?**
--&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 我们的维护者在 #sig-scheduling Slack 频道中随时可以回答你的问题。
多多参与，你将深入了解 Kubernetes 的调度，并有机会与来自不同背景的维护者合作和建立联系。
你将学习到的不仅仅是如何编写代码，还有如何维护大型项目、设计和讨论新特性、解决 Bug 等等。&lt;/p&gt;
&lt;h2 id=&#34;未来方向&#34;&gt;未来方向&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;AP: 在调度方面，Kubernetes 特有的挑战有哪些？有没有特别的痛点？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**KN**: Scheduling in Kubernetes can be quite challenging because of the diverse needs of different
organizations with different business requirements. Supporting all possible use cases in
kube-scheduler is impossible. Therefore, extensibility is a key focus for us. A few years ago, we
rearchitected kube-scheduler with [Scheduling Framework](/docs/concepts/scheduling-eviction/scheduling-framework/),
which offers flexible extensibility for users to implement various scheduling needs through plugins. This
allows maintainers to focus on the core scheduling features and the framework runtime.
--&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 在 Kubernetes 中进行调度可能相当具有挑战性，因为不同组织有不同的业务要求。
在 kube-scheduler 中支持所有可能的使用场景是不可能的。因此，可扩展性是我们关注的核心焦点。
几年前，我们使用&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework/&#34;&gt;调度框架&lt;/a&gt;为
kube-scheduler 重新设计了架构，为用户通过插件实现各种调度需求提供了灵活的可扩展性。
这使得维护者们能够专注于核心调度特性和框架运行时。&lt;/p&gt;
&lt;!--
Another major issue is maintaining sufficient scheduling throughput. Typically, a Kubernetes cluster
has only one kube-scheduler, so its throughput directly affects the overall scheduling scalability
and, consequently, the cluster&#39;s scalability. Although we have an internal performance test
([scheduler_perf](https://github.com/kubernetes/kubernetes/tree/master/test/integration/scheduler_perf)),
unfortunately, we sometimes overlook performance degradation in less common scenarios. It’s
difficult as even small changes, which look irrelevant to performance, can lead to degradation.
--&gt;
&lt;p&gt;另一个主要问题是保持足够的调度吞吐量。通常，一个 Kubernetes 集群只有一个 kube-scheduler，
因此其吞吐量直接影响整体调度的可扩展性，从而影响集群的可扩展性。尽管我们有一个内部性能测试
(&lt;a href=&#34;https://github.com/kubernetes/kubernetes/tree/master/test/integration/scheduler_perf&#34;&gt;scheduler_perf&lt;/a&gt;)，
但不巧的是，我们有时会忽视在不常见场景下的性能下降。即使是与性能无关的小改动也有难度，可能导致性能下降。&lt;/p&gt;
&lt;!--
**AP: What are some upcoming goals or initiatives for SIG Scheduling? How do you envision the SIG evolving in the future?**

**KN**: Our primary goal is always to build and maintain _extensible_ and _stable_ scheduling
runtime, and I bet this goal will remain unchanged forever.

As already mentioned, extensibility is key to solving the challenge of the diverse needs of
scheduling. Rather than trying to support every different use case directly in kube-scheduler, we
will continue to focus on enhancing extensibility so that it can accommodate various use
cases. [kube-scheduler-wasm-extension](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension)
that I mentioned is also part of this initiative.
--&gt;
&lt;p&gt;&lt;strong&gt;AP: 接下来 SIG Scheduling 有哪些即将实现的目标或计划？你如何看待 SIG 的未来发展？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 我们的主要目标始终是构建和维护&lt;strong&gt;可扩展的&lt;/strong&gt;和&lt;strong&gt;稳定的&lt;/strong&gt;调度运行时，我敢打赌这个目标将永远不会改变。&lt;/p&gt;
&lt;p&gt;正如之前所提到的，可扩展性是解决调度多样化需求挑战的关键。我们不会尝试直接在 kube-scheduler 中支持每种不同的使用场景，
而是将继续专注于增强可扩展性，以便能够适应各种用例。我提到的
&lt;a href=&#34;https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension&#34;&gt;kube-scheduler-wasm-extension&lt;/a&gt;
也是这一计划的一部分。&lt;/p&gt;
&lt;!--
Regarding stability, introducing new optimizations like QueueHint is one of our
strategies. Additionally, maintaining throughput is also a crucial goal towards the future. We’re
planning to enhance our throughput monitoring
([ref](https://github.com/kubernetes/kubernetes/issues/124774)), so that we can notice degradation
as much as possible on our own before releasing. But, realistically, we can&#39;t cover every possible
scenario. We highly appreciate any attention the community can give to scheduling throughput and
encourage feedback and alerts regarding performance issues!
--&gt;
&lt;p&gt;关于稳定性，引入 QueueHint 这类新的优化是我们的一项策略。
此外，保持吞吐量也是面向未来的关键目标。我们计划增强我们的吞吐量监控
(&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/124774&#34;&gt;参考&lt;/a&gt;)，
以便在发布之前尽可能多地发现性能下降问题。但实际上，我们无法覆盖每个可能的场景。
我们非常感谢社区对调度吞吐量的关注，鼓励大家提出反馈，就性能问题提出警示！&lt;/p&gt;
&lt;!--
## Closing Remarks

**AP: Finally, what message would you like to convey to those who are interested in learning more
about SIG Scheduling?**

**KN**: Scheduling is one of the most complicated areas in Kubernetes, and you may find it difficult
at first. But, as I shared earlier, you can find many opportunities for contributions, and many
maintainers are willing to help you understand things. We know your unique perspective and skills
are what makes our open source so powerful 😊
--&gt;
&lt;h2 id=&#34;结束语&#34;&gt;结束语&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;AP: 最后，你想对那些有兴趣了解 SIG Scheduling 的人说些什么？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;KN&lt;/strong&gt;: 调度是 Kubernetes 中最复杂的领域之一，你可能一开始会觉得很困难。但正如我之前分享的，
你可以找到许多贡献的机会，许多维护者愿意帮助你理解各事项。
我们知道你独特的视角和技能是我们的开源项目能够如此强大的源泉 😊&lt;/p&gt;
&lt;!--
Feel free to reach out to us in Slack
([#sig-scheduling](https://kubernetes.slack.com/archives/C09TP78DV)) or
[meetings](https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md#meetings).
I hope this article interests everyone and we can see new contributors!

**AP: Thank you so much for taking the time to do this! I&#39;m confident that many will find this
information invaluable for understanding more about SIG Scheduling and for contributing to the SIG.**
--&gt;
&lt;p&gt;随时可以通过 Slack (&lt;a href=&#34;https://kubernetes.slack.com/archives/C09TP78DV&#34;&gt;#sig-scheduling&lt;/a&gt;)
或&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md#meetings&#34;&gt;会议&lt;/a&gt;联系我们。
我希望这篇文章能引起大家的兴趣，希望能吸引到新的贡献者！&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AP: 非常感谢你抽出时间进行这次访谈！我相信很多人会发现这些信息对理解 SIG Scheduling 和参与 SIG 的贡献非常有价值。&lt;/strong&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.31：kubeadm v1beta4</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/23/kubernetes-1-31-kubeadm-v1beta4/</link>
      <pubDate>Fri, 23 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/23/kubernetes-1-31-kubeadm-v1beta4/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.31: kubeadm v1beta4&#39;
date: 2024-08-23
slug: kubernetes-1-31-kubeadm-v1beta4
author: &gt;
   Paco Xu (DaoCloud)
--&gt;
&lt;!--
As part of the Kubernetes v1.31 release, [`kubeadm`](/docs/reference/setup-tools/kubeadm/) is
adopting a new ([v1beta4](/docs/reference/config-api/kubeadm-config.v1beta4/)) version of
its configuration file format. Configuration in the previous v1beta3 format is now formally
deprecated, which means it&#39;s supported but you should migrate to v1beta4 and stop using
the deprecated format.
Support for v1beta3 configuration will be removed after a minimum of 3 Kubernetes minor releases.
--&gt;
&lt;p&gt;作为 Kubernetes v1.31 发布的一部分，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/setup-tools/kubeadm/&#34;&gt;&lt;code&gt;kubeadm&lt;/code&gt;&lt;/a&gt;
采用了全新版本（&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/&#34;&gt;v1beta4&lt;/a&gt;）的配置文件格式。
之前 v1beta3 格式的配置现已正式弃用，这意味着尽管之前的格式仍然受支持，但你应迁移到 v1beta4 并停止使用已弃用的格式。
对 v1beta3 配置的支持将在至少 3 次 Kubernetes 次要版本发布后被移除。&lt;/p&gt;
&lt;!--
In this article, I&#39;ll walk you through key changes;
I&#39;ll explain about the kubeadm v1beta4 configuration format,
and how to migrate from v1beta3 to v1beta4.

You can read the reference for the v1beta4 configuration format:
[kubeadm Configuration (v1beta4)](/docs/reference/config-api/kubeadm-config.v1beta4/).
--&gt;
&lt;p&gt;在本文中，我将介绍关键的变更；我将解释 kubeadm v1beta4 配置格式，以及如何从 v1beta3 迁移到 v1beta4。&lt;/p&gt;
&lt;p&gt;你可以参阅 v1beta4 配置格式的参考文档：
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/&#34;&gt;kubeadm 配置 (v1beta4)&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### A list of changes since v1beta3

This version improves on the [v1beta3](/docs/reference/config-api/kubeadm-config.v1beta3/)
format by fixing some minor issues and adding a few new fields.

To put it simply,
--&gt;
&lt;h3 id=&#34;自-v1beta3-以来的变更列表&#34;&gt;自 v1beta3 以来的变更列表&lt;/h3&gt;
&lt;p&gt;此版本通过修复一些小问题并添加一些新字段来改进
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3/&#34;&gt;v1beta3&lt;/a&gt; 格式。&lt;/p&gt;
&lt;p&gt;简单而言，&lt;/p&gt;
&lt;!--
- Two new configuration elements: ResetConfiguration and UpgradeConfiguration
- For InitConfiguration and JoinConfiguration, `dryRun` mode and `nodeRegistration.imagePullSerial` are supported
- For ClusterConfiguration, there are new fields including `certificateValidityPeriod`,
`caCertificateValidityPeriod`, `encryptionAlgorithm`, `dns.disabled` and `proxy.disabled`.
- Support `extraEnvs` for all control plan components
- `extraArgs` changed from a map to structured extra arguments for duplicates
- Add a `timeouts` structure for init, join, upgrade and reset.
--&gt;
&lt;ul&gt;
&lt;li&gt;增加了两个新的配置元素：ResetConfiguration 和 UpgradeConfiguration&lt;/li&gt;
&lt;li&gt;对于 InitConfiguration 和 JoinConfiguration，支持 &lt;code&gt;dryRun&lt;/code&gt; 模式和 &lt;code&gt;nodeRegistration.imagePullSerial&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;对于 ClusterConfiguration，新增字段包括 &lt;code&gt;certificateValidityPeriod&lt;/code&gt;、&lt;code&gt;caCertificateValidityPeriod&lt;/code&gt;、
&lt;code&gt;encryptionAlgorithm&lt;/code&gt;、&lt;code&gt;dns.disabled&lt;/code&gt; 和 &lt;code&gt;proxy.disabled&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;所有控制平面组件支持 &lt;code&gt;extraEnvs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;extraArgs&lt;/code&gt; 从映射变更为支持重复的结构化额外参数&lt;/li&gt;
&lt;li&gt;为 init、join、upgrade 和 reset 添加了 &lt;code&gt;timeouts&lt;/code&gt; 结构&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For details, you can see the [official document](/docs/reference/config-api/kubeadm-config.v1beta4/) below:

- Support custom environment variables in control plane components under `ClusterConfiguration`.
Use `apiServer.extraEnvs`, `controllerManager.extraEnvs`, `scheduler.extraEnvs`, `etcd.local.extraEnvs`.
- The ResetConfiguration API type is now supported in v1beta4. Users are able to reset a node by passing
a `--config` file to `kubeadm reset`.
- `dryRun` mode is now configurable in InitConfiguration and JoinConfiguration.
--&gt;
&lt;p&gt;有关细节请参阅以下&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/&#34;&gt;官方文档&lt;/a&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在 &lt;code&gt;ClusterConfiguration&lt;/code&gt; 下支持控制平面组件的自定义环境变量。
可以使用 &lt;code&gt;apiServer.extraEnvs&lt;/code&gt;、&lt;code&gt;controllerManager.extraEnvs&lt;/code&gt;、&lt;code&gt;scheduler.extraEnvs&lt;/code&gt;、&lt;code&gt;etcd.local.extraEnvs&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;ResetConfiguration API 类型现在在 v1beta4 中得到支持。用户可以通过将 &lt;code&gt;--config&lt;/code&gt; 文件传递给 &lt;code&gt;kubeadm reset&lt;/code&gt; 来重置节点。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dryRun&lt;/code&gt; 模式现在在 InitConfiguration 和 JoinConfiguration 中可配置。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Replace the existing string/string extra argument maps with structured extra arguments that support duplicates.
 The change applies to `ClusterConfiguration` - `apiServer.extraArgs`, `controllerManager.extraArgs`,
 `scheduler.extraArgs`, `etcd.local.extraArgs`. Also to `nodeRegistrationOptions.kubeletExtraArgs`.
- Added `ClusterConfiguration.encryptionAlgorithm` that can be used to set the asymmetric encryption
 algorithm used for this cluster&#39;s keys and certificates. Can be one of &#34;RSA-2048&#34; (default), &#34;RSA-3072&#34;,
  &#34;RSA-4096&#34; or &#34;ECDSA-P256&#34;.
- Added `ClusterConfiguration.dns.disabled` and `ClusterConfiguration.proxy.disabled` that can be used
  to disable the CoreDNS and kube-proxy addons during cluster initialization.
  Skipping the related addons phases, during cluster creation will set the same fields to `true`.
--&gt;
&lt;ul&gt;
&lt;li&gt;用支持重复的结构化额外参数替换现有的 string/string 额外参数映射。
此变更适用于 &lt;code&gt;ClusterConfiguration&lt;/code&gt; - &lt;code&gt;apiServer.extraArgs&lt;/code&gt;、&lt;code&gt;controllerManager.extraArgs&lt;/code&gt;、
&lt;code&gt;scheduler.extraArgs&lt;/code&gt;、&lt;code&gt;etcd.local.extraArgs&lt;/code&gt;。也适用于 &lt;code&gt;nodeRegistrationOptions.kubeletExtraArgs&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;添加了 &lt;code&gt;ClusterConfiguration.encryptionAlgorithm&lt;/code&gt;，可用于设置此集群的密钥和证书所使用的非对称加密算法。
可以是 &amp;quot;RSA-2048&amp;quot;（默认）、&amp;quot;RSA-3072&amp;quot;、&amp;quot;RSA-4096&amp;quot; 或 &amp;quot;ECDSA-P256&amp;quot; 之一。&lt;/li&gt;
&lt;li&gt;添加了 &lt;code&gt;ClusterConfiguration.dns.disabled&lt;/code&gt; 和 &lt;code&gt;ClusterConfiguration.proxy.disabled&lt;/code&gt;，
可用于在集群初始化期间禁用 CoreDNS 和 kube-proxy 插件。
在集群创建期间跳过相关插件阶段将把相同的字段设置为 &lt;code&gt;true&lt;/code&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Added the `nodeRegistration.imagePullSerial` field in `InitConfiguration` and `JoinConfiguration`,
  which can be used to control if kubeadm pulls images serially or in parallel.
- The UpgradeConfiguration kubeadm API is now supported in v1beta4 when passing `--config` to
  `kubeadm upgrade` subcommands.
  For upgrade subcommands, the usage of component configuration for kubelet and kube-proxy, as well as
  InitConfiguration and ClusterConfiguration, is now deprecated and will be ignored when passing `--config`.
- Added a `timeouts` structure to `InitConfiguration`, `JoinConfiguration`, `ResetConfiguration` and
  `UpgradeConfiguration` that can be used to configure various timeouts.
  The `ClusterConfiguration.timeoutForControlPlane` field is replaced by `timeouts.controlPlaneComponentHealthCheck`.
  The `JoinConfiguration.discovery.timeout` is replaced by `timeouts.discovery`.
--&gt;
&lt;ul&gt;
&lt;li&gt;在 &lt;code&gt;InitConfiguration&lt;/code&gt; 和 &lt;code&gt;JoinConfiguration&lt;/code&gt; 中添加了 &lt;code&gt;nodeRegistration.imagePullSerial&lt;/code&gt; 字段，
可用于控制 kubeadm 是顺序拉取镜像还是并行拉取镜像。&lt;/li&gt;
&lt;li&gt;当将 &lt;code&gt;--config&lt;/code&gt; 传递给 &lt;code&gt;kubeadm upgrade&lt;/code&gt; 子命令时，现已在 v1beta4 中支持 UpgradeConfiguration kubeadm API。
对于升级子命令，kubelet 和 kube-proxy 的组件配置以及 InitConfiguration 和 ClusterConfiguration 的用法现已弃用，
并将在传递 &lt;code&gt;--config&lt;/code&gt; 时被忽略。&lt;/li&gt;
&lt;li&gt;在 &lt;code&gt;InitConfiguration&lt;/code&gt;、&lt;code&gt;JoinConfiguration&lt;/code&gt;、&lt;code&gt;ResetConfiguration&lt;/code&gt; 和 &lt;code&gt;UpgradeConfiguration&lt;/code&gt;
中添加了 &lt;code&gt;timeouts&lt;/code&gt; 结构，可用于配置各种超时。
&lt;code&gt;ClusterConfiguration.timeoutForControlPlane&lt;/code&gt; 字段被 &lt;code&gt;timeouts.controlPlaneComponentHealthCheck&lt;/code&gt; 替换。
&lt;code&gt;JoinConfiguration.discovery.timeout&lt;/code&gt; 被 &lt;code&gt;timeouts.discovery&lt;/code&gt; 替换。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Added a `certificateValidityPeriod` and `caCertificateValidityPeriod` fields to `ClusterConfiguration`.
  These fields can be used to control the validity period of certificates generated by kubeadm during
  sub-commands such as `init`, `join`, `upgrade` and `certs`.
  Default values continue to be 1 year for non-CA certificates and 10 years for CA certificates.
  Also note that only non-CA certificates are renewable by `kubeadm certs renew`.

These changes simplify the configuration of tools that use kubeadm
and improve the extensibility of kubeadm itself.
--&gt;
&lt;ul&gt;
&lt;li&gt;向 &lt;code&gt;ClusterConfiguration&lt;/code&gt; 添加了 &lt;code&gt;certificateValidityPeriod&lt;/code&gt; 和 &lt;code&gt;caCertificateValidityPeriod&lt;/code&gt; 字段。
这些字段可用于控制 kubeadm 在 &lt;code&gt;init&lt;/code&gt;、&lt;code&gt;join&lt;/code&gt;、&lt;code&gt;upgrade&lt;/code&gt; 和 &lt;code&gt;certs&lt;/code&gt; 等子命令中生成的证书的有效期。
默认值继续为非 CA 证书 1 年和 CA 证书 10 年。另请注意，只有非 CA 证书可以通过 &lt;code&gt;kubeadm certs renew&lt;/code&gt; 进行续期。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这些变更简化了使用 kubeadm 的工具的配置，并提高了 kubeadm 本身的可扩展性。&lt;/p&gt;
&lt;!--
### How to migrate v1beta3 configuration to v1beta4?

If your configuration is not using the latest version, it is recommended that you migrate using
the [kubeadm config migrate](/docs/reference/setup-tools/kubeadm/kubeadm-config/#cmd-config-migrate) command.

This command reads an existing configuration file that uses the old format, and writes a new
file that uses the current format.
--&gt;
&lt;h3 id=&#34;如何将-v1beta3-配置迁移到-v1beta4&#34;&gt;如何将 v1beta3 配置迁移到 v1beta4？&lt;/h3&gt;
&lt;p&gt;如果你的配置未使用最新版本，建议你使用
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-config/#cmd-config-migrate&#34;&gt;kubeadm config migrate&lt;/a&gt;
命令进行迁移。&lt;/p&gt;
&lt;p&gt;此命令读取使用旧格式的现有配置文件，并写入一个使用当前格式的新文件。&lt;/p&gt;
&lt;!--
#### Example {#example-kubeadm-config-migrate}

Using kubeadm v1.31, run `kubeadm config migrate --old-config old-v1beta3.yaml --new-config new-v1beta4.yaml`

## How do I get involved?

Huge thanks to all the contributors who helped with the design, implementation,
and review of this feature:
--&gt;
&lt;h4 id=&#34;example-kubeadm-config-migrate&#34;&gt;示例&lt;/h4&gt;
&lt;p&gt;使用 kubeadm v1.31，运行 &lt;code&gt;kubeadm config migrate --old-config old-v1beta3.yaml --new-config new-v1beta4.yaml&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;我该如何参与&#34;&gt;我该如何参与？&lt;/h2&gt;
&lt;p&gt;衷心感谢在此特性的设计、实现和评审中提供帮助的所有贡献者：&lt;/p&gt;
&lt;!--
- Lubomir I. Ivanov ([neolit123](https://github.com/neolit123))
- Dave Chen([chendave](https://github.com/chendave))
- Paco Xu ([pacoxu](https://github.com/pacoxu))
- Sata Qiu([sataqiu](https://github.com/sataqiu))
- Baofa Fan([carlory](https://github.com/carlory))
- Calvin Chen([calvin0327](https://github.com/calvin0327))
- Ruquan Zhao([ruquanzhao](https://github.com/ruquanzhao))
--&gt;
&lt;ul&gt;
&lt;li&gt;Lubomir I. Ivanov (&lt;a href=&#34;https://github.com/neolit123&#34;&gt;neolit123&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Dave Chen (&lt;a href=&#34;https://github.com/chendave&#34;&gt;chendave&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Paco Xu (&lt;a href=&#34;https://github.com/pacoxu&#34;&gt;pacoxu&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Sata Qiu (&lt;a href=&#34;https://github.com/sataqiu&#34;&gt;sataqiu&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Baofa Fan (&lt;a href=&#34;https://github.com/carlory&#34;&gt;carlory&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Calvin Chen (&lt;a href=&#34;https://github.com/calvin0327&#34;&gt;calvin0327&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ruquan Zhao (&lt;a href=&#34;https://github.com/ruquanzhao&#34;&gt;ruquanzhao&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For those interested in getting involved in future discussions on kubeadm configuration,
you can reach out kubeadm or [SIG-cluster-lifecycle](https://github.com/kubernetes/community/blob/master/sig-cluster-lifecycle/README.md) by several means:

- v1beta4 related items are tracked in [kubeadm issue #2890](https://github.com/kubernetes/kubeadm/issues/2890).
- Slack: [#kubeadm](https://kubernetes.slack.com/messages/kubeadm) or [#sig-cluster-lifecycle](https://kubernetes.slack.com/messages/sig-cluster-lifecycle)
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle)
--&gt;
&lt;p&gt;如果你有兴趣参与 kubeadm 配置的后续讨论，可以通过多种方式与 kubeadm 或
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-cluster-lifecycle/README.md&#34;&gt;SIG-cluster-lifecycle&lt;/a&gt; 联系：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;v1beta4 相关事项在 &lt;a href=&#34;https://github.com/kubernetes/kubeadm/issues/2890&#34;&gt;kubeadm issue #2890&lt;/a&gt; 中跟踪。&lt;/li&gt;
&lt;li&gt;Slack: &lt;a href=&#34;https://kubernetes.slack.com/messages/kubeadm&#34;&gt;#kubeadm&lt;/a&gt; 或
&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-cluster-lifecycle&#34;&gt;#sig-cluster-lifecycle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle&#34;&gt;邮件列表&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：kubectl debug 中的自定义模板化配置特性已进入 Beta 阶段</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/kubernetes-1-31-custom-profiling-kubectl-debug/</link>
      <pubDate>Thu, 22 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/kubernetes-1-31-custom-profiling-kubectl-debug/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: Custom Profiling in Kubectl Debug Graduates to Beta&#34;
date: 2024-08-22
slug: kubernetes-1-31-custom-profiling-kubectl-debug
author: &gt;
  Arda Güçlü (Red Hat)
--&gt;
&lt;!--
There are many ways of troubleshooting the pods and nodes in the cluster. However, `kubectl debug` is one of the easiest, highly used and most prominent ones. It
provides a set of static profiles and each profile serves for a different kind of role. For instance, from the network administrator&#39;s point of view, 
debugging the node should be as easy as this:
--&gt;
&lt;p&gt;有很多方法可以对集群中的 Pod 和节点进行故障排查，而 &lt;code&gt;kubectl debug&lt;/code&gt; 是最简单、使用最广泛、最突出的方法之一。
它提供了一组静态配置，每个配置适用于不同类型的角色。
例如，从网络管理员的视角来看，调试节点应该像这样简单：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl debug node/mynode -it --image&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;busybox --profile&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;netadmin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
On the other hand, static profiles also bring about inherent rigidity, which has some implications for some pods contrary to their ease of use.
Because there are various kinds of pods (or nodes) that all have their specific
necessities, and unfortunately, some can&#39;t be debugged by only using the static profiles. 

Take an instance of a simple pod consisting of a container whose healthiness relies on an environment variable:
--&gt;
&lt;p&gt;另一方面，静态配置也存在固有的刚性，对某些 Pod 所产生的影响与其易用性是相悖的。
因为各种类型的 Pod（或节点）都有其特定的需求，不幸的是，有些问题仅通过静态配置是无法调试的。&lt;/p&gt;
&lt;p&gt;以一个简单的 Pod 为例，此 Pod 由一个容器组成，其健康状况依赖于环境变量：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-container&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;customapp:latest&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;env&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;REQUIRED_ENV_VAR&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;value1&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Currently, copying the pod is the sole mechanism that supports debugging this pod in kubectl debug. Furthermore, what if user needs to modify the `REQUIRED_ENV_VAR` to something different
for advanced troubleshooting?. There is no mechanism to achieve this.
--&gt;
&lt;p&gt;目前，复制 Pod 是使用 &lt;code&gt;kubectl debug&lt;/code&gt; 命令调试此 Pod 的唯一机制。
此外，如果用户需要将 &lt;code&gt;REQUIRED_ENV_VAR&lt;/code&gt; 环境变量修改为其他不同值来进行高级故障排查，
当前并没有机制能够实现这一需求。&lt;/p&gt;
&lt;!--
## Custom Profiling

Custom profiling is a new functionality available under `--custom` flag, introduced in kubectl debug to provide extensibility. It expects partial `Container` spec in either YAML or JSON format. 
In order to debug the example-container above by creating an ephemeral container, we simply have to define this YAML:
--&gt;
&lt;h2 id=&#34;自定义模板化配置&#34;&gt;自定义模板化配置&lt;/h2&gt;
&lt;p&gt;自定义模板化配置使用 &lt;code&gt;--custom&lt;/code&gt; 标志提供的一项新特性，在 &lt;code&gt;kubectl debug&lt;/code&gt; 中引入以提供可扩展性。
它需要以 YAML 或 JSON 格式的内容填充 &lt;code&gt;container&lt;/code&gt; 规约，
为了通过创建临时容器来调试上面的示例容器，我们只需定义此 YAML：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# partial_container.yaml&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;env&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;REQUIRED_ENV_VAR&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;value&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;value2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
and execute:
--&gt;
&lt;p&gt;并且执行：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl debug example-pod -it --image&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;customapp --custom&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;partial_container.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Here is another example that modifies multiple fields at once (change port number, add resource limits, modify environment variable) in JSON:
--&gt;
&lt;p&gt;下面是另一个在 JSON 中一次修改多个字段（更改端口号、添加资源限制、修改环境变量）的示例：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;ports&amp;#34;&lt;/span&gt;: [
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;containerPort&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#666&#34;&gt;80&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  ],
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;resources&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;limits&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;cpu&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0.5&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;memory&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;512Mi&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    },
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;requests&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;cpu&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;0.2&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;memory&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;256Mi&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  },
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;env&amp;#34;&lt;/span&gt;: [
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;REQUIRED_ENV_VAR&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;value2&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  ]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Constraints

Uncontrolled extensibility hurts the usability. So that, custom profiling is not allowed for certain fields such as command, image, lifecycle, volume devices and container name.
In the future, more fields can be added to the disallowed list if required.
--&gt;
&lt;h2 id=&#34;约束&#34;&gt;约束&lt;/h2&gt;
&lt;p&gt;不受控制的扩展性会损害可用性。因此，某些字段（例如命令、镜像、生命周期、卷设备和容器名称）不允许进行自定义模版化配置。
将来如果需要，可以将更多字段添加到禁止列表中。&lt;/p&gt;
&lt;!--
## Limitations

The `kubectl debug` command has 3 aspects: Debugging with ephemeral containers, pod copying, and node debugging. The largest intersection set of these aspects is the container spec within a Pod
That&#39;s why, custom profiling only supports the modification of the fields that are defined with `containers`. This leads to a limitation that if user needs to modify the other fields in the Pod spec, it is not supported.
--&gt;
&lt;h2 id=&#34;限制&#34;&gt;限制&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;kubectl debug&lt;/code&gt; 命令有 3 个方面：使用临时容器进行调试、Pod 复制和节点调试。
这些方面最大的交集是 Pod 内的容器规约，因此自定义模版化配置仅支持修改使用 &lt;code&gt;containers&lt;/code&gt; 下定义的字段。
这导致了一个限制，如果用户需要修改 Pod 规约中的其他字段，则不受支持。&lt;/p&gt;
&lt;!--
## Acknowledgments

Special thanks to all the contributors who reviewed and commented on this feature, from the initial conception to its actual implementation (alphabetical order):
--&gt;
&lt;h2 id=&#34;致谢&#34;&gt;致谢&lt;/h2&gt;
&lt;p&gt;特别感谢所有审查和评论此特性（从最初的概念到实际实施）的贡献者（按字母顺序排列）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/eddiezane&#34;&gt;Eddie Zaneski&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/soltysh&#34;&gt;Maciej Szulik&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/verb&#34;&gt;Lee Verberne&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：细粒度的 SupplementalGroups 控制</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/fine-grained-supplementalgroups-control/</link>
      <pubDate>Thu, 22 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/fine-grained-supplementalgroups-control/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.31: Fine-grained SupplementalGroups control&#39;
date: 2024-08-22
slug: fine-grained-supplementalgroups-control
author: &gt;
  Shingo Omura (Woven By Toyota)
--&gt;
&lt;!--
This blog discusses a new feature in Kubernetes 1.31 to improve the handling of supplementary groups in containers within Pods.
--&gt;
&lt;p&gt;本博客讨论了 Kubernetes 1.31 中的一项新特性，目的是改善处理 Pod 中容器内的附加组。&lt;/p&gt;
&lt;!--
## Motivation: Implicit group memberships defined in `/etc/group` in the container image

Although this behavior may not be popular with many Kubernetes cluster users/admins, kubernetes, by default, _merges_ group information from the Pod with information defined in `/etc/group` in the container image.

Let&#39;s see an example, below Pod specifies `runAsUser=1000`, `runAsGroup=3000` and `supplementalGroups=4000` in the Pod&#39;s security context.
--&gt;
&lt;h2 id=&#34;动机-容器镜像中-etc-group-中定义的隐式组成员关系&#34;&gt;动机：容器镜像中 &lt;code&gt;/etc/group&lt;/code&gt; 中定义的隐式组成员关系&lt;/h2&gt;
&lt;p&gt;尽管这种行为可能并不受许多 Kubernetes 集群用户/管理员的欢迎，
但 Kubernetes 默认情况下会将 Pod 中的组信息与容器镜像中 &lt;code&gt;/etc/group&lt;/code&gt; 中定义的信息进行&lt;strong&gt;合并&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;让我们看一个例子，以下 Pod 在 Pod 的安全上下文中指定了
&lt;code&gt;runAsUser=1000&lt;/code&gt;、&lt;code&gt;runAsGroup=3000&lt;/code&gt; 和 &lt;code&gt;supplementalGroups=4000&lt;/code&gt;。&lt;/p&gt;
&lt;div class=&#34;highlight code-sample&#34;&gt;
    &lt;div class=&#34;copy-code-icon&#34;&gt;
    &lt;a href=&#34;https://raw.githubusercontent.com/kubernetes/website/main/content/zh-cn/examples/implicit-groups.yaml&#34; download=&#34;implicit-groups.yaml&#34;&gt;&lt;code&gt;implicit-groups.yaml&lt;/code&gt;
    &lt;/a&gt;&lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/images/copycode.svg&#34; class=&#34;icon-copycode&#34; onclick=&#34;copyCode(&#39;implicit-groups-yaml&#39;)&#34; title=&#34;复制 implicit-groups.yaml 到剪贴板&#34;&gt;&lt;/img&gt;&lt;/div&gt;
    &lt;div class=&#34;includecode&#34; id=&#34;implicit-groups-yaml&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;implicit-groups&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;securityContext&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;runAsUser&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;runAsGroup&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;supplementalGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#666&#34;&gt;4000&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ctr&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;registry.k8s.io/e2e-test-images/agnhost:2.45&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sh&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sleep 1h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;securityContext&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowPrivilegeEscalation&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;false&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!--
What is the result of `id` command in the `ctr` container?

```console
# Create the Pod:
$ kubectl apply -f https://k8s.io/blog/2024-08-22-Fine-grained-SupplementalGroups-control/implicit-groups.yaml

# Verify that the Pod&#39;s Container is running:
$ kubectl get pod implicit-groups

# Check the id command
$ kubectl exec implicit-groups -- id
```
--&gt;
&lt;p&gt;在 &lt;code&gt;ctr&lt;/code&gt; 容器中执行 &lt;code&gt;id&lt;/code&gt; 命令的结果是什么？&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 创建 Pod：
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl apply -f https://k8s.io/blog/2024-08-22-Fine-grained-SupplementalGroups-control/implicit-groups.yaml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 验证 Pod 的容器正在运行：
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl get pod implicit-groups
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 检查 id 命令
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl &lt;span style=&#34;color:#a2f&#34;&gt;exec&lt;/span&gt; implicit-groups -- id
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then, output should be similar to this:
--&gt;
&lt;p&gt;输出应类似于：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-none&#34; data-lang=&#34;none&#34;&gt;uid=1000 gid=3000 groups=3000,4000,50000
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Where does group ID `50000` in supplementary groups (`groups` field) come from, even though `50000` is not defined in the Pod&#39;s manifest at all? The answer is `/etc/group` file in the container image.

Checking the contents of `/etc/group` in the container image should show below:
--&gt;
&lt;p&gt;尽管 &lt;code&gt;50000&lt;/code&gt; 根本没有在 Pod 的清单中被定义，但附加组中的组 ID &lt;code&gt;50000&lt;/code&gt;（&lt;code&gt;groups&lt;/code&gt; 字段）是从哪里来的呢？
答案是容器镜像中的 &lt;code&gt;/etc/group&lt;/code&gt; 文件。&lt;/p&gt;
&lt;p&gt;检查容器镜像中 &lt;code&gt;/etc/group&lt;/code&gt; 的内容应如下所示：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl &lt;span style=&#34;color:#a2f&#34;&gt;exec&lt;/span&gt; implicit-groups -- cat /etc/group
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;user-defined-in-image:x:1000:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;group-defined-in-image:x:50000:user-defined-in-image
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Aha! The container&#39;s primary user `1000` belongs to the group `50000` in the last entry.

Thus, the group membership defined in `/etc/group` in the container image for the container&#39;s primary user is _implicitly_ merged to the information from the Pod. Please note that this was a design decision the current CRI implementations inherited from Docker, and the community never really reconsidered it until now.
--&gt;
&lt;p&gt;原来如此！容器的主要用户 &lt;code&gt;1000&lt;/code&gt; 属于最后一个条目中的组 &lt;code&gt;50000&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;因此，容器镜像中为容器的主要用户定义的组成员关系会被&lt;strong&gt;隐式&lt;/strong&gt;合并到 Pod 的信息中。
请注意，这是当前 CRI 实现从 Docker 继承的设计决策，而社区直到现在才重新考虑这个问题。&lt;/p&gt;
&lt;!--
### What&#39;s wrong with it?

The _implicitly_ merged group information from `/etc/group` in the container image may cause some concerns particularly in accessing volumes (see [kubernetes/kubernetes#112879](https://issue.k8s.io/112879) for details) because file permission is controlled by uid/gid in Linux. Even worse, the implicit gids from `/etc/group` can not be detected/validated by any policy engines because there is no clue for the implicit group information in the manifest. This can also be a concern for Kubernetes security.
--&gt;
&lt;h3 id=&#34;这有什么问题&#34;&gt;这有什么问题？&lt;/h3&gt;
&lt;p&gt;从容器镜像中的 &lt;code&gt;/etc/group&lt;/code&gt; &lt;strong&gt;隐式&lt;/strong&gt;合并的组信息可能会引起一些担忧，特别是在访问卷时
（有关细节参见 &lt;a href=&#34;https://issue.k8s.io/112879&#34;&gt;kubernetes/kubernetes#112879&lt;/a&gt;），
因为在 Linux 中文件权限是通过 uid/gid 进行控制的。
更糟糕的是，隐式的 gid 无法被任何策略引擎所检测/验证，因为在清单中没有隐式组信息的线索。
这对 Kubernetes 的安全性也可能构成隐患。&lt;/p&gt;
&lt;!--
## Fine-grained SupplementalGroups control in a Pod: `SupplementaryGroupsPolicy`

To tackle the above problem, Kubernetes 1.31 introduces new field `supplementalGroupsPolicy` in Pod&#39;s `.spec.securityContext`.

This field provies a way to control how to calculate supplementary groups for the container processes in a Pod. The available policy is below:
--&gt;
&lt;h2 id=&#34;pod-中的细粒度-supplementalgroups-控制-supplementarygroupspolicy&#34;&gt;Pod 中的细粒度 SupplementalGroups 控制：&lt;code&gt;SupplementaryGroupsPolicy&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;为了解决上述问题，Kubernetes 1.31 在 Pod 的 &lt;code&gt;.spec.securityContext&lt;/code&gt;
中引入了新的字段 &lt;code&gt;supplementalGroupsPolicy&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;此字段提供了一种控制 Pod 中容器进程如何计算附加组的方法。可用的策略如下：&lt;/p&gt;
&lt;!--
* _Merge_: The group membership defined in `/etc/group` for the container&#39;s primary user will be merged. If not specified, this policy will be applied (i.e. as-is behavior for backword compatibility).

* _Strict_: it only attaches specified group IDs in `fsGroup`, `supplementalGroups`, or `runAsGroup` fields as the supplementary groups of the container processes. This means no group membership defined in `/etc/group` for the container&#39;s primary user will be merged.

Let&#39;s see how `Strict` policy works.
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Merge&lt;/strong&gt;：将容器的主要用户在 &lt;code&gt;/etc/group&lt;/code&gt; 中定义的组成员关系进行合并。
如果不指定，则应用此策略（即为了向后兼容性而保持的原有行为）。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Strict&lt;/strong&gt;：仅将 &lt;code&gt;fsGroup&lt;/code&gt;、&lt;code&gt;supplementalGroups&lt;/code&gt; 或 &lt;code&gt;runAsGroup&lt;/code&gt;
字段中指定的组 ID 挂接为容器进程的附加组。这意味着容器的主要用户在 &lt;code&gt;/etc/group&lt;/code&gt; 中定义的任何组成员关系都不会被合并。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;让我们看看 &lt;code&gt;Strict&lt;/code&gt; 策略是如何工作的。&lt;/p&gt;
&lt;div class=&#34;highlight code-sample&#34;&gt;
    &lt;div class=&#34;copy-code-icon&#34;&gt;
    &lt;a href=&#34;https://raw.githubusercontent.com/kubernetes/website/main/content/zh-cn/examples/strict-supplementalgroups-policy.yaml&#34; download=&#34;strict-supplementalgroups-policy.yaml&#34;&gt;&lt;code&gt;strict-supplementalgroups-policy.yaml&lt;/code&gt;
    &lt;/a&gt;&lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/images/copycode.svg&#34; class=&#34;icon-copycode&#34; onclick=&#34;copyCode(&#39;strict-supplementalgroups-policy-yaml&#39;)&#34; title=&#34;复制 strict-supplementalgroups-policy.yaml 到剪贴板&#34;&gt;&lt;/img&gt;&lt;/div&gt;
    &lt;div class=&#34;includecode&#34; id=&#34;strict-supplementalgroups-policy-yaml&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;strict-supplementalgroups-policy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;securityContext&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;runAsUser&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;runAsGroup&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;supplementalGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#666&#34;&gt;4000&lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;supplementalGroupsPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Strict&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ctr&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;registry.k8s.io/e2e-test-images/agnhost:2.45&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sh&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sleep 1h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;securityContext&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;allowPrivilegeEscalation&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;false&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!--
```console
# Create the Pod:
$ kubectl apply -f https://k8s.io/blog/2024-08-22-Fine-grained-SupplementalGroups-control/strict-supplementalgroups-policy.yaml

# Verify that the Pod&#39;s Container is running:
$ kubectl get pod strict-supplementalgroups-policy

# Check the process identity:
kubectl exec -it strict-supplementalgroups-policy -- id
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 创建 Pod：
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl apply -f https://k8s.io/blog/2024-08-22-Fine-grained-SupplementalGroups-control/strict-supplementalgroups-policy.yaml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 验证 Pod 的容器正在运行：
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl get pod strict-supplementalgroups-policy
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;#&lt;/span&gt; 检查进程身份：
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;kubectl exec -it strict-supplementalgroups-policy -- id
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The output should be similar to this:
--&gt;
&lt;p&gt;输出应类似于：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-none&#34; data-lang=&#34;none&#34;&gt;uid=1000 gid=3000 groups=3000,4000
&lt;/code&gt;&lt;/pre&gt;&lt;!--
You can see `Strict` policy can exclude group `50000` from `groups`! 

Thus, ensuring `supplementalGroupsPolicy: Strict` (enforced by some policy mechanism) helps prevent the implicit supplementary groups in a Pod.
--&gt;
&lt;p&gt;你可以看到 &lt;code&gt;Strict&lt;/code&gt; 策略可以将组 &lt;code&gt;50000&lt;/code&gt; 从 &lt;code&gt;groups&lt;/code&gt; 中排除出去！&lt;/p&gt;
&lt;p&gt;因此，确保（通过某些策略机制强制执行的）&lt;code&gt;supplementalGroupsPolicy: Strict&lt;/code&gt; 有助于防止 Pod 中的隐式附加组。&lt;/p&gt;

&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&lt;h4 class=&#34;alert-heading&#34;&gt;说明：&lt;/h4&gt;&lt;!--
Actually, this is not enough because container with sufficient privileges / capability can change its process identity. Please see the following section for details.
--&gt;
&lt;p&gt;实际上，这还不够，因为具有足够权限/能力的容器可以更改其进程身份。
有关细节参见以下章节。&lt;/p&gt;&lt;/div&gt;

&lt;!--
## Attached process identity in Pod status

This feature also exposes the process identity attached to the first container process of the container
via `.status.containerStatuses[].user.linux` field. It would be helpful to see if implicit group IDs are attached.
--&gt;
&lt;h2 id=&#34;pod-状态中挂接的进程身份&#34;&gt;Pod 状态中挂接的进程身份&lt;/h2&gt;
&lt;p&gt;此特性还通过 &lt;code&gt;.status.containerStatuses[].user.linux&lt;/code&gt;
字段公开挂接到容器的第一个容器进程的进程身份。这将有助于查看隐式组 ID 是否被挂接。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerStatuses&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ctr&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;user&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;linux&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;gid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;supplementalGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#666&#34;&gt;3000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#666&#34;&gt;4000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&lt;h4 class=&#34;alert-heading&#34;&gt;说明：&lt;/h4&gt;&lt;!--
Please note that the values in `status.containerStatuses[].user.linux` field is _the firstly attached_
process identity to the first container process in the container. If the container has sufficient privilege
to call system calls related to process identity (e.g. [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html), [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html) or [`setgroups(2)`](https://man7.org/linux/man-pages/man2/setgroups.2.html), etc.), the container process can change its identity. Thus, the _actual_ process identity will be dynamic.
--&gt;
&lt;p&gt;请注意，&lt;code&gt;status.containerStatuses[].user.linux&lt;/code&gt; 字段中的值是&lt;strong&gt;首次挂接&lt;/strong&gt;到容器中第一个容器进程的进程身份。
如果容器具有足够的权限调用与进程身份相关的系统调用（例如
&lt;a href=&#34;https://man7.org/linux/man-pages/man2/setuid.2.html&#34;&gt;&lt;code&gt;setuid(2)&lt;/code&gt;&lt;/a&gt;、
&lt;a href=&#34;https://man7.org/linux/man-pages/man2/setgid.2.html&#34;&gt;&lt;code&gt;setgid(2)&lt;/code&gt;&lt;/a&gt; 或
&lt;a href=&#34;https://man7.org/linux/man-pages/man2/setgroups.2.html&#34;&gt;&lt;code&gt;setgroups(2)&lt;/code&gt;&lt;/a&gt; 等），
则容器进程可以更改其身份。因此，&lt;strong&gt;实际&lt;/strong&gt;的进程身份将是动态的。&lt;/p&gt;&lt;/div&gt;

&lt;!--
## Feature availability

To enable `supplementalGroupsPolicy` field, the following components have to be used:
--&gt;
&lt;h2 id=&#34;特性可用性&#34;&gt;特性可用性&lt;/h2&gt;
&lt;p&gt;要启用 &lt;code&gt;supplementalGroupsPolicy&lt;/code&gt; 字段，必须使用以下组件：&lt;/p&gt;
&lt;!--
- Kubernetes: v1.31 or later, with the `SupplementalGroupsPolicy` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) enabled. As of v1.31, the gate is marked as alpha.
- CRI runtime:
  - containerd: v2.0 or later
  - CRI-O: v1.31 or later

You can see if the feature is supported in the Node&#39;s `.status.features.supplementalGroupsPolicy` field.
--&gt;
&lt;ul&gt;
&lt;li&gt;Kubernetes：v1.31 或更高版本，启用 &lt;code&gt;SupplementalGroupsPolicy&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;。
截至 v1.31，此门控标记为 Alpha。&lt;/li&gt;
&lt;li&gt;CRI 运行时：
&lt;ul&gt;
&lt;li&gt;containerd：v2.0 或更高版本&lt;/li&gt;
&lt;li&gt;CRI-O：v1.31 或更高版本&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;你可以在 Node 的 &lt;code&gt;.status.features.supplementalGroupsPolicy&lt;/code&gt; 字段中查看此特性是否受支持。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Node&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;features&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;supplementalGroupsPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## What&#39;s next?

Kubernetes SIG Node hope - and expect - that the feature will be promoted to beta and eventually
general availability (GA) in future releases of Kubernetes, so that users no longer need to enable
the feature gate manually.

`Merge` policy is applied when `supplementalGroupsPolicy` is not specified, for backwards compatibility.
--&gt;
&lt;h2 id=&#34;接下来&#34;&gt;接下来&lt;/h2&gt;
&lt;p&gt;Kubernetes SIG Node 希望并期待此特性将在 Kubernetes 后续版本中进阶至 Beta，
并最终进阶至正式发布（GA），以便用户不再需要手动启用特性门控。&lt;/p&gt;
&lt;p&gt;当 &lt;code&gt;supplementalGroupsPolicy&lt;/code&gt; 未被指定时，将应用 &lt;code&gt;Merge&lt;/code&gt; 策略，以保持向后兼容性。&lt;/p&gt;
&lt;!--
## How can I learn more?
--&gt;
&lt;h2 id=&#34;我如何了解更多&#34;&gt;我如何了解更多？&lt;/h2&gt;
&lt;!-- https://github.com/kubernetes/website/pull/46920 --&gt;
&lt;!--
- [Configure a Security Context for a Pod or Container](/docs/tasks/configure-pod-container/security-context/)
for the further details of `supplementalGroupsPolicy`
- [KEP-3619: Fine-grained SupplementalGroups control](https://github.com/kubernetes/enhancements/issues/3619)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/security-context/&#34;&gt;为 Pod 或容器配置安全上下文&lt;/a&gt;以获取有关
&lt;code&gt;supplementalGroupsPolicy&lt;/code&gt; 的更多细节&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3619&#34;&gt;KEP-3619：细粒度 SupplementalGroups 控制&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How to get involved?

This feature is driven by the SIG Node community. Please join us to connect with
the community and share your ideas and feedback around the above feature and
beyond. We look forward to hearing from you!
--&gt;
&lt;h2 id=&#34;如何参与&#34;&gt;如何参与？&lt;/h2&gt;
&lt;p&gt;此特性由 SIG Node 社区推动。请加入我们，与社区保持联系，
分享你对上述特性及其他方面的想法和反馈。我们期待听到你的声音！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.31：全新的 Kubernetes CPUManager 静态策略：跨核分发 CPU</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/cpumanager-static-policy-distributed-cpu-across-cores/</link>
      <pubDate>Thu, 22 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/cpumanager-static-policy-distributed-cpu-across-cores/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.31: New Kubernetes CPUManager Static Policy: Distribute CPUs Across Cores&#39;
date: 2024-08-22
slug: cpumanager-static-policy-distributed-cpu-across-cores
author: &gt;
  [Jiaxin Shan](https://github.com/Jeffwan) (Bytedance)
--&gt;
&lt;!--
In Kubernetes v1.31, we are excited to introduce a significant enhancement to CPU management capabilities: the `distribute-cpus-across-cores` option for the [CPUManager static policy](/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options). This feature is currently in alpha and hidden by default, marking a strategic shift aimed at optimizing CPU utilization and improving system performance across multi-core processors.
--&gt;
&lt;p&gt;在 Kubernetes v1.31 中，我们很高兴引入了对 CPU 管理能力的重大增强：针对
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/#static-policy-options&#34;&gt;CPUManager 静态策略&lt;/a&gt;的
&lt;code&gt;distribute-cpus-across-cores&lt;/code&gt; 选项。此特性目前处于 Alpha 阶段，
默认被隐藏，标志着旨在优化 CPU 利用率和改善多核处理器系统性能的战略转变。&lt;/p&gt;
&lt;!--
## Understanding the feature

Traditionally, Kubernetes&#39; CPUManager tends to allocate CPUs as compactly as possible, typically packing them onto the fewest number of physical cores. However, allocation strategy matters, CPUs on the same physical host still share some resources of the physical core, such as the cache and execution units, etc.
--&gt;
&lt;h2 id=&#34;understanding-the-feature&#34;&gt;理解这一特性  &lt;/h2&gt;
&lt;p&gt;传统上，Kubernetes 的 CPUManager 倾向于尽可能紧凑地分配 CPU，通常将这些 CPU 打包到尽可能少的物理核上。
然而，分配策略很重要，因为同一物理主机上的 CPU 仍然共享一些物理核的资源，例如缓存和执行单元等。&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/cpumanager-static-policy-distributed-cpu-across-cores/cpu-cache-architecture.png&#34;
         alt=&#34;cpu-cache-architecture&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
While default approach minimizes inter-core communication and can be beneficial under certain scenarios, it also poses a challenge. CPUs sharing a physical core can lead to resource contention, which in turn may cause performance bottlenecks, particularly noticeable in CPU-intensive applications.
--&gt;
&lt;p&gt;虽然默认方法可以最小化核间通信，并在某些情况下是有益的，但也带来了挑战。
在同一物理核上共享的 CPU 可能导致资源竞争，从而可能造成性能瓶颈，这在 CPU 密集型应用中尤为明显。&lt;/p&gt;
&lt;!--
The new `distribute-cpus-across-cores` feature addresses this issue by modifying the allocation strategy. When enabled, this policy option instructs the CPUManager to spread out the CPUs (hardware threads) across as many physical cores as possible. This distribution is designed to minimize contention among CPUs sharing the same physical core, potentially enhancing the performance of applications by providing them dedicated core resources.

Technically, within this static policy, the free CPU list is reordered in the manner depicted in the diagram, aiming to allocate CPUs from separate physical cores.
--&gt;
&lt;p&gt;全新的 &lt;code&gt;distribute-cpus-across-cores&lt;/code&gt; 特性通过修改分配策略来解决这个问题。
当此特性被启用时，此策略选项指示 CPUManager 尽可能将 CPU（硬件线程）分发到尽可能多的物理核上。
这种分发旨在最小化共享同一物理核的 CPU 之间的争用，从而通过为应用提供专用的核资源来潜在提高性能。&lt;/p&gt;
&lt;p&gt;从技术上讲，在这个静态策略中，可用的 CPU 列表按照图示的方式重新排序，旨在从不同的物理核分配 CPU。&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/22/cpumanager-static-policy-distributed-cpu-across-cores/cpu-ordering.png&#34;
         alt=&#34;cpu-ordering&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
## Enabling the feature

To enable this feature, users firstly need to add `--cpu-manager-policy=static` kubelet flag or the `cpuManagerPolicy: static` field in KubeletConfiuration. Then user can add `--cpu-manager-policy-options distribute-cpus-across-cores=true` or `distribute-cpus-across-cores=true` to their CPUManager policy options in the Kubernetes configuration or. This setting directs the CPUManager to adopt the new distribution strategy. It is important to note that this policy option cannot currently be used in conjunction with `full-pcpus-only` or `distribute-cpus-across-numa` options.
--&gt;
&lt;h2 id=&#34;enabling-the-feature&#34;&gt;启用此特性  &lt;/h2&gt;
&lt;p&gt;要启用此特性，用户首先需要在 kubelet 配置中添加 &lt;code&gt;--cpu-manager-policy=static&lt;/code&gt; kubelet 标志或 &lt;code&gt;cpuManagerPolicy: static&lt;/code&gt; 字段。
然后用户可以在 Kubernetes 配置中添加 &lt;code&gt;--cpu-manager-policy-options distribute-cpus-across-cores=true&lt;/code&gt; 或
&lt;code&gt;distribute-cpus-across-cores=true&lt;/code&gt; 到自己的 CPUManager 策略选项中。此设置指示 CPUManager 采用新的分发策略。
需要注意的是，目前此策略选项无法与 &lt;code&gt;full-pcpus-only&lt;/code&gt; 或 &lt;code&gt;distribute-cpus-across-numa&lt;/code&gt; 选项一起使用。&lt;/p&gt;
&lt;!--
## Current limitations and future directions

As with any new feature, especially one in alpha, there are limitations and areas for future improvement. One significant current limitation is that `distribute-cpus-across-cores` cannot be combined with other policy options that might conflict in terms of CPU allocation strategies. This restriction can affect compatibility with certain workloads and deployment scenarios that rely on more specialized resource management.
--&gt;
&lt;h2 id=&#34;current-limitations-and-future-directions&#34;&gt;当前限制和未来方向  &lt;/h2&gt;
&lt;p&gt;与所有新特性一样，尤其是处于 Alpha 阶段的特性，此特性也存在一些限制，很多方面还有待后续改进。
当前一个显著的限制是 &lt;code&gt;distribute-cpus-across-cores&lt;/code&gt; 不能与可能在 CPU 分配策略上存在冲突的其他策略选项结合使用。
这一限制可能会影响与（依赖于更专业的资源管理的）某些工作负载和部署场景的兼容性。&lt;/p&gt;
&lt;!--
Looking forward, we are committed to enhancing the compatibility and functionality of the `distribute-cpus-across-cores` option. Future updates will focus on resolving these compatibility issues, allowing this policy to be combined with other CPUManager policies seamlessly. Our goal is to provide a more flexible and robust CPU allocation framework that can adapt to a variety of workloads and performance demands.
--&gt;
&lt;p&gt;展望未来，我们将致力于增强 &lt;code&gt;distribute-cpus-across-cores&lt;/code&gt; 选项的兼容性和特性。
未来的更新将专注于解决这些兼容性问题，使此策略能够与其他 CPUManager 策略无缝结合。
我们的目标是提供一个更灵活和强大的 CPU 分配框架，能够适应各种工作负载和性能需求。&lt;/p&gt;
&lt;!--
## Conclusion

The introduction of the `distribute-cpus-across-cores` policy in Kubernetes CPUManager is a step forward in our ongoing efforts to refine resource management and improve application performance. By reducing the contention on physical cores, this feature offers a more balanced approach to CPU resource allocation, particularly beneficial for environments running heterogeneous workloads. We encourage Kubernetes users to test this new feature and provide feedback, which will be invaluable in shaping its future development.

This draft aims to clearly explain the new feature while setting expectations for its current stage and future improvements.
--&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;结论  &lt;/h2&gt;
&lt;p&gt;在 Kubernetes CPUManager 中引入 &lt;code&gt;distribute-cpus-across-cores&lt;/code&gt; 策略是我们持续努力改进资源管理和提升应用性能而向前迈出的一步。
通过减少物理核上的争用，此特性提供了更加平衡的 CPU 资源分配方法，特别有利于运行异构工作负载的环境。
我们鼓励 Kubernetes 用户测试这一新特性并提供反馈，这将对其未来发展至关重要。&lt;/p&gt;
&lt;p&gt;本文旨在清晰地解释这一新特性，同时设定对其当前阶段和未来改进的期望。&lt;/p&gt;
&lt;!--
## Further reading

Please check out the [Control CPU Management Policies on the Node](/docs/tasks/administer-cluster/cpu-management-policies/)
task page to learn more about the CPU Manager, and how it fits in relation to the other node-level resource managers.
--&gt;
&lt;h2 id=&#34;further-reading&#34;&gt;进一步阅读  &lt;/h2&gt;
&lt;p&gt;请查阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/&#34;&gt;节点上的 CPU 管理策略&lt;/a&gt;任务页面，
以了解有关 CPU 管理器的更多信息，以及 CPU 管理器与其他节点级资源管理器的关系。&lt;/p&gt;
&lt;!--
## Getting involved

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.
--&gt;
&lt;h2 id=&#34;getting-involved&#34;&gt;参与其中  &lt;/h2&gt;
&lt;p&gt;此特性由 &lt;a href=&#34;https://github.com/Kubernetes/community/blob/master/sig-node/README.md&#34;&gt;SIG Node&lt;/a&gt; 推动。
如果你有兴趣帮助开发此特性、分享反馈或参与其他目前 SIG Node 项目的工作，请参加 SIG Node 会议了解更多细节。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31: 节点 Cgroup 驱动程序的自动配置 (beta)</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/21/cri-cgroup-driver-lookup-now-beta/</link>
      <pubDate>Wed, 21 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/21/cri-cgroup-driver-lookup-now-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: Autoconfiguration For Node Cgroup Driver (beta)&#34;
date: 2024-08-21
slug: cri-cgroup-driver-lookup-now-beta
author: &gt;
Peter Hunt (Red Hat)
--&gt;
&lt;!--
Historically, configuring the correct cgroup driver has been a pain point for users running new
Kubernetes clusters. On Linux systems, there are two different cgroup drivers:
`cgroupfs` and `systemd`. In the past, both the [kubelet](/docs/reference/command-line-tools-reference/kubelet/)
and CRI implementation (like CRI-O or containerd) needed to be configured to use
the same cgroup driver, or else the kubelet would exit with an error. This was a
source of headaches for many cluster admins. However, there is light at the end of the tunnel!
--&gt;
&lt;p&gt;一直以来，为新运行的 Kubernetes 集群配置正确的 cgroup 驱动程序是用户的一个痛点。
在 Linux 系统中，存在两种不同的 cgroup 驱动程序：&lt;code&gt;cgroupfs&lt;/code&gt; 和 &lt;code&gt;systemd&lt;/code&gt;。
过去，&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/kubelet/&#34;&gt;kubelet&lt;/a&gt; 和 CRI
实现（如 CRI-O 或 containerd）需要配置为使用相同的 cgroup 驱动程序， 否则 kubelet 会报错并退出。
这让许多集群管理员头疼不已。不过，现在曙光乍现！&lt;/p&gt;
&lt;!--
## Automated cgroup driver detection

In v1.28.0, the SIG Node community introduced the feature gate
`KubeletCgroupDriverFromCRI`, which instructs the kubelet to ask the CRI
implementation which cgroup driver to use. A few minor releases of Kubernetes
happened whilst we waited for support to land in the major two CRI implementations
(containerd and CRI-O), but as of v1.31.0, this feature is now beta!
--&gt;
&lt;h2 id=&#34;自动检测-cgroup-驱动程序&#34;&gt;自动检测 cgroup 驱动程序&lt;/h2&gt;
&lt;p&gt;在 v1.28.0 版本中，SIG Node 社区引入了 &lt;code&gt;KubeletCgroupDriverFromCRI&lt;/code&gt; 特性门控，
它指示 kubelet 向 CRI 实现询问使用哪个 cgroup 驱动程序。在两个主要的 CRI 实现（containerd
和 CRI-O）增加对该功能的支持这段期间，Kubernetes 经历了几次小版本发布，但从 v1.31.0 版本开始，此功能现已进入 beta 阶段！&lt;/p&gt;
&lt;!--
In addition to setting the feature gate, a cluster admin needs to ensure their
CRI implementation is new enough:

- containerd: Support was added in v2.0.0
- CRI-O: Support was added in v1.28.0
--&gt;
&lt;p&gt;除了设置特性门控之外，集群管理员还需要确保 CRI 实现版本足够新：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;containerd：v2.0.0 版本开始支持&lt;/li&gt;
&lt;li&gt;CRI-O：v1.28.0 版本开始支持&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Then, they should ensure their CRI implementation is configured to the
cgroup_driver they would like to use.
--&gt;
&lt;p&gt;然后，他们应该确保配置其 CRI 实现使用他们想要的 cgroup 驱动程序。&lt;/p&gt;
&lt;!--
## Future work

Eventually, support for the kubelet&#39;s `cgroupDriver` configuration field will be
dropped, and the kubelet will fail to start if the CRI implementation isn&#39;t new
enough to have support for this feature.
--&gt;
&lt;h2 id=&#34;未来工作&#34;&gt;未来工作&lt;/h2&gt;
&lt;p&gt;最终，kubelet 对 &lt;code&gt;cgroupDriver&lt;/code&gt; 配置字段的支持将会被移除，如果 CRI 实现的版本不够新，无法支持此功能，kubelet 将无法启动。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：流式传输从 SPDY 转换为 WebSocket</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/20/websockets-transition/</link>
      <pubDate>Tue, 20 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/20/websockets-transition/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.31: Streaming Transitions from SPDY to WebSockets&#39;
date: 2024-08-20
slug: websockets-transition
author: &gt;
  [Sean Sullivan](https://github.com/seans3) (Google)
  [Shannon Kularathna](https://github.com/shannonxtreme) (Google)
--&gt;
&lt;!--
In Kubernetes 1.31, by default kubectl now uses the WebSocket protocol
instead of SPDY for streaming.

This post describes what these changes mean for you and why these streaming APIs
matter.
--&gt;
&lt;p&gt;在 Kubernetes 1.31 中，kubectl 现在默认使用 WebSocket 协议而不是 SPDY 进行流式传输。&lt;/p&gt;
&lt;p&gt;这篇文章介绍了这些变化对你意味着什么以及这些流式传输 API 的重要性。&lt;/p&gt;
&lt;!--
## Streaming APIs in Kubernetes

In Kubernetes, specific endpoints that are exposed as an HTTP or RESTful
interface are upgraded to streaming connections, which require a streaming
protocol. Unlike HTTP, which is a request-response protocol, a streaming
protocol provides a persistent connection that&#39;s bi-directional, low-latency,
and lets you interact in real-time. Streaming protocols support reading and
writing data between your client and the server, in both directions, over the
same connection. This type of connection is useful, for example, when you create
a shell in a running container from your local workstation and run commands in
the container.
--&gt;
&lt;h2 id=&#34;kubernetes-中的流式-api&#34;&gt;Kubernetes 中的流式 API&lt;/h2&gt;
&lt;p&gt;在 Kubernetes 中，某些以 HTTP 或 RESTful 接口公开的某些端点会被升级为流式连接，因而需要使用流式协议。
与 HTTP 这种请求-响应协议不同，流式协议提供了一种持久的双向连接，具有低延迟的特点，并允许实时交互。
流式协议支持在客户端与服务器之间通过同一个连接进行双向的数据读写。
这种类型的连接非常有用，例如，当你从本地工作站在某个运行中的容器内创建 shell 并在该容器中运行命令时。&lt;/p&gt;
&lt;!--
## Why change the streaming protocol?

Before the v1.31 release, Kubernetes used the SPDY/3.1 protocol by default when
upgrading streaming connections. SPDY/3.1 has been deprecated for eight years,
and it was never standardized. Many modern proxies, gateways, and load balancers
no longer support the protocol. As a result, you might notice that commands like
`kubectl cp`, `kubectl attach`, `kubectl exec`, and `kubectl port-forward`
stop working when you try to access your cluster through a proxy or gateway.
--&gt;
&lt;h2 id=&#34;为什么要改变流式传输协议&#34;&gt;为什么要改变流式传输协议？&lt;/h2&gt;
&lt;p&gt;在 v1.31 版本发布之前，Kubernetes 默认使用 SPDY/3.1 协议来升级流式连接。
但是 SPDY/3.1 已经被废弃了八年之久，并且从未被标准化，许多现代代理、网关和负载均衡器已经不再支持该协议。
因此，当你尝试通过代理或网关访问集群时，可能会发现像 &lt;code&gt;kubectl cp&lt;/code&gt;、&lt;code&gt;kubectl attach&lt;/code&gt;、&lt;code&gt;kubectl exec&lt;/code&gt;
和 &lt;code&gt;kubectl port-forward&lt;/code&gt; 这样的命令无法正常工作。&lt;/p&gt;
&lt;!--
As of Kubernetes v1.31, SIG API Machinery has modified the streaming
protocol that a Kubernetes client (such as `kubectl`) uses for these commands
to the more modern [WebSocket streaming protocol](https://datatracker.ietf.org/doc/html/rfc6455).
The WebSocket protocol is a currently supported standardized streaming protocol
that guarantees compatibility and interoperability with different components and
programming languages. The WebSocket protocol is more widely supported by modern
proxies and gateways than SPDY.
--&gt;
&lt;p&gt;从 Kubernetes v1.31 版本开始，SIG API Machinery 修改了 Kubernetes
客户端（如 &lt;code&gt;kubectl&lt;/code&gt;）中用于这些命令的流式传输协议，将其改为更现代化的
&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc6455&#34;&gt;WebSocket 流式传输协议&lt;/a&gt;。
WebSocket 协议是一种当前得到支持的标准流式传输协议，
它可以确保与不同组件及编程语言之间的兼容性和互操作性。
相较于 SPDY，WebSocket 协议更为广泛地被现代代理和网关所支持。&lt;/p&gt;
&lt;!--
## How streaming APIs work

Kubernetes upgrades HTTP connections to streaming connections by adding
specific upgrade headers to the originating HTTP request. For example, an HTTP
upgrade request for running the `date` command on an `nginx` container within
a cluster is similar to the following:
--&gt;
&lt;h2 id=&#34;流式-api-的工作原理&#34;&gt;流式 API 的工作原理&lt;/h2&gt;
&lt;p&gt;Kubernetes 通过在原始的 HTTP 请求中添加特定的升级头字段来将 HTTP 连接升级为流式连接。
例如，在集群内的 &lt;code&gt;nginx&lt;/code&gt; 容器上运行 &lt;code&gt;date&lt;/code&gt; 命令的 HTTP 升级请求类似于以下内容：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;$&lt;/span&gt; kubectl &lt;span style=&#34;color:#a2f&#34;&gt;exec&lt;/span&gt; -v&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt; nginx -- date
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;GET https://127.0.0.1:43251/api/v1/namespaces/default/pods/nginx/exec?command=date…
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Request Headers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Connection: Upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Upgrade: websocket
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Sec-Websocket-Protocol: v5.channel.k8s.io
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    User-Agent: kubectl/v1.31.0 (linux/amd64) kubernetes/6911225
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
If the container runtime supports the WebSocket streaming protocol and at least
one of the subprotocol versions (e.g. `v5.channel.k8s.io`), the server responds
with a successful `101 Switching Protocols` status, along with the negotiated
subprotocol version:
--&gt;
&lt;p&gt;如果容器运行时支持 WebSocket 流式协议及其至少一个子协议版本（例如 &lt;code&gt;v5.channel.k8s.io&lt;/code&gt;），
服务器会以代表成功的 &lt;code&gt;101 Switching Protocols&lt;/code&gt; 状态码进行响应，并附带协商后的子协议版本：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Response Status: 101 Switching Protocols in 3 milliseconds
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Response Headers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Upgrade: websocket
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Connection: Upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Sec-Websocket-Accept: j0/jHW9RpaUoGsUAv97EcKw8jFM=
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;    Sec-Websocket-Protocol: v5.channel.k8s.io
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
At this point the TCP connection used for the HTTP protocol has changed to a
streaming connection. Subsequent STDIN, STDOUT, and STDERR data (as well as
terminal resizing data and process exit code data) for this shell interaction is
then streamed over this upgraded connection.
--&gt;
&lt;p&gt;此时，原本用于 HTTP 协议的 TCP 连接已转换为流式连接。
随后，此 Shell 交互中的标准输入（STDIN）、标准输出（STDOUT）和标准错误输出（STDERR）数据
（以及终端重置大小数据和进程退出码数据）会通过这个升级后的连接进行流式传输。&lt;/p&gt;
&lt;!--
## How to use the new WebSocket streaming protocol

If your cluster and kubectl are on version 1.29 or later, there are two
control plane feature gates and two kubectl environment variables that
govern the use of the WebSockets rather than SPDY. In Kubernetes 1.31,
all of the following feature gates are in beta and are enabled by
default:
--&gt;
&lt;h2 id=&#34;如何使用新的-websocket-流式协议&#34;&gt;如何使用新的 WebSocket 流式协议&lt;/h2&gt;
&lt;p&gt;如果你的集群和 kubectl 版本为 1.29 及以上版本，有两个控制面特性门控以及两个
kubectl 环境变量用来控制启用 WebSocket 而不是 SPDY 作为流式协议。
在 Kubernetes 1.31 中，以下所有特性门控均处于 Beta 阶段，并且默认被启用：&lt;/p&gt;
&lt;!--
- [Feature gates](/docs/reference/command-line-tools-reference/feature-gates/)
  - `TranslateStreamCloseWebsocketRequests`
      - `.../exec`
      - `.../attach`
  - `PortForwardWebsockets`
      - `.../port-forward`
- kubectl feature control environment variables
  - `KUBECTL_REMOTE_COMMAND_WEBSOCKETS`
      - `kubectl exec`
      - `kubectl cp`
      - `kubectl attach`
  - `KUBECTL_PORT_FORWARD_WEBSOCKETS`
      - `kubectl port-forward`
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TranslateStreamCloseWebsocketRequests&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.../exec&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.../attach&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PortForwardWebsockets&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.../port-forward&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;kubectl 特性控制环境变量
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;KUBECTL_REMOTE_COMMAND_WEBSOCKETS&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kubectl exec&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubectl cp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubectl attach&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;KUBECTL_PORT_FORWARD_WEBSOCKETS&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kubectl port-forward&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
If you&#39;re connecting to an older cluster but can manage the feature gate
settings, turn on both `TranslateStreamCloseWebsocketRequests` (added in
Kubernetes v1.29) and `PortForwardWebsockets` (added in Kubernetes
v1.30) to try this new behavior. Version 1.31 of `kubectl` can automatically use
the new behavior, but you do need to connect to a cluster where the server-side
features are explicitly enabled.
--&gt;
&lt;p&gt;如果你正在使用一个较旧的集群但可以管理其特性门控设置，
那么可以通过开启 &lt;code&gt;TranslateStreamCloseWebsocketRequests&lt;/code&gt;（在 Kubernetes v1.29 中添加）
和 &lt;code&gt;PortForwardWebsockets&lt;/code&gt;（在 Kubernetes v1.30 中添加）来尝试启用 Websocket 作为流式传输协议。
版本为 1.31 的 kubectl 可以自动使用新的行为，但你需要连接到明确启用了服务器端特性的集群。&lt;/p&gt;
&lt;!--
## Learn more about streaming APIs

- [KEP 4006 - Transitioning from SPDY to WebSockets](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4006-transition-spdy-to-websockets)
- [RFC 6455 - The WebSockets Protocol](https://datatracker.ietf.org/doc/html/rfc6455)
- [Container Runtime Interface streaming explained](https://kubernetes.io/blog/2024/05/01/cri-streaming-explained/)
--&gt;
&lt;h2 id=&#34;了解有关流式-api-的更多信息&#34;&gt;了解有关流式 API 的更多信息&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4006-transition-spdy-to-websockets&#34;&gt;KEP 4006 - Transitioning from SPDY to WebSockets（英文）&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc6455&#34;&gt;RFC 6455 - The WebSockets Protocol（英文）&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kubernetes.io/blog/2024/05/01/cri-streaming-explained/&#34;&gt;Container Runtime Interface streaming explained（英文）&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：针对 Job 的 Pod 失效策略进阶至 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/19/kubernetes-1-31-pod-failure-policy-for-jobs-goes-ga/</link>
      <pubDate>Mon, 19 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/19/kubernetes-1-31-pod-failure-policy-for-jobs-goes-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: Pod Failure Policy for Jobs Goes GA&#34;
date: 2024-08-19
slug: kubernetes-1-31-pod-failure-policy-for-jobs-goes-ga
author: &gt;
  [Michał Woźniak](https://github.com/mimowo) (Google),
  [Shannon Kularathna](https://github.com/shannonxtreme) (Google)
--&gt;
&lt;!--
This post describes _Pod failure policy_, which graduates to stable in Kubernetes
1.31, and how to use it in your Jobs.
--&gt;
&lt;p&gt;这篇博文阐述在 Kubernetes 1.31 中进阶至 Stable 的 &lt;strong&gt;Pod 失效策略&lt;/strong&gt;，还介绍如何在你的 Job 中使用此策略。&lt;/p&gt;
&lt;!--
## About Pod failure policy

When you run workloads on Kubernetes, Pods might fail for a variety of reasons.
Ideally, workloads like Jobs should be able to ignore transient, retriable
failures and continue running to completion.
--&gt;
&lt;h2 id=&#34;关于-pod-失效策略&#34;&gt;关于 Pod 失效策略&lt;/h2&gt;
&lt;p&gt;当你在 Kubernetes 上运行工作负载时，Pod 可能因各种原因而失效。
理想情况下，像 Job 这样的工作负载应该能够忽略瞬时的、可重试的失效，并继续运行直到完成。&lt;/p&gt;
&lt;!--
To allow for these transient failures, Kubernetes Jobs include the `backoffLimit`
field, which lets you specify a number of Pod failures that you&#39;re willing to tolerate
during Job execution. However, if you set a large value for the `backoffLimit` field
and rely solely on this field, you might notice unnecessary increases in operating
costs as Pods restart excessively until the backoffLimit is met.
--&gt;
&lt;p&gt;要允许这些瞬时的失效，Kubernetes Job 需包含 &lt;code&gt;backoffLimit&lt;/code&gt; 字段，
此字段允许你指定在 Job 执行期间你愿意容忍的 Pod 失效次数。然而，
如果你为 &lt;code&gt;backoffLimit&lt;/code&gt; 字段设置了一个较大的值，并完全依赖这个字段，
你可能会发现，由于在满足 backoffLimit 条件之前 Pod 重启次数太多，导致运营成本发生不必要的增加。&lt;/p&gt;
&lt;!--
This becomes particularly problematic when running large-scale Jobs with
thousands of long-running Pods across thousands of nodes.

The Pod failure policy extends the backoff limit mechanism to help you reduce
costs in the following ways:

- Gives you control to fail the Job as soon as a non-retriable Pod failure occurs.
- Allows you to ignore retriable errors without increasing the `backoffLimit` field.
--&gt;
&lt;p&gt;在运行大规模的、包含跨数千节点且长时间运行的 Pod 的 Job 时，这个问题尤其严重。&lt;/p&gt;
&lt;p&gt;Pod 失效策略扩展了回退限制机制，帮助你通过以下方式降低成本：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;让你在出现不可重试的 Pod 失效时控制 Job 失败。&lt;/li&gt;
&lt;li&gt;允许你忽略可重试的错误，而不增加 &lt;code&gt;backoffLimit&lt;/code&gt; 字段。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For example, you can use a Pod failure policy to run your workload on more affordable spot machines
by ignoring Pod failures caused by
[graceful node shutdown](/docs/concepts/cluster-administration/node-shutdown/#graceful-node-shutdown).

The policy allows you to distinguish between retriable and non-retriable Pod
failures based on container exit codes or Pod conditions in a failed Pod.
--&gt;
&lt;p&gt;例如，通过忽略由&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/node-shutdown/#graceful-node-shutdown&#34;&gt;节点体面关闭&lt;/a&gt;引起的
Pod 失效，你可以使用 Pod 失效策略在更实惠的临时机器上运行你的工作负载。&lt;/p&gt;
&lt;p&gt;此策略允许你基于失效 Pod 中的容器退出码或 Pod 状况来区分可重试和不可重试的 Pod 失效。&lt;/p&gt;
&lt;!--
## How it works

You specify a Pod failure policy in the Job specification, represented as a list
of rules.

For each rule you define _match requirements_ based on one of the following properties:

- Container exit codes: the `onExitCodes` property.
- Pod conditions: the `onPodConditions` property.
--&gt;
&lt;h2 id=&#34;它是如何工作的&#34;&gt;它是如何工作的&lt;/h2&gt;
&lt;p&gt;你在 Job 规约中指定的 Pod 失效策略是一个规则的列表。&lt;/p&gt;
&lt;p&gt;对于每个规则，你基于以下属性之一来定义&lt;strong&gt;匹配条件&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;容器退出码：&lt;code&gt;onExitCodes&lt;/code&gt; 属性。&lt;/li&gt;
&lt;li&gt;Pod 状况：&lt;code&gt;onPodConditions&lt;/code&gt; 属性。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Additionally, for each rule, you specify one of the following actions to take
when a Pod matches the rule:
- `Ignore`: Do not count the failure towards the `backoffLimit` or `backoffLimitPerIndex`.
- `FailJob`: Fail the entire Job and terminate all running Pods.
- `FailIndex`: Fail the index corresponding to the failed Pod.
  This action works with the [Backoff limit per index](/docs/concepts/workloads/controllers/job/#backoff-limit-per-index) feature.
- `Count`: Count the failure towards the `backoffLimit` or `backoffLimitPerIndex`.
  This is the default behavior.
--&gt;
&lt;p&gt;此外，对于每个规则，你要指定在 Pod 与此规则匹配时应采取的动作，可选动作为以下之一：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Ignore&lt;/code&gt;：不将失效计入 &lt;code&gt;backoffLimit&lt;/code&gt; 或 &lt;code&gt;backoffLimitPerIndex&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;FailJob&lt;/code&gt;：让整个 Job 失败并终止所有运行的 Pod。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;FailIndex&lt;/code&gt;：与失效 Pod 对应的索引失效。&lt;br&gt;
此动作与&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#backoff-limit-per-index&#34;&gt;逐索引回退限制&lt;/a&gt;特性一起使用。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Count&lt;/code&gt;：将失效计入 &lt;code&gt;backoffLimit&lt;/code&gt; 或 &lt;code&gt;backoffLimitPerIndex&lt;/code&gt;。这是默认行为。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
When Pod failures occur in a running Job, Kubernetes matches the
failed Pod status against the list of Pod failure policy rules, in the specified
order, and takes the corresponding actions for the first matched rule.

Note that when specifying the Pod failure policy, you must also set the Job&#39;s
Pod template with `restartPolicy: Never`. This prevents race conditions between
the kubelet and the Job controller when counting Pod failures.
--&gt;
&lt;p&gt;当在运行的 Job 中发生 Pod 失效时，Kubernetes 按所给的顺序将失效 Pod 的状态与
Pod 失效策略规则的列表进行匹配，并根据匹配的第一个规则采取相应的动作。&lt;/p&gt;
&lt;p&gt;请注意，在指定 Pod 失效策略时，你还必须在 Job 的 Pod 模板中设置 &lt;code&gt;restartPolicy: Never&lt;/code&gt;。
此字段可以防止在对 Pod 失效计数时在 kubelet 和 Job 控制器之间出现竞争条件。&lt;/p&gt;
&lt;!--
### Kubernetes-initiated Pod disruptions

To allow matching Pod failure policy rules against failures caused by
disruptions initiated by Kubernetes, this feature introduces the `DisruptionTarget`
Pod condition.

Kubernetes adds this condition to any Pod, regardless of whether it&#39;s managed by
a Job controller, that fails because of a retriable
[disruption scenario](/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions).
The `DisruptionTarget` condition contains one of the following reasons that
corresponds to these disruption scenarios:
--&gt;
&lt;h3 id=&#34;kubernetes-发起的-pod-干扰&#34;&gt;Kubernetes 发起的 Pod 干扰&lt;/h3&gt;
&lt;p&gt;为了允许将 Pod 失效策略规则与由 Kubernetes 引发的干扰所导致的失效进行匹配，
此特性引入了 &lt;code&gt;DisruptionTarget&lt;/code&gt; Pod 状况。&lt;/p&gt;
&lt;p&gt;Kubernetes 会将此状况添加到因可重试的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions&#34;&gt;干扰场景&lt;/a&gt;而失效的所有
Pod，无论其是否由 Job 控制器管理。其中 &lt;code&gt;DisruptionTarget&lt;/code&gt; 状况包含与这些干扰场景对应的以下原因之一：&lt;/p&gt;
&lt;!--
- `PreemptionByKubeScheduler`: [Preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption)
   by `kube-scheduler` to accommodate a new Pod that has a higher priority.
- `DeletionByTaintManager` - the Pod is due to be deleted by
   `kube-controller-manager` due to a `NoExecute` [taint](/docs/concepts/scheduling-eviction/taint-and-toleration/)
   that the Pod doesn&#39;t tolerate.
- `EvictionByEvictionAPI` - the Pod is due to be deleted by an
   [API-initiated eviction](/docs/concepts/scheduling-eviction/api-eviction/).
- `DeletionByPodGC` - the Pod is bound to a node that no longer exists, and is due to
   be deleted by [Pod garbage collection](/docs/concepts/workloads/pods/pod-lifecycle/#pod-garbage-collection).
- `TerminationByKubelet` - the Pod was terminated by
  [graceful node shutdown](/docs/concepts/cluster-administration/node-shutdown/#graceful-node-shutdown),
  [node pressure eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/)
  or preemption for [system critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/).
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PreemptionByKubeScheduler&lt;/code&gt;：由 &lt;code&gt;kube-scheduler&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption&#34;&gt;抢占&lt;/a&gt;以接纳更高优先级的新 Pod。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DeletionByTaintManager&lt;/code&gt; - Pod 因其不容忍的 &lt;code&gt;NoExecute&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/&#34;&gt;污点&lt;/a&gt;而被 &lt;code&gt;kube-controller-manager&lt;/code&gt; 删除。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EvictionByEvictionAPI&lt;/code&gt; - Pod 因为 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/api-eviction/&#34;&gt;API 发起的驱逐&lt;/a&gt;而被删除。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DeletionByPodGC&lt;/code&gt; - Pod 被绑定到一个不再存在的节点，并将通过
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-garbage-collection&#34;&gt;Pod 垃圾收集&lt;/a&gt;而被删除。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TerminationByKubelet&lt;/code&gt; - Pod 因&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/node-shutdown/#graceful-node-shutdown&#34;&gt;节点体面关闭&lt;/a&gt;、
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction/&#34;&gt;节点压力驱逐&lt;/a&gt;或被&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/&#34;&gt;系统关键 Pod&lt;/a&gt;抢占&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
In all other disruption scenarios, like eviction due to exceeding
[Pod container limits](/docs/concepts/configuration/manage-resources-containers/),
Pods don&#39;t receive the `DisruptionTarget` condition because the disruptions were
likely caused by the Pod and would reoccur on retry.

### Example

The Pod failure policy snippet below demonstrates an example use:
--&gt;
&lt;p&gt;在所有其他干扰场景中，例如因超过
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/configuration/manage-resources-containers/&#34;&gt;Pod 容器限制&lt;/a&gt;而驱逐，
Pod 不会收到 &lt;code&gt;DisruptionTarget&lt;/code&gt; 状况，因为干扰可能是由 Pod 引起的，并且在重试时会再次发生干扰。&lt;/p&gt;
&lt;h3 id=&#34;示例&#34;&gt;示例&lt;/h3&gt;
&lt;p&gt;下面的 Pod 失效策略片段演示了一种用法：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podFailurePolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;action&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Ignore&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;onPodConditions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;DisruptionTarget&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;action&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;FailJob&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;onPodConditions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ConfigIssue&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;action&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;FailJob&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;onExitCodes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;42&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;]&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
In this example, the Pod failure policy does the following:

- Ignores any failed Pods that have the built-in `DisruptionTarget`
  condition. These Pods don&#39;t count towards Job backoff limits.
- Fails the Job if any failed Pods have the custom user-supplied
  `ConfigIssue` condition, which was added either by a custom controller or webhook.
- Fails the Job if any containers exited with the exit code 42.
- Counts all other Pod failures towards the default `backoffLimit` (or
  `backoffLimitPerIndex` if used).
--&gt;
&lt;p&gt;在这个例子中，Pod 失效策略执行以下操作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;忽略任何具有内置 &lt;code&gt;DisruptionTarget&lt;/code&gt; 状况的失效 Pod。这些 Pod 不计入 Job 回退限制。&lt;/li&gt;
&lt;li&gt;如果任何失效的 Pod 具有用户自定义的、由自定义控制器或 Webhook 添加的 &lt;code&gt;ConfigIssue&lt;/code&gt;
状况，则让 Job 失败。&lt;/li&gt;
&lt;li&gt;如果任何容器以退出码 42 退出，则让 Job 失败。&lt;/li&gt;
&lt;li&gt;将所有其他 Pod 失效计入默认的 &lt;code&gt;backoffLimit&lt;/code&gt;（在合适的情况下，计入 &lt;code&gt;backoffLimitPerIndex&lt;/code&gt;）。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Learn more

- For a hands-on guide to using Pod failure policy, see
  [Handling retriable and non-retriable pod failures with Pod failure policy](/docs/tasks/job/pod-failure-policy/)
- Read the documentation for
  [Pod failure policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy) and
  [Backoff limit per index](/docs/concepts/workloads/controllers/job/#backoff-limit-per-index)
- Read the documentation for
  [Pod disruption conditions](/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions)
- Read the KEP for [Pod failure policy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3329-retriable-and-non-retriable-failures)
--&gt;
&lt;h2 id=&#34;进一步了解&#34;&gt;进一步了解&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;有关使用 Pod 失效策略的实践指南，
参见&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/job/pod-failure-policy/&#34;&gt;使用 Pod 失效策略处理可重试和不可重试的 Pod 失效&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读文档：&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失效策略&lt;/a&gt;和&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#backoff-limit-per-index&#34;&gt;逐索引回退限制&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读文档：&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions&#34;&gt;Pod 干扰状况&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读 KEP：&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3329-retriable-and-non-retriable-failures&#34;&gt;Pod 失效策略&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Related work

Based on the concepts introduced by Pod failure policy, the following additional work is in progress:
- JobSet integration: [Configurable Failure Policy API](https://github.com/kubernetes-sigs/jobset/issues/262)
- [Pod failure policy extension to add more granular failure reasons](https://github.com/kubernetes/enhancements/issues/4443)
- Support for Pod failure policy via JobSet in [Kubeflow Training v2](https://github.com/kubeflow/training-operator/pull/2171)
- Proposal: [Disrupted Pods should be removed from endpoints](https://docs.google.com/document/d/1t25jgO_-LRHhjRXf4KJ5xY_t8BZYdapv7MDAxVGY6R8)
--&gt;
&lt;h2 id=&#34;相关工作&#34;&gt;相关工作&lt;/h2&gt;
&lt;p&gt;基于 Pod 失效策略所引入的概念，正在进行中的进一步工作如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;JobSet 集成：&lt;a href=&#34;https://github.com/kubernetes-sigs/jobset/issues/262&#34;&gt;可配置的失效策略 API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4443&#34;&gt;扩展 Pod 失效策略以添加更细粒度的失效原因&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;通过 JobSet 在 &lt;a href=&#34;https://github.com/kubeflow/training-operator/pull/2171&#34;&gt;Kubeflow Training v2&lt;/a&gt;
中支持 Pod 失效策略&lt;/li&gt;
&lt;li&gt;提案：&lt;a href=&#34;https://docs.google.com/document/d/1t25jgO_-LRHhjRXf4KJ5xY_t8BZYdapv7MDAxVGY6R8&#34;&gt;受干扰的 Pod 应从端点中移除&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved

This work was sponsored by
[batch working group](https://github.com/kubernetes/community/tree/master/wg-batch)
in close collaboration with the
[SIG Apps](https://github.com/kubernetes/community/tree/master/sig-apps),
and [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node),
and [SIG Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling)
communities.
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;这项工作由 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-batch&#34;&gt;Batch Working Group（批处理工作组）&lt;/a&gt; 发起，
与 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-apps&#34;&gt;SIG Apps&lt;/a&gt;、
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;SIG Node&lt;/a&gt;
和 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-scheduling&#34;&gt;SIG Scheduling&lt;/a&gt;
社区密切合作。&lt;/p&gt;
&lt;!--
If you are interested in working on new features in the space we recommend
subscribing to our [Slack](https://kubernetes.slack.com/messages/wg-batch)
channel and attending the regular community meetings.

## Acknowledgments

I would love to thank everyone who was involved in this project over the years -
it&#39;s been a journey and a joint community effort! The list below is
my best-effort attempt to remember and recognize people who made an impact.
Thank you!
--&gt;
&lt;p&gt;如果你有兴趣处理这个领域中的新特性，建议你订阅我们的
&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-batch&#34;&gt;Slack&lt;/a&gt; 频道，并参加定期的社区会议。&lt;/p&gt;
&lt;h2 id=&#34;感谢&#34;&gt;感谢&lt;/h2&gt;
&lt;p&gt;我想感谢在这些年里参与过这个项目的每个人。
这是一段旅程，也是一个社区共同努力的见证！
以下名单是我尽力记住并对此特性产生过影响的人。感谢大家！&lt;/p&gt;
&lt;!--
- [Aldo Culquicondor](https://github.com/alculquicondor/) for guidance and reviews throughout the process
- [Jordan Liggitt](https://github.com/liggitt) for KEP and API reviews
- [David Eads](https://github.com/deads2k) for API reviews
- [Maciej Szulik](https://github.com/soltysh) for KEP reviews from SIG Apps PoV
- [Clayton Coleman](https://github.com/smarterclayton) for guidance and SIG Node reviews
- [Sergey Kanzhelev](https://github.com/SergeyKanzhelev) for KEP reviews from SIG Node PoV
- [Dawn Chen](https://github.com/dchen1107) for KEP reviews from SIG Node PoV
- [Daniel Smith](https://github.com/lavalamp) for reviews from SIG API machinery PoV
- [Antoine Pelisse](https://github.com/apelisse) for reviews from SIG API machinery PoV
- [John Belamaric](https://github.com/johnbelamaric) for PRR reviews
- [Filip Křepinský](https://github.com/atiratree) for thorough reviews from SIG Apps PoV and bug-fixing
- [David Porter](https://github.com/bobbypage) for thorough reviews from SIG Node PoV
- [Jensen Lo](https://github.com/jensentanlo) for early requirements discussions, testing and reporting issues
- [Daniel Vega-Myhre](https://github.com/danielvegamyhre) for advancing JobSet integration and reporting issues
- [Abdullah Gharaibeh](https://github.com/ahg-g) for early design discussions and guidance
- [Antonio Ojea](https://github.com/aojea) for test reviews
- [Yuki Iwai](https://github.com/tenzen-y) for reviews and aligning implementation of the closely related Job features
- [Kevin Hannon](https://github.com/kannon92) for reviews and aligning implementation of the closely related Job features
- [Tim Bannister](https://github.com/sftim) for docs reviews
- [Shannon Kularathna](https://github.com/shannonxtreme) for docs reviews
- [Paola Cortés](https://github.com/cortespao) for docs reviews
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/alculquicondor/&#34;&gt;Aldo Culquicondor&lt;/a&gt; 在整个过程中提供指导和审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/liggitt&#34;&gt;Jordan Liggitt&lt;/a&gt; 审查 KEP 和 API&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/deads2k&#34;&gt;David Eads&lt;/a&gt; 审查 API&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/soltysh&#34;&gt;Maciej Szulik&lt;/a&gt; 从 SIG Apps 角度审查 KEP&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/smarterclayton&#34;&gt;Clayton Coleman&lt;/a&gt; 提供指导和 SIG Node 审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SergeyKanzhelev&#34;&gt;Sergey Kanzhelev&lt;/a&gt; 从 SIG Node 角度审查 KEP&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/dchen1107&#34;&gt;Dawn Chen&lt;/a&gt; 从 SIG Node 角度审查 KEP&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/lavalamp&#34;&gt;Daniel Smith&lt;/a&gt; 从 SIG API Machinery 角度进行审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/apelisse&#34;&gt;Antoine Pelisse&lt;/a&gt; 从 SIG API Machinery 角度进行审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/johnbelamaric&#34;&gt;John Belamaric&lt;/a&gt; 审查 PRR&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/atiratree&#34;&gt;Filip Křepinský&lt;/a&gt; 从 SIG Apps 角度进行全面审查并修复 Bug&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bobbypage&#34;&gt;David Porter&lt;/a&gt; 从 SIG Node 角度进行全面审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/jensentanlo&#34;&gt;Jensen Lo&lt;/a&gt; 进行早期需求讨论、测试和报告问题&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/danielvegamyhre&#34;&gt;Daniel Vega-Myhre&lt;/a&gt; 推进 JobSet 集成并报告问题&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ahg-g&#34;&gt;Abdullah Gharaibeh&lt;/a&gt; 进行早期设计讨论和指导&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/aojea&#34;&gt;Antonio Ojea&lt;/a&gt; 审查测试&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/tenzen-y&#34;&gt;Yuki Iwai&lt;/a&gt; 审查并协调相关 Job 特性的实现&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kannon92&#34;&gt;Kevin Hannon&lt;/a&gt; 审查并协调相关 Job 特性的实现&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/sftim&#34;&gt;Tim Bannister&lt;/a&gt; 审查文档&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/shannonxtreme&#34;&gt;Shannon Kularathna&lt;/a&gt; 审查文档&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/cortespao&#34;&gt;Paola Cortés&lt;/a&gt; 审查文档&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：podAffinity 中的 matchLabelKeys 进阶至 Beta</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/matchlabelkeys-podaffinity/</link>
      <pubDate>Fri, 16 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/matchlabelkeys-podaffinity/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.31: MatchLabelKeys in PodAffinity graduates to beta&#39;
date: 2024-08-16
slug: matchlabelkeys-podaffinity
author: &gt;
  Kensei Nakada (Tetrate)
--&gt;
&lt;!--
Kubernetes 1.29 introduced new fields `matchLabelKeys` and `mismatchLabelKeys` in `podAffinity` and `podAntiAffinity`.

In Kubernetes 1.31, this feature moves to beta and the corresponding feature gate (`MatchLabelKeysInPodAffinity`) gets enabled by default.
--&gt;
&lt;p&gt;Kubernetes 1.29 在 &lt;code&gt;podAffinity&lt;/code&gt; 和 &lt;code&gt;podAntiAffinity&lt;/code&gt; 中引入了新的字段 &lt;code&gt;matchLabelKeys&lt;/code&gt; 和 &lt;code&gt;mismatchLabelKeys&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;在 Kubernetes 1.31 中，此特性进阶至 Beta，并且相应的特性门控（&lt;code&gt;MatchLabelKeysInPodAffinity&lt;/code&gt;）默认启用。&lt;/p&gt;
&lt;!--
## `matchLabelKeys` - Enhanced scheduling for versatile rolling updates

During a workload&#39;s (e.g., Deployment) rolling update, a cluster may have Pods from multiple versions at the same time.
However, the scheduler cannot distinguish between old and new versions based on the `labelSelector` specified in `podAffinity` or `podAntiAffinity`. As a result, it will co-locate or disperse Pods regardless of their versions.
--&gt;
&lt;h2 id=&#34;matchlabelkeys-为多样化滚动更新增强了调度&#34;&gt;&lt;code&gt;matchLabelKeys&lt;/code&gt; - 为多样化滚动更新增强了调度&lt;/h2&gt;
&lt;p&gt;在工作负载（例如 Deployment）的滚动更新期间，集群中可能同时存在多个版本的 Pod。&lt;br&gt;
然而，调度器无法基于 &lt;code&gt;podAffinity&lt;/code&gt; 或 &lt;code&gt;podAntiAffinity&lt;/code&gt; 中指定的 &lt;code&gt;labelSelector&lt;/code&gt; 区分新旧版本。
结果，调度器将并置或分散调度 Pod，不会考虑这些 Pod 的版本。&lt;/p&gt;
&lt;!--
This can lead to sub-optimal scheduling outcome, for example:
- New version Pods are co-located with old version Pods (`podAffinity`), which will eventually be removed after rolling updates.
- Old version Pods are distributed across all available topologies, preventing new version Pods from finding nodes due to `podAntiAffinity`.
--&gt;
&lt;p&gt;这可能导致次优的调度结果，例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;新版本的 Pod 与旧版本的 Pod（&lt;code&gt;podAffinity&lt;/code&gt;）并置在一起，这些旧版本的 Pod 最终将在滚动更新后被移除。&lt;/li&gt;
&lt;li&gt;旧版本的 Pod 被分布在所有可用的拓扑中，导致新版本的 Pod 由于 &lt;code&gt;podAntiAffinity&lt;/code&gt; 无法找到节点。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
`matchLabelKeys` is a set of Pod label keys and addresses this problem.
The scheduler looks up the values of these keys from the new Pod&#39;s labels and combines them with `labelSelector`
so that podAffinity matches Pods that have the same key-value in labels.

By using label [pod-template-hash](/docs/concepts/workloads/controllers/deployment/#pod-template-hash-label) in `matchLabelKeys`,
you can ensure that only Pods of the same version are evaluated for `podAffinity` or `podAntiAffinity`.
--&gt;
&lt;p&gt;&lt;code&gt;matchLabelKeys&lt;/code&gt; 是一组 Pod 标签键，可以解决上述问题。&lt;br&gt;
调度器从新 Pod 的标签中查找这些键的值，并将其与 &lt;code&gt;labelSelector&lt;/code&gt; 结合，
以便 &lt;code&gt;podAffinity&lt;/code&gt; 匹配到具有相同标签键值的 Pod。&lt;/p&gt;
&lt;p&gt;通过在 &lt;code&gt;matchLabelKeys&lt;/code&gt; 中使用标签
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/deployment/#pod-template-hash-label&#34;&gt;pod-template-hash&lt;/a&gt;，&lt;br&gt;
你可以确保对 &lt;code&gt;podAffinity&lt;/code&gt; 或 &lt;code&gt;podAntiAffinity&lt;/code&gt; 进行评估时仅考虑相同版本的 Pod。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;apps/v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Deployment&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;application-server&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;affinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- database&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;topology.kubernetes.io/zone&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- pod-template-hash&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The above `matchLabelKeys` will be translated in Pods like:
--&gt;
&lt;p&gt;上述 Pod 中的 &lt;code&gt;matchLabelKeys&lt;/code&gt; 将被转换为：&lt;/p&gt;
&lt;!--
# Added from matchLabelKeys; Only Pods from the same replicaset will match this affinity.
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;application-server&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pod-template-hash&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;xyz&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;affinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- database&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pod-template-hash&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 从 matchLabelKeys 添加; 只有来自同一 ReplicaSet 的 Pod 将与此亲和性匹配&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- xyz &lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;topology.kubernetes.io/zone&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- pod-template-hash&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## `mismatchLabelKeys` - Service isolation

`mismatchLabelKeys` is a set of Pod label keys, like `matchLabelKeys`,
which looks up the values of these keys from the new Pod&#39;s labels, and merge them with `labelSelector` as `key notin (value)`
so that `podAffinity` does _not_ match Pods that have the same key-value in labels.

Suppose all Pods for each tenant get `tenant` label via a controller or a manifest management tool like Helm.
--&gt;
&lt;h2 id=&#34;mismatchlabelkeys-服务隔离&#34;&gt;&lt;code&gt;mismatchLabelKeys&lt;/code&gt; - 服务隔离&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mismatchLabelKeys&lt;/code&gt; 是一组 Pod 标签键，类似于 &lt;code&gt;matchLabelKeys&lt;/code&gt;，&lt;br&gt;
它在新 Pod 的标签中查找这些键的值，并将其与 &lt;code&gt;labelSelector&lt;/code&gt; 合并为 &lt;code&gt;key notin (value)&lt;/code&gt;，
以便 &lt;code&gt;podAffinity&lt;/code&gt; &lt;strong&gt;不&lt;/strong&gt;会匹配到具有相同标签键值的 Pod。&lt;/p&gt;
&lt;p&gt;假设每个租户的所有 Pod 通过控制器或像 Helm 这样的清单管理工具得到 &lt;code&gt;tenant&lt;/code&gt; 标签。&lt;/p&gt;
&lt;!--
Although the value of `tenant` label is unknown when composing each workload&#39;s manifest,
the cluster admin wants to achieve exclusive 1:1 tenant to domain placement for a tenant isolation.

`mismatchLabelKeys` works for this usecase;
By applying the following affinity globally using a mutating webhook,
the cluster admin can ensure that the Pods from the same tenant will land on the same domain exclusively,
meaning Pods from other tenants won&#39;t land on the same domain.
--&gt;
&lt;p&gt;尽管在组合每个工作负载的清单时，&lt;code&gt;tenant&lt;/code&gt; 标签的值是未知的，&lt;br&gt;
但集群管理员希望实现租户与域之间形成排他性的 1:1 对应关系，以便隔离租户。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mismatchLabelKeys&lt;/code&gt; 适用于这一使用场景；&lt;br&gt;
通过使用变更性质的 Webhook 在全局应用以下亲和性，
集群管理员可以确保来自同一租户的 Pod 将以独占方式落到同一域上，&lt;br&gt;
这意味着来自其他租户的 Pod 不会落到同一域上。&lt;/p&gt;
&lt;!--
```yaml
affinity:
  podAffinity:      # ensures the pods of this tenant land on the same node pool
    requiredDuringSchedulingIgnoredDuringExecution:
    - matchLabelKeys:
        - tenant
      topologyKey: node-pool
  podAntiAffinity:  # ensures only Pods from this tenant lands on the same node pool
    requiredDuringSchedulingIgnoredDuringExecution:
    - mismatchLabelKeys:
        - tenant
      labelSelector:
        matchExpressions:
        - key: tenant
          operator: Exists
      topologyKey: node-pool
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;affinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 确保此租户的 Pod 落在同一节点池上&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-pool&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAntiAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 确保只有此租户的 Pod 落在同一节点池上&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mismatchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-pool&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The above `matchLabelKeys` and `mismatchLabelKeys` will be translated to like:
--&gt;
&lt;p&gt;上述的 &lt;code&gt;matchLabelKeys&lt;/code&gt; 和 &lt;code&gt;mismatchLabelKeys&lt;/code&gt; 将被转换为：&lt;/p&gt;
&lt;!--
```yaml
kind: Pod
metadata:
  name: application-server
  labels:
    tenant: service-a
spec: 
  affinity:
    podAffinity:      # ensures the pods of this tenant land on the same node pool
      requiredDuringSchedulingIgnoredDuringExecution:
      - matchLabelKeys:
          - tenant
        topologyKey: node-pool
        labelSelector:
          matchExpressions:
          - key: tenant
            operator: In
            values:
            - service-a 
    podAntiAffinity:  # ensures only Pods from this tenant lands on the same node pool
      requiredDuringSchedulingIgnoredDuringExecution:
      - mismatchLabelKeys:
          - tenant
        labelSelector:
          matchExpressions:
          - key: tenant
            operator: Exists
          - key: tenant
            operator: NotIn
            values:
            - service-a
        topologyKey: node-pool
```
--&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;application-server&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;tenant&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;service-a&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;affinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 确保此租户的 Pod 落在同一节点池上&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-pool&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;In&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- service-a &lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;podAntiAffinity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 确保只有此租户的 Pod 落在同一节点池上&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredDuringSchedulingIgnoredDuringExecution&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mismatchLabelKeys&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchExpressions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Exists&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;key&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;tenant&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;operator&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;NotIn&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;values&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;            &lt;/span&gt;- service-a &lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;node-pool&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Getting involved

These features are managed by Kubernetes [SIG Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).

Please join us and share your feedback. We look forward to hearing from you!
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;这些特性由 Kubernetes
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-scheduling&#34;&gt;SIG Scheduling&lt;/a&gt; 管理。&lt;/p&gt;
&lt;p&gt;请加入我们并分享你的反馈。我们期待听到你的声音！&lt;/p&gt;
&lt;!--
## How can I learn more?

- [The official document of podAffinity](/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
- [KEP-3633: Introduce matchLabelKeys and mismatchLabelKeys to podAffinity and podAntiAffinity](https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/3633-matchlabelkeys-to-podaffinity/README.md#story-2)
--&gt;
&lt;h2 id=&#34;了解更多&#34;&gt;了解更多&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity&#34;&gt;podAffinity 的官方文档&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/3633-matchlabelkeys-to-podaffinity/README.md#story-2&#34;&gt;KEP-3633：将 matchLabelKeys 和 mismatchLabelKeys 引入 podAffinity 和 podAntiAffinity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：防止无序删除时 PersistentVolume 泄漏</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-prevent-persistentvolume-leaks-when-deleting-out-of-order/</link>
      <pubDate>Fri, 16 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-prevent-persistentvolume-leaks-when-deleting-out-of-order/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.31: Prevent PersistentVolume Leaks When Deleting out of Order&#39;
date: 2024-08-16
slug: kubernetes-1-31-prevent-persistentvolume-leaks-when-deleting-out-of-order
author: &gt;
  Deepak Kinni (Broadcom)
--&gt;
&lt;!--
[PersistentVolume](/docs/concepts/storage/persistent-volumes/) (or PVs for short) are
associated with [Reclaim Policy](/docs/concepts/storage/persistent-volumes/#reclaim-policy).
The reclaim policy is used to determine the actions that need to be taken by the storage
backend on deletion of the PVC Bound to a PV.
When the reclaim policy is `Delete`, the expectation is that the storage backend
releases the storage resource allocated for the PV. In essence, the reclaim
policy needs to be honored on PV deletion.

With the recent Kubernetes v1.31 release, a beta feature lets you configure your
cluster to behave that way and honor the configured reclaim policy.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;PersistentVolume&lt;/a&gt;（简称 PV）
具有与之关联的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#reclaim-policy&#34;&gt;回收策略&lt;/a&gt;。
回收策略用于确定在删除绑定到 PV 的 PVC 时存储后端需要采取的操作。当回收策略为 &lt;code&gt;Delete&lt;/code&gt; 时，
期望存储后端释放为 PV 所分配的存储资源。实际上，在 PV 被删除时就需要执行此回收策略。&lt;/p&gt;
&lt;p&gt;在最近发布的 Kubernetes v1.31 版本中，一个 Beta 特性允许你配置集群以这种方式运行并执行你配置的回收策略。&lt;/p&gt;
&lt;!--
## How did reclaim work in previous Kubernetes releases?

[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#Introduction) (or PVC for short) is
a user&#39;s request for storage. A PV and PVC are considered [Bound](/docs/concepts/storage/persistent-volumes/#Binding)
if a newly created PV or a matching PV is found. The PVs themselves are
backed by volumes allocated by the storage backend.
--&gt;
&lt;h2 id=&#34;在以前的-kubernetes-版本中回收是如何工作的&#34;&gt;在以前的 Kubernetes 版本中回收是如何工作的？&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#Introduction&#34;&gt;PersistentVolumeClaim&lt;/a&gt;
（简称 PVC）是用户对存储的请求。如果新创建了 PV 或找到了匹配的 PV，那么此 PV 和此 PVC
被视为&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#Binding&#34;&gt;已绑定&lt;/a&gt;。
PV 本身是由存储后端所分配的卷支持的。&lt;/p&gt;
&lt;!--
Normally, if the volume is to be deleted, then the expectation is to delete the
PVC for a bound PV-PVC pair. However, there are no restrictions on deleting a PV
before deleting a PVC.

First, I&#39;ll demonstrate the behavior for clusters running an older version of Kubernetes.

#### Retrieve a PVC that is bound to a PV

Retrieve an existing PVC `example-vanilla-block-pvc`
--&gt;
&lt;p&gt;通常，如果卷要被删除，对应的预期是为一个已绑定的 PV-PVC 对删除其中的 PVC。
不过，对于在删除 PVC 之前可否删除 PV 并没有限制。&lt;/p&gt;
&lt;p&gt;首先，我将演示运行旧版本 Kubernetes 的集群的行为。&lt;/p&gt;
&lt;h4 id=&#34;检索绑定到-pv-的-pvc&#34;&gt;检索绑定到 PV 的 PVC&lt;/h4&gt;
&lt;p&gt;检索现有的 PVC &lt;code&gt;example-vanilla-block-pvc&lt;/code&gt;：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pvc example-vanilla-block-pvc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The following output shows the PVC and its bound PV; the PV is shown under the `VOLUME` column:
--&gt;
&lt;p&gt;以下输出显示了 PVC 及其绑定的 PV；此 PV 显示在 &lt;code&gt;VOLUME&lt;/code&gt; 列下：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NAME                        STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS               AGE
example-vanilla-block-pvc   Bound    pvc-6791fdd4-5fad-438e-a7fb-16410363e3da   5Gi        RWO            example-vanilla-block-sc   19s
&lt;/code&gt;&lt;/pre&gt;&lt;!--
#### Delete PV

When I try to delete a bound PV, the kubectl session blocks and the `kubectl` 
tool does not return back control to the shell; for example:
--&gt;
&lt;h4 id=&#34;删除-pv&#34;&gt;删除 PV&lt;/h4&gt;
&lt;p&gt;当我尝试删除已绑定的 PV 时，kubectl 会话被阻塞，
且 &lt;code&gt;kubectl&lt;/code&gt; 工具不会将控制权返回给 Shell；例如：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl delete pv pvc-6791fdd4-5fad-438e-a7fb-16410363e3da
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;persistentvolume &amp;#34;pvc-6791fdd4-5fad-438e-a7fb-16410363e3da&amp;#34; deleted
^C
&lt;/code&gt;&lt;/pre&gt;&lt;!--
#### Retrieving the PV
--&gt;
&lt;h4 id=&#34;检索-pv&#34;&gt;检索 PV&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pv pvc-6791fdd4-5fad-438e-a7fb-16410363e3da
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
It can be observed that the PV is in a `Terminating` state
--&gt;
&lt;p&gt;你可以观察到 PV 处于 &lt;code&gt;Terminating&lt;/code&gt; 状态：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS        CLAIM                               STORAGECLASS               REASON   AGE
pvc-6791fdd4-5fad-438e-a7fb-16410363e3da   5Gi        RWO            Delete           Terminating   default/example-vanilla-block-pvc   example-vanilla-block-sc            2m23s
&lt;/code&gt;&lt;/pre&gt;&lt;!--
#### Delete PVC
--&gt;
&lt;h4 id=&#34;删除-pvc&#34;&gt;删除 PVC&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl delete pvc example-vanilla-block-pvc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The following output is seen if the PVC gets successfully deleted:
--&gt;
&lt;p&gt;如果 PVC 被成功删除，则会看到以下输出：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;persistentvolumeclaim &amp;#34;example-vanilla-block-pvc&amp;#34; deleted
&lt;/code&gt;&lt;/pre&gt;&lt;!--
The PV object from the cluster also gets deleted. When attempting to retrieve the PV
it will be observed that the PV is no longer found:
--&gt;
&lt;p&gt;集群中的 PV 对象也被删除。当尝试检索 PV 时，你会观察到该 PV 已不再存在：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pv pvc-6791fdd4-5fad-438e-a7fb-16410363e3da
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Error from server (NotFound): persistentvolumes &amp;#34;pvc-6791fdd4-5fad-438e-a7fb-16410363e3da&amp;#34; not found
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Although the PV is deleted, the underlying storage resource is not deleted and
needs to be removed manually.

To sum up, the reclaim policy associated with the PersistentVolume is currently
ignored under certain circumstances. For a `Bound` PV-PVC pair, the ordering of PV-PVC
deletion determines whether the PV reclaim policy is honored. The reclaim policy
is honored if the PVC is deleted first; however, if the PV is deleted prior to
deleting the PVC, then the reclaim policy is not exercised. As a result of this behavior,
the associated storage asset in the external infrastructure is not removed.
--&gt;
&lt;p&gt;尽管 PV 被删除，但下层存储资源并未被删除，需要手动移除。&lt;/p&gt;
&lt;p&gt;总结一下，与 PersistentVolume 关联的回收策略在某些情况下会被忽略。
对于 &lt;code&gt;Bound&lt;/code&gt; 的 PV-PVC 对，PV-PVC 删除的顺序决定了回收策略是否被执行。
如果 PVC 先被删除，则回收策略被执行；但如果在删除 PVC 之前 PV 被删除，
则回收策略不会被执行。因此，外部基础设施中关联的存储资产未被移除。&lt;/p&gt;
&lt;!--
## PV reclaim policy with Kubernetes v1.31

The new behavior ensures that the underlying storage object is deleted from the backend when users attempt to delete a PV manually.

#### How to enable new behavior?

To take advantage of the new behavior, you must have upgraded your cluster to the v1.31 release of Kubernetes
and run the CSI [`external-provisioner`](https://github.com/kubernetes-csi/external-provisioner) version `5.0.1` or later.
--&gt;
&lt;h2 id=&#34;kubernetes-v1-31-的-pv-回收策略&#34;&gt;Kubernetes v1.31 的 PV 回收策略&lt;/h2&gt;
&lt;p&gt;新的行为确保当用户尝试手动删除 PV 时，下层存储对象会从后端被删除。&lt;/p&gt;
&lt;h4 id=&#34;如何启用新的行为&#34;&gt;如何启用新的行为？&lt;/h4&gt;
&lt;p&gt;要利用新的行为，你必须将集群升级到 Kubernetes v1.31 版本，并运行
CSI &lt;a href=&#34;https://github.com/kubernetes-csi/external-provisioner&#34;&gt;&lt;code&gt;external-provisioner&lt;/code&gt;&lt;/a&gt;
v5.0.1 或更高版本。&lt;/p&gt;
&lt;!--
#### How does it work?

For CSI volumes, the new behavior is achieved by adding a [finalizer](/docs/concepts/overview/working-with-objects/finalizers/) `external-provisioner.volume.kubernetes.io/finalizer`
on new and existing PVs. The finalizer is only removed after the storage from the backend is deleted.
`

An example of a PV with the finalizer, notice the new finalizer in the finalizers list
--&gt;
&lt;h4 id=&#34;工作方式&#34;&gt;工作方式&lt;/h4&gt;
&lt;p&gt;对于 CSI 卷，新的行为是通过在新创建和现有的 PV 上添加
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/working-with-objects/finalizers/&#34;&gt;Finalizer&lt;/a&gt;
&lt;code&gt;external-provisioner.volume.kubernetes.io/finalizer&lt;/code&gt; 来实现的。
只有在后端存储被删除后，Finalizer 才会被移除。&lt;/p&gt;
&lt;p&gt;下面是一个带 Finalizer 的 PV 示例，请注意 Finalizer 列表中的新 Finalizer：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pv pvc-a7b7e3ba-f837-45ba-b243-dec7d8aaed53 -o yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;annotations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pv.kubernetes.io/provisioned-by&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;csi.vsphere.vmware.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;creationTimestamp&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2021-11-17T19:28:56Z&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;finalizers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- kubernetes.io/pv-protection&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- external-provisioner.volume.kubernetes.io/finalizer&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pvc-a7b7e3ba-f837-45ba-b243-dec7d8aaed53&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;194711&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;087f14f2-4157-4e95-8a70-8294b039d30e&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;accessModes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- ReadWriteOnce&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;capacity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storage&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;1Gi&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claimRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolumeClaim&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-vanilla-block-pvc&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;default&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;194677&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;a7b7e3ba-f837-45ba-b243-dec7d8aaed53&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;csi&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;driver&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;csi.vsphere.vmware.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;fsType&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ext4&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeAttributes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storage.kubernetes.io/csiProvisionerIdentity&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1637110610497-8081&lt;/span&gt;-csi.vsphere.vmware.com&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;vSphere CNS Block Volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeHandle&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;2dacf297-803f-4ccc-afc7-3d3c3f02051e&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;persistentVolumeReclaimPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Delete&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storageClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;example-vanilla-block-sc&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Filesystem&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;phase&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Bound&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The [finalizer](/docs/concepts/overview/working-with-objects/finalizers/) prevents this
PersistentVolume from being removed from the
cluster. As stated previously, the finalizer is only removed from the PV object
after it is successfully deleted from the storage backend. To learn more about
finalizers, please refer to [Using Finalizers to Control Deletion](/blog/2021/05/14/using-finalizers-to-control-deletion/).

Similarly, the finalizer `kubernetes.io/pv-controller` is added to dynamically provisioned in-tree plugin volumes.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/working-with-objects/finalizers/&#34;&gt;Finalizer&lt;/a&gt;
防止此 PersistentVolume 从集群中被移除。如前文所述，Finalizer 仅在从存储后端被成功删除后才会从
PV 对象中被移除。进一步了解 Finalizer，
请参阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/blog/2021/05/14/using-finalizers-to-control-deletion/&#34;&gt;使用 Finalizer 控制删除&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;同样，Finalizer &lt;code&gt;kubernetes.io/pv-controller&lt;/code&gt; 也被添加到动态制备的树内插件卷中。&lt;/p&gt;
&lt;!--
#### What about CSI migrated volumes?

The fix applies to CSI migrated volumes as well. 

### Some caveats

The fix does not apply to statically provisioned in-tree plugin volumes.
--&gt;
&lt;h4 id=&#34;有关-csi-迁移的卷&#34;&gt;有关 CSI 迁移的卷&lt;/h4&gt;
&lt;p&gt;本次修复同样适用于 CSI 迁移的卷。&lt;/p&gt;
&lt;h3 id=&#34;一些注意事项&#34;&gt;一些注意事项&lt;/h3&gt;
&lt;p&gt;本次修复不适用于静态制备的树内插件卷。&lt;/p&gt;
&lt;!--
### References
--&gt;
&lt;h3 id=&#34;参考&#34;&gt;参考&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2644-honor-pv-reclaim-policy&#34;&gt;KEP-2644&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-csi/external-provisioner/issues/546&#34;&gt;Volume leak issue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### How do I get involved?

The Kubernetes Slack channel [SIG Storage communication channels](https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact) are great mediums to reach out to the SIG Storage and migration working group teams.

Special thanks to the following people for the insightful reviews, thorough consideration and valuable contribution:
--&gt;
&lt;h3 id=&#34;我该如何参与&#34;&gt;我该如何参与？&lt;/h3&gt;
&lt;p&gt;Kubernetes Slack
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact&#34;&gt;SIG Storage 交流频道&lt;/a&gt;是与
SIG Storage 和迁移工作组团队联系的良好媒介。&lt;/p&gt;
&lt;p&gt;特别感谢以下人员的用心评审、周全考虑和宝贵贡献：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fan Baofa (carlory)&lt;/li&gt;
&lt;li&gt;Jan Šafránek (jsafrane)&lt;/li&gt;
&lt;li&gt;Xing Yang (xing-yang)&lt;/li&gt;
&lt;li&gt;Matthew Wong (wongma7)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Join the [Kubernetes Storage Special Interest Group (SIG)](https://github.com/kubernetes/community/tree/master/sig-storage) if you&#39;re interested in getting involved with the design and development of CSI or any part of the Kubernetes Storage system. We’re rapidly growing and always welcome new contributors.
--&gt;
&lt;p&gt;如果你有兴趣参与 CSI 或 Kubernetes Storage 系统任何部分的设计和开发，请加入
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes Storage SIG&lt;/a&gt;。
我们正在快速成长，始终欢迎新的贡献者。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：基于 OCI 工件的只读卷 (Alpha)</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-image-volume-source/</link>
      <pubDate>Fri, 16 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/16/kubernetes-1-31-image-volume-source/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: Read Only Volumes Based On OCI Artifacts (alpha)&#34;
date: 2024-08-16
slug: kubernetes-1-31-image-volume-source
author: Sascha Grunert
--&gt;
&lt;!--
The Kubernetes community is moving towards fulfilling more Artificial
Intelligence (AI) and Machine Learning (ML) use cases in the future. While the
project has been designed to fulfill microservice architectures in the past,
it’s now time to listen to the end users and introduce features which have a
stronger focus on AI/ML.
--&gt;
&lt;p&gt;Kubernetes 社区正朝着在未来满足更多人工智能（AI）和机器学习（ML）使用场景的方向发展。
虽然此项目在过去设计为满足微服务架构，但现在是时候听听最终用户的声音并引入更侧重于 AI/ML 的特性了。&lt;/p&gt;
&lt;!--
One of these requirements is to support [Open Container Initiative (OCI)](https://opencontainers.org)
compatible images and artifacts (referred as OCI objects) directly as a native
volume source. This allows users to focus on OCI standards as well as enables
them to store and distribute any content using OCI registries. A feature like
this gives the Kubernetes project a chance to grow into use cases which go
beyond running particular images.
--&gt;
&lt;p&gt;其中一项需求是直接支持与&lt;a href=&#34;https://opencontainers.org&#34;&gt;开放容器倡议（OCI）&lt;/a&gt;
兼容的镜像和工件（称为 OCI 对象）作为原生卷源。
这使得用户能够专注于 OCI 标准，且能够使用 OCI 镜像仓库存储和分发任何内容。
与此类似的特性让 Kubernetes 项目有机会扩大其使用场景，不再局限于运行特定镜像。&lt;/p&gt;
&lt;!--
Given that, the Kubernetes community is proud to present a new alpha feature
introduced in v1.31: The Image Volume Source
([KEP-4639](https://kep.k8s.io/4639)). This feature allows users to specify an
image reference as volume in a pod while reusing it as volume mount within
containers:
--&gt;
&lt;p&gt;在这一背景下，Kubernetes 社区自豪地展示在 v1.31 中引入的一项新的 Alpha 特性：
镜像卷源（&lt;a href=&#34;https://kep.k8s.io/4639&#34;&gt;KEP-4639&lt;/a&gt;）。
此特性允许用户在 Pod 中指定一个镜像引用作为卷，并在容器内将其作为卷挂载进行复用：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;…&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- …&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMounts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;my-volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/path/to/directory&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;my-volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;reference&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;my-image:tag&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The above example would result in mounting `my-image:tag` to
`/path/to/directory` in the pod’s container.
--&gt;
&lt;p&gt;上述示例的结果是将 &lt;code&gt;my-image:tag&lt;/code&gt; 挂载到 Pod 的容器中的 &lt;code&gt;/path/to/directory&lt;/code&gt;。&lt;/p&gt;
&lt;!--
## Use cases

The goal of this enhancement is to stick as close as possible to the existing
[container image](/docs/concepts/containers/images/) implementation within the
kubelet, while introducing a new API surface to allow more extended use cases.
--&gt;
&lt;h2 id=&#34;使用场景&#34;&gt;使用场景&lt;/h2&gt;
&lt;p&gt;此增强特性的目标是在尽可能贴近 kubelet 中现有的&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/containers/images/&#34;&gt;容器镜像&lt;/a&gt;实现的同时，
引入新的 API 接口以支持更广泛的使用场景。&lt;/p&gt;
&lt;!--
For example, users could share a configuration file among multiple containers in
a pod without including the file in the main image, so that they can minimize
security risks and the overall image size. They can also package and distribute
binary artifacts using OCI images and mount them directly into Kubernetes pods,
so that they can streamline their CI/CD pipeline as an example.
--&gt;
&lt;p&gt;例如，用户可以在 Pod 中的多个容器之间共享一个配置文件，而无需将此文件包含在主镜像中，
这样用户就可以将安全风险最小化和并缩减整体镜像大小。用户还可以使用 OCI 镜像打包和分发二进制工件，
并直接将它们挂载到 Kubernetes Pod 中，例如用户这样就可以简化其 CI/CD 流水线。&lt;/p&gt;
&lt;!--
Data scientists, MLOps engineers, or AI developers, can mount large language
model weights or machine learning model weights in a pod alongside a
model-server, so that they can efficiently serve them without including them in
the model-server container image. They can package these in an OCI object to
take advantage of OCI distribution and ensure efficient model deployment. This
allows them to separate the model specifications/content from the executables
that process them.
--&gt;
&lt;p&gt;数据科学家、MLOps 工程师或 AI 开发者可以与模型服务器一起在 Pod 中挂载大语言模型权重或机器学习模型权重数据，
从而可以更高效地提供服务，且无需将这些模型包含在模型服务器容器镜像中。
他们可以将这些模型打包在 OCI 对象中，以利用 OCI 分发机制，还可以确保高效的模型部署。
这一新特性允许他们将模型规约/内容与处理它们的可执行文件分开。&lt;/p&gt;
&lt;!--
Another use case is that security engineers can use a public image for a malware
scanner and mount in a volume of private (commercial) malware signatures, so
that they can load those signatures without baking their own combined image
(which might not be allowed by the copyright on the public image). Those files
work regardless of the OS or version of the scanner software.
--&gt;
&lt;p&gt;另一个使用场景是安全工程师可以使用公共镜像作为恶意软件扫描器，并将私有的（商业的）恶意软件签名挂载到卷中，
这样他们就可以加载这些签名且无需制作自己的组合镜像（公共镜像的版权要求可能不允许这样做）。
签名数据文件与操作系统或扫描器软件版本无关，总是可以被使用。&lt;/p&gt;
&lt;!--
But in the long term it will be up to **you** as an end user of this project to
outline further important use cases for the new feature.
[SIG Node](https://github.com/kubernetes/community/blob/54a67f5/sig-node/README.md)
is happy to retrieve any feedback or suggestions for further enhancements to
allow more advanced usage scenarios. Feel free to provide feedback by either
using the [Kubernetes Slack (#sig-node)](https://kubernetes.slack.com/messages/sig-node)
channel or the [SIG Node mailinglist](https://groups.google.com/g/kubernetes-sig-node).
--&gt;
&lt;p&gt;但就长期而言，作为此项目的最终用户的你要负责为这一新特性的其他重要使用场景给出规划。
&lt;a href=&#34;https://github.com/kubernetes/community/blob/54a67f5/sig-node/README.md&#34;&gt;SIG Node&lt;/a&gt;
乐于接收与进一步增强此特性以适应更高级的使用场景有关的所有反馈或建议。你可以通过使用
&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-node&#34;&gt;Kubernetes Slack（#sig-node）&lt;/a&gt;
频道或 &lt;a href=&#34;https://groups.google.com/g/kubernetes-sig-node&#34;&gt;SIG Node 邮件列表&lt;/a&gt;提供反馈。&lt;/p&gt;
&lt;!--
## Detailed example {#example}

The Kubernetes alpha feature gate [`ImageVolume`](/docs/reference/command-line-tools-reference/feature-gates)
needs to be enabled on the [API Server](/docs/reference/command-line-tools-reference/kube-apiserver)
as well as the [kubelet](/docs/reference/command-line-tools-reference/kubelet)
to make it functional. If that’s the case and the [container runtime](/docs/setup/production-environment/container-runtimes)
has support for the feature (like CRI-O ≥ v1.31), then an example `pod.yaml`
like this can be created:
--&gt;
&lt;h2 id=&#34;example&#34;&gt;详细示例&lt;/h2&gt;
&lt;p&gt;你需要在 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver&#34;&gt;API 服务器&lt;/a&gt;以及
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/kubelet&#34;&gt;kubelet&lt;/a&gt; 上启用
Kubernetes Alpha 特性门控 &lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates&#34;&gt;&lt;code&gt;ImageVolume&lt;/code&gt;&lt;/a&gt;，
才能使其正常工作。如果启用了此特性，
并且&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/production-environment/container-runtimes&#34;&gt;容器运行时&lt;/a&gt;支持此特性
（如 CRI-O ≥ v1.31），那就可以创建这样一个示例 &lt;code&gt;pod.yaml&lt;/code&gt;：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pod&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;registry.k8s.io/e2e-test-images/echoserver:2.3&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeMounts&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;volume&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;reference&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;quay.io/crio/artifact:v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;pullPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;IfNotPresent&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The pod declares a new volume using the `image.reference` of
`quay.io/crio/artifact:v1`, which refers to an OCI object containing two files.
The `pullPolicy` behaves in the same way as for container images and allows the
following values:
--&gt;
&lt;p&gt;此 Pod 使用值为 &lt;code&gt;quay.io/crio/artifact:v1&lt;/code&gt; 的 &lt;code&gt;image.reference&lt;/code&gt; 声明一个新卷，
该字段值引用了一个包含两个文件的 OCI 对象。&lt;code&gt;pullPolicy&lt;/code&gt; 的行为与容器镜像相同，允许以下值：&lt;/p&gt;
&lt;!--
- `Always`: the kubelet always attempts to pull the reference and the container
  creation will fail if the pull fails.
- `Never`: the kubelet never pulls the reference and only uses a local image or
  artifact. The container creation will fail if the reference isn’t present.
- `IfNotPresent`: the kubelet pulls if the reference isn’t already present on
  disk. The container creation will fail if the reference isn’t present and the
  pull fails.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Always&lt;/code&gt;：kubelet 总是尝试拉取引用，如果拉取失败，容器创建将失败。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Never&lt;/code&gt;：kubelet 从不拉取引用，只使用本地镜像或工件。如果引用不存在，容器创建将失败。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IfNotPresent&lt;/code&gt;：kubelet 会在引用已不在磁盘上时进行拉取。如果引用不存在且拉取失败，容器创建将失败。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The `volumeMounts` field is indicating that the container with the name `test`
should mount the volume under the path `/volume`.

If you now create the pod:
--&gt;
&lt;p&gt;&lt;code&gt;volumeMounts&lt;/code&gt; 字段表示名为 &lt;code&gt;test&lt;/code&gt; 的容器应将卷挂载到 &lt;code&gt;/volume&lt;/code&gt; 路径下。&lt;/p&gt;
&lt;p&gt;如果你现在创建 Pod：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl apply -f pod.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
And exec into it:
--&gt;
&lt;p&gt;然后通过 exec 进入此 Pod：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl &lt;span style=&#34;color:#a2f&#34;&gt;exec&lt;/span&gt; -it pod -- sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then you’re able to investigate what has been mounted:
--&gt;
&lt;p&gt;那么你就能够查看已挂载的内容：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;/ # ls /volume
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;dir   file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;/ # cat /volume/file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;/ # ls /volume/dir
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;/ # cat /volume/dir/file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
**You managed to consume an OCI artifact using Kubernetes!**

The container runtime pulls the image (or artifact), mounts it to the
container and makes it finally available for direct usage. There are a bunch of
details in the implementation, which closely align to the existing image pull
behavior of the kubelet. For example:
--&gt;
&lt;p&gt;&lt;strong&gt;你已经成功地使用 Kubernetes 访问了 OCI 工件！&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;容器运行时拉取镜像（或工件），将其挂载到容器中，并最终使其可被直接使用。
在实现中有很多细节，这些细节与 kubelet 现有的镜像拉取行为密切相关。例如：&lt;/p&gt;
&lt;!--
- If a `:latest` tag as `reference` is provided, then the `pullPolicy` will
  default to `Always`, while in any other case it will default to `IfNotPresent`
  if unset.
- The volume gets re-resolved if the pod gets deleted and recreated, which means
  that new remote content will become available on pod recreation. A failure to
  resolve or pull the image during pod startup will block containers from
  starting and may add significant latency. Failures will be retried using
  normal volume backoff and will be reported on the pod reason and message.
--&gt;
&lt;ul&gt;
&lt;li&gt;如果提供给 &lt;code&gt;reference&lt;/code&gt; 的值包含 &lt;code&gt;:latest&lt;/code&gt; 标签，&lt;code&gt;pullPolicy&lt;/code&gt; 将默认为 &lt;code&gt;Always&lt;/code&gt;，
而在任何其他情况下，&lt;code&gt;pullPolicy&lt;/code&gt; 在未被设置的情况下都默认为 &lt;code&gt;IfNotPresent&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;如果 Pod 被删除并重新创建，卷将被重新解析，这意味着在 Pod 重新创建时将可以访问新的远端内容。
如果在 Pod 启动期间未能解析或未能拉取镜像，将会容器启动会被阻止，并可能显著增加延迟。
如果拉取镜像失败，将使用正常的卷回退机制进行重试，并将在 Pod 的原因和消息中报告出错原因。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Pull secrets will be assembled in the same way as for the container image by
  looking up node credentials, service account image pull secrets, and pod spec
  image pull secrets.
- The OCI object gets mounted in a single directory by merging the manifest
  layers in the same way as for container images.
- The volume is mounted as read-only (`ro`) and non-executable files
  (`noexec`).
--&gt;
&lt;ul&gt;
&lt;li&gt;拉取 Secret 的组装方式与容器镜像所用的方式相同，也是通过查找节点凭据、服务账户镜像拉取 Secret
和 Pod 规约中的镜像拉取 Secret 来完成。&lt;/li&gt;
&lt;li&gt;OCI 对象被挂载到单个目录中，清单层的合并方式与容器镜像相同。&lt;/li&gt;
&lt;li&gt;卷以只读（&lt;code&gt;ro&lt;/code&gt;）和非可执行文件（&lt;code&gt;noexec&lt;/code&gt;）的方式被挂载。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Sub-path mounts for containers are not supported
  (`spec.containers[*].volumeMounts.subpath`).
- The field `spec.securityContext.fsGroupChangePolicy` has no effect on this
  volume type.
- The feature will also work with the [`AlwaysPullImages` admission plugin](/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages)
  if enabled.
--&gt;
&lt;ul&gt;
&lt;li&gt;容器的子路径挂载不被支持（&lt;code&gt;spec.containers[*].volumeMounts.subpath&lt;/code&gt;）。&lt;/li&gt;
&lt;li&gt;字段 &lt;code&gt;spec.securityContext.fsGroupChangePolicy&lt;/code&gt; 对这种卷类型没有影响。&lt;/li&gt;
&lt;li&gt;如果已启用，此特性也将与
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages&#34;&gt;&lt;code&gt;AlwaysPullImages&lt;/code&gt; 准入插件&lt;/a&gt;一起工作。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Thank you for reading through the end of this blog post! SIG Node is proud and
happy to deliver this feature as part of Kubernetes v1.31.

As writer of this blog post, I would like to emphasize my special thanks to
**all** involved individuals out there! You all rock, let’s keep on hacking!
--&gt;
&lt;p&gt;感谢你阅读到这篇博客文章的结尾！对于将此特性作为 Kubernetes v1.31
的一部分交付，SIG Node 感到很高兴也很自豪。&lt;/p&gt;
&lt;p&gt;作为这篇博客的作者，我想特别感谢所有参与者！你们都很棒，让我们继续开发之旅！&lt;/p&gt;
&lt;!--
## Further reading

- [Use an Image Volume With a Pod](/docs/tasks/configure-pod-container/image-volumes)
- [`image` volume overview](/docs/concepts/storage/volumes/#image)
--&gt;
&lt;h2 id=&#34;进一步阅读&#34;&gt;进一步阅读&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/image-volumes&#34;&gt;在 Pod 中使用镜像卷&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#image&#34;&gt;&lt;code&gt;image&lt;/code&gt; 卷概览&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：通过 VolumeAttributesClass 修改卷进阶至 Beta</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/15/kubernetes-1-31-volume-attributes-class/</link>
      <pubDate>Thu, 15 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/15/kubernetes-1-31-volume-attributes-class/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: VolumeAttributesClass for Volume Modification Beta&#34;
date: 2024-08-15
slug: kubernetes-1-31-volume-attributes-class
author: &gt;
  Sunny Song (Google)
  Matthew Cary (Google)
--&gt;
&lt;!--
Volumes in Kubernetes have been described by two attributes: their storage class, and
their capacity. The storage class is an immutable property of the volume, while the
capacity can be changed dynamically with [volume
resize](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims).

This complicates vertical scaling of workloads with volumes. While cloud providers and
storage vendors often offer volumes which allow specifying IO quality of service
(Performance) parameters like IOPS or throughput and tuning them as workloads operate,
Kubernetes has no API which allows changing them.
--&gt;
&lt;p&gt;在 Kubernetes 中，卷由两个属性描述：存储类和容量。存储类是卷的不可变属性，
而容量可以通过&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims&#34;&gt;卷调整大小&lt;/a&gt;进行动态变更。&lt;/p&gt;
&lt;p&gt;这使得使用卷的工作负载的垂直扩缩容变得复杂。
虽然云厂商和存储供应商通常提供了一些允许指定注入 IOPS 或吞吐量等 IO
服务质量（性能）参数的卷，并允许在工作负载运行期间调整这些参数，但 Kubernetes
没有提供用来更改这些参数的 API。&lt;/p&gt;
&lt;!--
We are pleased to announce that the [VolumeAttributesClass
KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md),
alpha since Kubernetes 1.29, will be beta in 1.31. This provides a generic,
Kubernetes-native API for modifying volume parameters like provisioned IO.
--&gt;
&lt;p&gt;我们很高兴地宣布，自 Kubernetes 1.29 起以 Alpha 引入的
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md&#34;&gt;VolumeAttributesClass KEP&lt;/a&gt;
将在 1.31 中进入 Beta 阶段。这一机制提供了一个通用的、Kubernetes 原生的 API，
可用来修改诸如所提供的 IO 能力这类卷参数。&lt;/p&gt;
&lt;!--
Like all new volume features in Kubernetes, this API is implemented via the [container
storage interface (CSI)](https://kubernetes-csi.github.io/docs/). In addition to the
VolumeAttributesClass feature gate, your provisioner-specific CSI driver must support the
new ModifyVolume API which is the CSI side of this feature.

See the [full
documentation](https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/)
for all details. Here we show the common workflow.
--&gt;
&lt;p&gt;类似于 Kubernetes 中所有新的卷特性，此 API 是通过&lt;a href=&#34;https://kubernetes-csi.github.io/docs/&#34;&gt;容器存储接口（CSI）&lt;/a&gt;实现的。
除了 VolumeAttributesClass 特性门控外，特定于制备器的 CSI 驱动还必须支持此特性在
CSI 一侧的全新的 ModifyVolume API。&lt;/p&gt;
&lt;p&gt;有关细节请参阅&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volume-attributes-classes/&#34;&gt;完整文档&lt;/a&gt;。
在这里，我们展示了常见的工作流程。&lt;/p&gt;
&lt;!--
### Dynamically modifying volume attributes.

A `VolumeAttributesClass` is a cluster-scoped resource that specifies provisioner-specific
attributes. These are created by the cluster administrator in the same way as storage
classes. For example, a series of gold, silver and bronze volume attribute classes can be
created for volumes with greater or lessor amounts of provisioned IO.
--&gt;
&lt;h3 id=&#34;dynamically-modifying-volume-attributes&#34;&gt;动态修改卷属性  &lt;/h3&gt;
&lt;p&gt;&lt;code&gt;VolumeAttributesClass&lt;/code&gt; 是一个集群范围的资源，用来指定特定于制备器的属性。
这些属性由集群管理员创建，方式上与存储类相同。
例如，你可以为卷创建一系列金、银和铜级别的卷属性类，以区隔不同级别的 IO 能力。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;storage.k8s.io/v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;VolumeAttributesClass&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;silver&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;driverName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;your-csi-driver&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parameters&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;provisioned-iops&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;500&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;provisioned-throughput&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;50MiB/s&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;---&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;storage.k8s.io/v1alpha1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;VolumeAttributesClass&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;gold&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;driverName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;your-csi-driver&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parameters&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;provisioned-iops&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;10000&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;provisioned-throughput&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;500MiB/s&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
An attribute class is added to a PVC in much the same way as a storage class.
--&gt;
&lt;p&gt;属性类的添加方式与存储类类似。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;PersistentVolumeClaim&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;test-pv-claim&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storageClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;any-storage-class&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;volumeAttributesClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;silver&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;accessModes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- ReadWriteOnce&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requests&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;storage&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;64Gi&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Unlike a storage class, the volume attributes class can be changed:
--&gt;
&lt;p&gt;与存储类不同，卷属性类可以被更改：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl patch pvc test-pv-claim -p &lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{&amp;#34;spec&amp;#34;: &amp;#34;volumeAttributesClassName&amp;#34;: &amp;#34;gold&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Kubernetes will work with the CSI driver to update the attributes of the
volume. The status of the PVC will track the current and desired attributes
class. The PV resource will also be updated with the new volume attributes class
which will be set to the currently active attributes of the PV.
--&gt;
&lt;p&gt;Kubernetes 将与 CSI 驱动协作来更新卷的属性。
PVC 的状态将跟踪当前和所需的属性类。
PV 资源也将依据新的卷属性类完成更新，卷属性类也会被依据 PV 当前活跃的属性完成设置。&lt;/p&gt;
&lt;!--
### Limitations with the beta

As a beta feature, there are still some features which are planned for GA but not yet
present. The largest is quota support, see the
[KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md)
and discussion in
[sig-storage](https://github.com/kubernetes/community/tree/master/sig-storage) for details.

See the [Kubernetes CSI driver
list](https://kubernetes-csi.github.io/docs/drivers.html) for up-to-date
information of support for this feature in CSI drivers.
--&gt;
&lt;h3 id=&#34;limitations-with-the-beta&#34;&gt;Beta 阶段的限制  &lt;/h3&gt;
&lt;p&gt;作为一个 Beta 特性，仍有一些特性计划在 GA 阶段推出，但尚未实现。最大的限制是配额支持，详见
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md&#34;&gt;KEP&lt;/a&gt;
和 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;sig-storage&lt;/a&gt; 中的讨论。&lt;/p&gt;
&lt;p&gt;有关此特性在 CSI 驱动中的最新支持信息，请参阅 &lt;a href=&#34;https://kubernetes-csi.github.io/docs/drivers.html&#34;&gt;Kubernetes CSI 驱动列表&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.31：通过基于缓存的一致性读加速集群性能</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/15/consistent-read-from-cache-beta/</link>
      <pubDate>Thu, 15 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/15/consistent-read-from-cache-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes v1.31: Accelerating Cluster Performance with Consistent Reads from Cache&#39;
date: 2024-08-15
slug: consistent-read-from-cache-beta
author: &gt;
  Marek Siarkowicz (Google)
-&gt;

&lt;!--
Kubernetes is renowned for its robust orchestration of containerized applications,
but as clusters grow, the demands on the control plane can become a bottleneck.
A key challenge has been ensuring strongly consistent reads from the etcd datastore,
requiring resource-intensive quorum reads.
--&gt;
&lt;p&gt;Kubernetes 以其强大的容器化应用编排能力而闻名，但随着集群规模扩大，
对控制平面的需求可能成为性能瓶颈。其中一个主要挑战是确保从
etcd 数据存储进行强一致性读，这通常需要资源密集型仲裁读取操作。&lt;/p&gt;
&lt;!--
Today, the Kubernetes community is excited to announce a major improvement:
_consistent reads from cache_, graduating to Beta in Kubernetes v1.31.

### Why consistent reads matter
--&gt;
&lt;p&gt;今天，Kubernetes 社区很高兴地宣布一个重大改进：&lt;strong&gt;基于缓存的一致性读&lt;/strong&gt;，
已在 Kubernetes v1.31 中晋升至 Beta 阶段。&lt;/p&gt;
&lt;h3 id=&#34;why-consistent-reads-matter&#34;&gt;为什么一致性读如此重要  &lt;/h3&gt;
&lt;!--
Consistent reads are essential for ensuring that Kubernetes components have an accurate view of the latest cluster state.
Guaranteeing consistent reads is crucial for maintaining the accuracy and reliability of Kubernetes operations,
enabling components to make informed decisions based on up-to-date information.
In large-scale clusters, fetching and processing this data can be a performance bottleneck,
especially for requests that involve filtering results.
--&gt;
&lt;p&gt;一致性读是确保 Kubernetes 组件准确了解最新集群状态的关键。
保证一致性读对于保持 Kubernetes 操作准确性和可靠性至关重要，
使组件能够根据最新信息做出明智决策。
在大型集群中，数据的获取和处理往往会成为性能瓶颈，特别是那些需要过滤结果的请求。&lt;/p&gt;
&lt;!--
While Kubernetes can filter data by namespace directly within etcd,
any other filtering by labels or field selectors requires the entire dataset to be fetched from etcd and then filtered in-memory by the Kubernetes API server.
This is particularly impactful for components like the kubelet,
which only needs to list pods scheduled to its node - but previously required the API Server and etcd to process all pods in the cluster.
--&gt;
&lt;p&gt;虽然 Kubernetes 可以直接在 etcd 中按命名空间过滤数据，但如果按标签或字段选择器过滤，
则需要从 etcd 获取整个数据集，然后由 Kubernetes API 服务器在内存中执行过滤操作。
这对 Kubelet 等组件的影响尤为显著，因为 Kubelet 现在仅需列出调度到其节点的 Pod，
而之前却需要 API 服务器和 etcd 处理集群中所有的 Pod。&lt;/p&gt;
&lt;!--
### The breakthrough: Caching with confidence

Kubernetes has long used a watch cache to optimize read operations.
The watch cache stores a snapshot of the cluster state and receives updates through etcd watches.
However, until now, it couldn&#39;t serve consistent reads directly, as there was no guarantee the cache was sufficiently up-to-date.
--&gt;
&lt;h3 id=&#34;the-breakthrough-Caching-with-confidence&#34;&gt;突破：自信地缓存  &lt;/h3&gt;
&lt;p&gt;Kubernetes 长期以来一直使用监视缓存来优化读取操作。
监视缓存保存集群状态的快照，并通过对 etcd 的监视获取更新。
然而，直到现在,它无法直接支持一致性读，因为没有机制保证缓存是最新的。&lt;/p&gt;
&lt;!--
The _consistent reads from cache_ feature addresses this by leveraging etcd&#39;s
[progress notifications](https://etcd.io/docs/v3.5/dev-guide/interacting_v3/#watch-progress)
mechanism.
These notifications inform the watch cache about how current its data is compared to etcd.
When a consistent read is requested, the system first checks if the watch cache is up-to-date.
--&gt;
&lt;p&gt;&lt;strong&gt;基于缓存的一致性读&lt;/strong&gt; 特性通过使用 etcd 的
&lt;a href=&#34;https://etcd.io/docs/v3.5/dev-guide/interacting_v3/#watch-progress&#34;&gt;进度通知&lt;/a&gt;
机制来解决这一问题。这些通知会向监视缓存说明其数据与 etcd 相比的新旧状态。
当发出一致性读请求时，系统会首先检查监视缓存是否为最新状态。&lt;/p&gt;
&lt;!--
If the cache is not up-to-date, the system queries etcd for progress notifications until it&#39;s confirmed that the cache is sufficiently fresh.
Once ready, the read is efficiently served directly from the cache,
which can significantly improve performance,
particularly in cases where it would require fetching a lot of data from etcd.
This enables requests that filter data to be served from the cache,
with only minimal metadata needing to be read from etcd.
--&gt;
&lt;p&gt;如果缓存未更新到最新状态，系统会通过查询 etcd 的进度通知，直到确认缓存已经足够新。
一旦缓存就绪，读取操作就可以直接从缓存中高效地获取数据，这可以显著提升性能，
尤其是在需要从 etcd 获取大量数据的场景下。这种方式支持通过缓存处理数据过滤请求，
仅需从 etcd 读取少量的元数据。&lt;/p&gt;
&lt;!--
**Important Note:** To benefit from this feature, your Kubernetes cluster must be running etcd version 3.4.31+ or 3.5.13+.
For older etcd versions, Kubernetes will automatically fall back to serving consistent reads directly from etcd.

### Performance gains you&#39;ll notice

This seemingly simple change has a profound impact on Kubernetes performance and scalability:
--&gt;
&lt;p&gt;&lt;strong&gt;重要提示：&lt;/strong&gt; 要享受此特性带来的好处，你的 Kubernetes 集群需运行
etcd 版本 3.4.31+ 或 3.5.13+。对于较早版本的 Etcd，Kubernetes
将自动回退为直接从 etcd 提供一致性读。&lt;/p&gt;
&lt;h3 id=&#34;performance-gains-youll-notice&#34;&gt;你将注意到的性能提升  &lt;/h3&gt;
&lt;p&gt;这个看似简单的改动，对 Kubernetes 的性能和可扩展性有着深远影响:&lt;/p&gt;
&lt;!--
* **Reduced etcd Load:** Kubernetes v1.31 can offload work from etcd,
  freeing up resources for other critical operations.
* **Lower Latency:** Serving reads from cache is significantly faster than fetching
  and processing data from etcd. This translates to quicker responses for components,
  improving overall cluster responsiveness.
* **Improved Scalability:** Large clusters with thousands of nodes and pods will
  see the most significant gains, as the reduction in etcd load allows the
  control plane to handle more requests without sacrificing performance.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;降低 etcd 负载：&lt;/strong&gt; Kubernetes v1.31 可以将部分工作从 etcd 分载出去，
为其他关键操作释放资源。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;更低的延迟：&lt;/strong&gt; 从缓存读取数据的速度显著快于从 etcd 获取并处理数据。
这使组件的响应速度更快，提升了集群整体的响应能力。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;增强的可扩展性：&lt;/strong&gt; 拥有数千个节点和 Pod 的大型集群将获得最显著的性能增益，
因为 etcd 负载的降低使得控制平面可以在不牺牲性能的情况下处理更多请求。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**5k Node Scalability Test Results:** In recent scalability tests on 5,000 node
clusters, enabling consistent reads from cache delivered impressive improvements:

* **30% reduction** in kube-apiserver CPU usage
* **25% reduction** in etcd CPU usage
* **Up to 3x reduction** (from 5 seconds to 1.5 seconds) in 99th percentile pod LIST request latency
--&gt;
&lt;p&gt;&lt;strong&gt;5 千节点扩缩容测试结果：&lt;/strong&gt; 在最近针对 5,000 节点集群的扩缩容测试中，
启用基于缓存的一致性读带来了显著提升：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;kube-apiserver CPU 使用率降低 30%&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;etcd CPU 使用率降低 25%&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;第 99 百分位的 Pod 列表请求延迟出现了高至 3 倍的减少（从 5 秒降至 1.5 秒）&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### What&#39;s next?

With the graduation to beta, consistent reads from cache are enabled by default,
offering a seamless performance boost to all Kubernetes users running a supported
etcd version.

Our journey doesn&#39;t end here. Kubernetes community is actively exploring
pagination support in the watch cache, which will unlock even more performance
optimizations in the future.
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;下一步是什么？  &lt;/h2&gt;
&lt;p&gt;随着基于缓存的一致性读特性晋升至 Beta 版，该特性已默认启用，为所有使用受支持 etcd
版本的 Kubernetes 用户提供了无缝的性能提升。&lt;/p&gt;
&lt;p&gt;我们的探索并未止步于此。Kubernetes 社区正积极研究在监视缓存中加入分页支持，
未来有望带来更多性能优化。&lt;/p&gt;
&lt;!--
### Getting started

Upgrading to Kubernetes v1.31 and ensuring you are using etcd version 3.4.31+ or
3.5.13+ is the easiest way to experience the benefits of consistent reads from
cache.
If you have any questions or feedback, don&#39;t hesitate to reach out to the Kubernetes community.
--&gt;
&lt;h3 id=&#34;getting-started&#34;&gt;开始使用  &lt;/h3&gt;
&lt;p&gt;升级到 Kubernetes v1.31 并确保使用 etcd 版本 3.4.31+ 或 3.5.13+，
是体验基于缓存的一致性读优势的最简单方法。如果有任何问题或反馈，不要犹豫，
随时联系 Kubernetes 社区。&lt;/p&gt;
&lt;!--
**Let us know how** _consistent reads from cache_ **transforms your Kubernetes experience!**

Special thanks to @ah8ad3 and @p0lyn0mial for their contributions to this feature!
--&gt;
&lt;p&gt;请让我们知道&lt;strong&gt;基于缓存的一致性读&lt;/strong&gt;如何改善了你的 Kubernetes 体验！&lt;/p&gt;
&lt;p&gt;特别感谢 @ah8ad3 和 @p0lyn0mial 对这一特性做出的贡献！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.31：对 cgroup v1 的支持转为维护模式</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/14/kubernetes-1-31-moving-cgroup-v1-support-maintenance-mode/</link>
      <pubDate>Wed, 14 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/14/kubernetes-1-31-moving-cgroup-v1-support-maintenance-mode/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.31: Moving cgroup v1 Support into Maintenance Mode&#34;
date: 2024-08-14
slug: kubernetes-1-31-moving-cgroup-v1-support-maintenance-mode
author: Harshal Patil
--&gt;
&lt;!--
As Kubernetes continues to evolve and adapt to the changing landscape of
container orchestration, the community has decided to move cgroup v1 support
into [maintenance mode](#what-does-maintenance-mode-mean) in v1.31.
This shift aligns with the broader industry&#39;s move towards cgroup v2, offering
improved functionalities: including scalability and a more consistent interface.
Before we dive into the consequences for Kubernetes, let&#39;s take a step back to
understand what cgroups are and their significance in Linux.
--&gt;
&lt;p&gt;随着 Kubernetes 不断发展，为了适应容器编排全景图的变化，社区决定在 v1.31 中将对 cgroup v1
的支持转为&lt;a href=&#34;#what-does-maintenance-mode-mean&#34;&gt;维护模式&lt;/a&gt;。
这一转变与行业更广泛地向 cgroup v2 的迁移保持一致，后者的功能更强，
包括可扩展性和更加一致的接口。在我们深入探讨对 Kubernetes 的影响之前，
先回顾一下 cgroup 的概念及其在 Linux 中的重要意义。&lt;/p&gt;
&lt;!--
## Understanding cgroups

[Control groups](https://man7.org/linux/man-pages/man7/cgroups.7.html), or
cgroups, are a Linux kernel feature that allows the allocation, prioritization,
denial, and management of system resources (such as CPU, memory, disk I/O,
and network bandwidth) among processes. This functionality is crucial for
maintaining system performance and ensuring that no single process can
monopolize system resources, which is especially important in multi-tenant
environments.
--&gt;
&lt;h2 id=&#34;understanding-cgroups&#34;&gt;理解 cgroup  &lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://man7.org/linux/man-pages/man7/cgroups.7.html&#34;&gt;控制组（Control Group）&lt;/a&gt;也称为 cgroup，
是 Linux 内核的一项特性，允许在进程之间分配、划分优先级、拒绝和管理系统资源（如 CPU、内存、磁盘 I/O 和网络带宽）。
这一功能对于维护系统性能至关重要，确保没有单个进程能够垄断系统资源，这在多租户环境中尤其重要。&lt;/p&gt;
&lt;!--
There are two versions of cgroups:
[v1](https://docs.kernel.org/admin-guide/cgroup-v1/index.html) and
[v2](https://docs.kernel.org/admin-guide/cgroup-v2.html). While cgroup v1
provided sufficient capabilities for resource management, it had limitations
that led to the development of cgroup v2. Cgroup v2 offers a more unified and
consistent interface, on top of better resource control features.
--&gt;
&lt;p&gt;cgroup 有两个版本：
&lt;a href=&#34;https://docs.kernel.org/admin-guide/cgroup-v1/index.html&#34;&gt;v1&lt;/a&gt; 和
&lt;a href=&#34;https://docs.kernel.org/admin-guide/cgroup-v2.html&#34;&gt;v2&lt;/a&gt;。
虽然 cgroup v1 提供了足够的资源管理能力，但其局限性促使了 cgroup v2 的开发。
cgroup v2 在更好的资源控制特性之外提供了更统一且更一致的接口。&lt;/p&gt;
&lt;!--
## Cgroups in Kubernetes

For Linux nodes, Kubernetes relies heavily on cgroups to manage and isolate the
resources consumed by containers running in pods. Each container in Kubernetes
is placed in its own cgroup, which allows Kubernetes to enforce resource limits,
monitor usage, and ensure fair resource distribution among all containers.
--&gt;
&lt;h2 id=&#34;kubernetes-中的-cgroup&#34;&gt;Kubernetes 中的 cgroup&lt;/h2&gt;
&lt;p&gt;对于 Linux 节点，Kubernetes 在管理和隔离 Pod 中运行的容器所消耗的资源方面高度依赖 cgroup。
Kubernetes 中的每个容器都放在其自己的 cgroup 中，这使得 Kubernetes 能够强制执行资源限制、
监控使用情况并确保所有容器之间的资源公平分配。&lt;/p&gt;
&lt;!--
### How Kubernetes uses cgroups

**Resource Allocation**
: Ensures that containers do not exceed their allocated CPU and memory limits.

**Isolation**
: Isolates containers from each other to prevent resource contention.

**Monitoring**
: Tracks resource usage for each container to provide insights and metrics.
--&gt;
&lt;h3 id=&#34;how-kubernetes-uses-cgroups&#34;&gt;Kubernetes 如何使用 cgroup  &lt;/h3&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;strong&gt;资源分配&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;确保容器不超过其分配的 CPU 和内存限制。&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;隔离&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;将容器相互隔离，防止资源争用。&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;监控&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;跟踪每个容器的资源使用情况，以提供洞察数据和指标。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
## Transitioning to Cgroup v2

The Linux community has been focusing on cgroup v2 for new features and
improvements. Major Linux distributions and projects like
[systemd](https://systemd.io/) are
[transitioning](https://github.com/systemd/systemd/issues/30852) towards cgroup v2.
Using cgroup v2 provides several benefits over cgroupv1, such as Unified Hierarchy,
Improved Interface, Better Resource Control,
[cgroup aware OOM killer](https://github.com/kubernetes/kubernetes/pull/117793),
[rootless support](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless/README.md#cgroup) etc.
--&gt;
&lt;h2 id=&#34;transitioning-to-cgroup-v2&#34;&gt;向 cgroup v2 过渡  &lt;/h2&gt;
&lt;p&gt;Linux 社区一直在聚焦于为 cgroup v2 提供新特性和各项改进。
主要的 Linux 发行版和像 &lt;a href=&#34;https://systemd.io/&#34;&gt;systemd&lt;/a&gt;
这样的项目正在&lt;a href=&#34;https://github.com/systemd/systemd/issues/30852&#34;&gt;过渡&lt;/a&gt;到 cgroup v2。
使用 cgroup v2 相较于使用 cgroup v1 提供了多个好处，例如统一的层次结构、改进的接口、更好的资源控制，
以及 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/117793&#34;&gt;cgroup 感知的 OOM 杀手&lt;/a&gt;、
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless/README.md#cgroup&#34;&gt;非 root 支持&lt;/a&gt;等。&lt;/p&gt;
&lt;!--
Given these advantages, Kubernetes is also making the move to embrace cgroup
v2 more fully. However, this transition needs to be handled carefully to avoid
disrupting existing workloads and to provide a smooth migration path for users.

## Moving cgroup v1 support into maintenance mode

### What does maintenance mode mean?

When cgroup v1 is placed into maintenance mode in Kubernetes, it means that:
--&gt;
&lt;p&gt;鉴于这些优势，Kubernetes 也正在更全面地转向 cgroup v2。然而，
这一过渡需要谨慎处理，以避免干扰现有的工作负载，并为用户提供平滑的迁移路径。&lt;/p&gt;
&lt;h2 id=&#34;moving-cgroup-v1-support-into-maintenance-mode&#34;&gt;对 cgroup v1 的支持转入维护模式  &lt;/h2&gt;
&lt;h3 id=&#34;what-does-maintenance-mode-mean&#34;&gt;维护模式意味着什么？  &lt;/h3&gt;
&lt;p&gt;当 cgroup v1 在 Kubernetes 中被置于维护模式时，这意味着：&lt;/p&gt;
&lt;!--
1. **Feature Freeze**: No new features will be added to cgroup v1 support.
2. **Security Fixes**: Critical security fixes will still be provided.
3. **Best-Effort Bug Fixes**: Major bugs may be fixed if feasible, but some
issues might remain unresolved.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;特性冻结&lt;/strong&gt;：不会再向 cgroup v1 添加新特性。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;安全修复&lt;/strong&gt;：仍将提供关键的安全修复。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;尽力而为的 Bug 修复&lt;/strong&gt;：在可行的情况下可能会修复重大 Bug，但某些问题可能保持未解决。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### Why move to maintenance mode?

The move to maintenance mode is driven by the need to stay in line with the
broader ecosystem and to encourage the adoption of cgroup v2, which offers
better performance, security, and usability. By transitioning cgroup v1 to
maintenance mode, Kubernetes can focus on enhancing support for cgroup v2
and ensure it meets the needs of modern workloads. It&#39;s important to note
that maintenance mode does not mean deprecation; cgroup v1 will continue to
receive critical security fixes and major bug fixes as needed.
--&gt;
&lt;h3 id=&#34;why-move-to-maintenance-mode&#34;&gt;为什么要转入维护模式？  &lt;/h3&gt;
&lt;p&gt;转入维护模式的原因是为了与更广泛的生态体系保持一致，也为了鼓励采用 cgroup v2，后者提供了更好的性能、安全性和可用性。
通过将 cgroup v1 转入维护模式，Kubernetes 可以专注于增强对 cgroup v2 的支持，并确保其满足现代工作负载的需求。
需要注意的是，维护模式并不意味着弃用；cgroup v1 将继续按需进行关键的安全修复和重大 Bug 修复。&lt;/p&gt;
&lt;!--
## What this means for cluster administrators

Users currently relying on cgroup v1 are highly encouraged to plan for the
transition to cgroup v2. This transition involves:

1. **Upgrading Systems**: Ensuring that the underlying operating systems and
container runtimes support cgroup v2.
2. **Testing Workloads**: Verifying that workloads and applications function
correctly with cgroup v2.
--&gt;
&lt;h2 id=&#34;what-this-means-for-cluster-administrators&#34;&gt;这对集群管理员意味着什么  &lt;/h2&gt;
&lt;p&gt;目前强烈鼓励那些依赖 cgroup v1 的用户做好向 cgroup v2 过渡的计划。这一过渡涉及：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;升级系统&lt;/strong&gt;：确保底层操作系统和容器运行时支持 cgroup v2。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;测试工作负载&lt;/strong&gt;：验证工作负载和应用程序在 cgroup v2 下正常工作。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Further reading

- [Linux cgroups](https://man7.org/linux/man-pages/man7/cgroups.7.html)
- [Cgroup v2 in Kubernetes](/docs/concepts/architecture/cgroups/)
- [Kubernetes 1.25: cgroup v2 graduates to GA](/blog/2022/08/31/cgroupv2-ga-1-25/)
--&gt;
&lt;h2 id=&#34;further-reading&#34;&gt;进一步阅读  &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://man7.org/linux/man-pages/man7/cgroups.7.html&#34;&gt;Linux cgroup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cgroups/&#34;&gt;Kubernetes 中的 cgroup v2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2022/08/31/cgroupv2-ga-1-25/&#34;&gt;Kubernetes 1.25：cgroup v2 进阶至 GA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.31: PersistentVolume 的最后阶段转换时间进阶到 GA</title>
      <link>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/14/last-phase-transition-time-ga/</link>
      <pubDate>Wed, 14 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/14/last-phase-transition-time-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.31: PersistentVolume Last Phase Transition Time Moves to GA&#34;
date: 2024-08-14
slug: last-phase-transition-time-ga
author: &gt;
  Roman Bednář (Red Hat)
--&gt;
&lt;!--
Announcing the graduation to General Availability (GA) of the PersistentVolume `lastTransitionTime` status
field, in Kubernetes v1.31!

The Kubernetes SIG Storage team is excited to announce that the &#34;PersistentVolumeLastPhaseTransitionTime&#34; feature, introduced
as an alpha in Kubernetes v1.28, has now reached GA status and is officially part of the Kubernetes v1.31 release. This enhancement
helps Kubernetes users understand when a [PersistentVolume](/docs/concepts/storage/persistent-volumes/) transitions between 
different phases, allowing for more efficient and informed resource management.
--&gt;
&lt;p&gt;现在宣布 PersistentVolume 的 &lt;code&gt;lastTransitionTime&lt;/code&gt; 状态字段在 Kubernetes v1.31
版本进阶至正式发布（GA）！&lt;/p&gt;
&lt;p&gt;Kubernetes SIG Storage 团队很高兴地宣布，&amp;quot;PersistentVolumeLastPhaseTransitionTime&amp;quot;
特性自 Kubernetes v1.28 作为 Alpha 版本引入以来，现已进阶至正式发布（GA），并正式成为
Kubernetes v1.31 版本的一部分。该功能帮助 Kubernetes 用户增强对
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;PersistentVolume&lt;/a&gt;
在不同阶段之间转换的理解，从而实现更高效和更明智的资源管理。&lt;/p&gt;
&lt;!--
For a v1.31 cluster, you can now assume that every PersistentVolume object has a
`.status.lastTransitionTime` field, that holds a timestamp of
when the volume last transitioned its phase. This change is not immediate; the new field will be populated whenever a PersistentVolume
is updated and first transitions between phases (`Pending`, `Bound`, or `Released`) after upgrading to Kubernetes v1.31.
--&gt;
&lt;p&gt;在 v1.31 集群中，你可以默认每个 PersistentVolume 对象都包含
&lt;code&gt;.status.lastTransitionTime&lt;/code&gt; 字段，该字段记录存储卷最近一次发生阶段转换时的时间戳。
该更改不会立刻生效，而是在升级到 Kubernetes v1.31 后，当 PersistentVolume
发生更新并首次在（&lt;code&gt;Pending&lt;/code&gt;、&lt;code&gt;Bound&lt;/code&gt; 或 &lt;code&gt;Released&lt;/code&gt;）这几个阶段之间进行转换时，
才会填充该字段。&lt;/p&gt;
&lt;!--
## What changed?

The API strategy for updating PersistentVolume objects has been modified to populate the `.status.lastTransitionTime` field with the
current timestamp whenever a PersistentVolume transitions phases. Users are allowed to set this field manually if needed, but it will
be overwritten when the PersistentVolume transitions phases again.
--&gt;
&lt;h2 id=&#34;what-changed&#34;&gt;有什么变化？ &lt;/h2&gt;
&lt;p&gt;更新 PersistentVolume 对象的 API 策略已经被修改，
当存储卷转换阶段时会自动填充当前时间戳到 &lt;code&gt;.status.lastTransitionTime&lt;/code&gt; 字段。
如果需要，用户可以手动设置该字段，但当 PersistentVolume
再次转换阶段时，该字段会被新时间戳覆盖。&lt;/p&gt;
&lt;!--
For more details, read about
[Phase transition timestamp](/docs/concepts/storage/persistent-volumes/#phase-transition-timestamp) in the Kubernetes documentation.
You can also read the previous [blog post](/blog/2023/10/23/persistent-volume-last-phase-transition-time) announcing the feature as alpha in v1.28.
--&gt;
&lt;p&gt;想了解更多信息，可以查阅 Kubernetes 文档中的
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#phase-transition-timestamp&#34;&gt;阶段转换时间戳&lt;/a&gt;。
你还可以阅读此前的
&lt;a href=&#34;https://deploy-preview-55276--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/23/persistent-volume-last-phase-transition-time&#34;&gt;博客文章&lt;/a&gt;，
该文章介绍了此特性在 v1.28 版本中作为 Alpha 版本发布的情况。&lt;/p&gt;
&lt;!--
To provide feedback, join our [Kubernetes Storage Special-Interest-Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG)
or participate in discussions on our [public Slack channel](https://app.slack.com/client/T09NY5SBT/C09QZFCE5).
--&gt;
&lt;p&gt;要提供反馈，请加入我们的
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes 存储特别兴趣小组&lt;/a&gt; (SIG)
或参与&lt;a href=&#34;https://app.slack.com/client/T09NY5SBT/C09QZFCE5&#34;&gt;公共 Slack 频道&lt;/a&gt;上的讨论。&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
