<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kubernetes Blog</title>
    <link>https://deploy-preview-50011--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-50011--kubernetes-io-main-staging.netlify.app/zh-cn/</link>
    </image>
    
    <atom:link href="https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/feed.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>kube-proxy 的 NFTables 模式</title>
      <link>https://deploy-preview-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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>聚焦 SIG Architecture: Enhancements</title>
      <link>https://deploy-preview-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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：内存管理器进阶至 GA</title>
      <link>https://deploy-preview-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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-50011--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: Elli</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/13/kubernetes-v1-31-release/</link>
      <pubDate>Tue, 13 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/13/kubernetes-v1-31-release/</guid>
      <description>
        
        
        &lt;!--
---
layout: blog
title: &#39;Kubernetes v1.31: Elli&#39;
date: 2024-08-13
slug: kubernetes-v1-31-release
author: &gt;
  [Kubernetes v1.31 Release Team](https://github.com/kubernetes/sig-release/blob/master/releases/release-1.31/release-team.md)
---
--&gt;
&lt;!--
**Editors:** Matteo Bianchi, Yigit Demirbas, Abigail McCarthy, Edith Puclla, Rashan Smith

Announcing the release of Kubernetes v1.31: Elli!

Similar to previous releases, the release of Kubernetes v1.31 introduces new
stable, beta, and alpha features. 
The consistent delivery of high-quality releases underscores the strength of our development cycle and the vibrant support from our community.
This release consists of 45 enhancements.
Of those enhancements, 11 have graduated to Stable, 22 are entering Beta, 
and 12 have graduated to Alpha.
--&gt;
&lt;p&gt;&lt;strong&gt;编辑:&lt;/strong&gt; Matteo Bianchi, Yigit Demirbas, Abigail McCarthy, Edith Puclla, Rashan Smith&lt;/p&gt;
&lt;p&gt;Kubernetes v1.31：Elli 宣布发布！&lt;/p&gt;
&lt;p&gt;与之前的版本类似，Kubernetes v1.31 的发布中引入了新的稳定版、Beta 版和 Alpha 特性功能。
持续提供高质量的版本彰显了我们开发周期的强劲实力以及社区的大力支持。
此版本包含 45 项增强功能。
在这些增强功能中，11 项已升级到稳定版，22 项正在进入 Beta 版，12 项已升级到 Alpha 版。&lt;/p&gt;
&lt;!--
## Release theme and logo
--&gt;
&lt;h2 id=&#34;发布主题和-logo&#34;&gt;发布主题和 logo&lt;/h2&gt;


&lt;figure class=&#34;release-logo &#34;&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/images/blog/2024-08-13-kubernetes-1.31-release/k8s-1.31.png&#34;
         alt=&#34;Kubernetes v1.31 Elli logo&#34;/&gt; 
&lt;/figure&gt;
&lt;!--
The Kubernetes v1.31 Release Theme is &#34;Elli&#34;.

Kubernetes v1.31&#39;s Elli is a cute and joyful dog, with a heart of gold and a nice sailor&#39;s cap, as a playful wink to the huge and diverse family of Kubernetes contributors.
--&gt;
&lt;p&gt;Kubernetes v1.31 的发布主题是 &amp;quot;Elli&amp;quot;。&lt;/p&gt;
&lt;p&gt;Kubernetes v1.31 的 Elli 是一只可爱欢快的小狗，戴着一顶漂亮的水手帽，这是对庞大而多样化的 Kubernetes 贡献者家族的一个俏皮致意。&lt;/p&gt;
&lt;!--
Kubernetes v1.31 marks the first release after the project has successfully celebrated [its first 10 years](/blog/2024/06/06/10-years-of-kubernetes/). 
Kubernetes has come a very long way since its inception, and it&#39;s still moving towards exciting new directions with each release. 
After 10 years, it is awe-inspiring to reflect on the effort, dedication, skill, wit and tiring work of the countless Kubernetes contributors who have made this a reality.
--&gt;
&lt;p&gt;Kubernetes v1.31 标志着该项目成功庆祝其&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2024/06/06/10-years-of-kubernetes/&#34;&gt;诞生十周年&lt;/a&gt;后的首次发布。
自诞生以来，Kubernetes 已经走过了漫长的道路，并且每次发布都在朝着令人兴奋的新方向前进。
十年后，回顾无数 Kubernetes 贡献者为实现这一目标所付出的努力、奉献、技能、智慧和辛勤工作，令人敬畏。&lt;/p&gt;
&lt;!--
And yet, despite the herculean effort needed to run the project, there is no shortage of people who show up, time and again, with enthusiasm, smiles and a sense of pride for contributing and being part of the community. 
This &#34;spirit&#34; that we see from new and old contributors alike is the sign of a vibrant community, a &#34;joyful&#34; community, if we might call it that.
--&gt;
&lt;p&gt;还有，尽管运营项目需要付出巨大的努力，仍然有大量的人不断以热情、微笑和自豪感出现，为社区做出贡献并成为其中的一员。
我们从新老贡献者那里看到的这种&amp;quot;精神&amp;quot;是一个充满活力的社区的标志，我们可以称之为&amp;quot;欢乐&amp;quot;的社区。&lt;/p&gt;
&lt;!--
Kubernetes v1.31&#39;s Elli is all about celebrating this wonderful spirit! Here&#39;s to the next decade of Kubernetes!
--&gt;
&lt;p&gt;Kubernetes v1.31 的 Elli 就是为了庆祝这种美好的精神!让我们为 Kubernetes 的下一个十年干杯!&lt;/p&gt;
&lt;!--
## Highlights of features graduating to Stable

_This is a selection of some of the improvements that are now stable following the v1.31 release._
--&gt;
&lt;h2 id=&#34;晋级为稳定版的功能亮点&#34;&gt;晋级为稳定版的功能亮点&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;以下是 v1.31 发布后晋级为稳定版的部分改进。&lt;/em&gt;&lt;/p&gt;
&lt;!--
### AppArmor support is now stable
--&gt;
&lt;h3 id=&#34;apparmor-支持现已稳定&#34;&gt;AppArmor 支持现已稳定&lt;/h3&gt;
&lt;!--
Kubernetes support for AppArmor is now GA. Protect your containers using AppArmor by setting the `appArmorProfile.type` field in the container&#39;s `securityContext`. 
Note that before Kubernetes v1.30, AppArmor was controlled via annotations; starting in v1.30 it is controlled using fields. 
It is recommended that you should migrate away from using annotations and start using the `appArmorProfile.type` field.
--&gt;
&lt;p&gt;Kubernetes 对 AppArmor 的支持现已正式发布。通过在容器的 &lt;code&gt;securityContext&lt;/code&gt; 中设置 &lt;code&gt;appArmorProfile.type&lt;/code&gt; 字段，可以使用 AppArmor 保护您的容器。
请注意，在 Kubernetes v1.30 之前，AppArmor 是通过注解控制的；从 v1.30 开始，它是通过字段控制的。
建议您停止使用注解，开始使用 &lt;code&gt;appArmorProfile.type&lt;/code&gt; 字段。&lt;/p&gt;
&lt;!--
To learn more read the [AppArmor tutorial](/docs/tutorials/security/apparmor/). 
This work was done as a part of [KEP #24](https://github.com/kubernetes/enhancements/issues/24), by [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node).
--&gt;
&lt;p&gt;要了解更多信息，请阅读 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tutorials/security/apparmor/&#34;&gt;AppArmor 教程&lt;/a&gt;。
这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/24&#34;&gt;KEP #24&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;SIG Node&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Improved ingress connectivity reliability for kube-proxy
--&gt;
&lt;h3 id=&#34;改进-kube-proxy-的入站连接可靠性&#34;&gt;改进 kube-proxy 的入站连接可靠性&lt;/h3&gt;
&lt;!--
Kube-proxy improved ingress connectivity reliability is stable in v1.31. 
One of the common problems with load balancers in Kubernetes is the synchronization between the different components involved to avoid traffic drop. 
This feature implements a mechanism in kube-proxy for load balancers to do connection draining for terminating Nodes exposed by services of `type: LoadBalancer` and `externalTrafficPolicy: Cluster` and establish some best practices for cloud providers and Kubernetes load balancers implementations.
--&gt;
&lt;p&gt;kube-proxy 改进的入站连接可靠性在 v1.31 中已稳定。
Kubernetes 中负载均衡器的一个常见问题是为避免流量丢失而在不同组件之间进行同步的机制。
此特性在 kube-proxy 中实现了一种机制，用于负载均衡器对 &lt;code&gt;type: LoadBalancer&lt;/code&gt; 和 &lt;code&gt;externalTrafficPolicy: Cluster&lt;/code&gt;
服务所公开的、进入终止进程的 Node 进行连接排空，并为云提供商和 Kubernetes 负载均衡器实现建立了一些最佳实践。&lt;/p&gt;
&lt;!--
To use this feature, kube-proxy needs to run as default service proxy on the cluster and the load balancer needs to support connection draining. 
There are no specific changes required for using this feature, it has been enabled by default in kube-proxy since v1.30 and been promoted to stable in v1.31.
--&gt;
&lt;p&gt;要使用此特性，kube-proxy 需要在集群上作为默认服务代理运行，并且负载均衡器需要支持连接排空。
使用此特性不需要进行特定的更改，它自 v1.30 以来在 kube-proxy 中默认启用，并在 v1.31 中晋级为稳定版。&lt;/p&gt;
&lt;!--
For more details about this feature please visit the [Virtual IPs and Service Proxies documentation page](/docs/reference/networking/virtual-ips/#external-traffic-policy).
--&gt;
&lt;p&gt;有关此特性的更多详细信息，请访问&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/networking/virtual-ips/#external-traffic-policy&#34;&gt;虚拟 IP 和服务代理文档页面&lt;/a&gt;。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #3836](https://github.com/kubernetes/enhancements/issues/3836) by [SIG Network](https://github.com/kubernetes/community/tree/master/sig-network).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3836&#34;&gt;KEP #3836&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-network&#34;&gt;SIG Network&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Persistent Volume last phase transition time
--&gt;
&lt;h3 id=&#34;持久卷最近阶段转换时间&#34;&gt;持久卷最近阶段转换时间&lt;/h3&gt;
&lt;!--
Persistent Volume last phase transition time feature moved to GA in v1.31. 
This feature adds a `PersistentVolumeStatus` field which holds a timestamp of when a PersistentVolume last transitioned to a different phase.
With this feature enabled, every PersistentVolume object will have a new field `.status.lastTransitionTime`, 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.
This allows you to measure time between when a PersistentVolume moves from `Pending` to `Bound`. This can be also useful for providing metrics and SLOs.
--&gt;
&lt;p&gt;持久卷最近阶段转换时间功能在 v1.31 中晋级为正式版（GA）。
此特性添加了一个 &lt;code&gt;PersistentVolumeStatus&lt;/code&gt; 字段，用于保存 PersistentVolume 最近转换到不同阶段的时间戳。
启用此特性后，每个 PersistentVolume 对象将有一个新字段 &lt;code&gt;.status.lastTransitionTime&lt;/code&gt; 保存卷最近转换阶段的时间戳。
这种变化并不是立即的；新字段将在 PersistentVolume 更新并在升级到 Kubernetes v1.31 后首次在各阶段（&lt;code&gt;Pending&lt;/code&gt;、&lt;code&gt;Bound&lt;/code&gt; 或 &lt;code&gt;Released&lt;/code&gt;）之间转换时填充。
这允许您测量 PersistentVolume 从 &lt;code&gt;Pending&lt;/code&gt; 移动到 &lt;code&gt;Bound&lt;/code&gt; 之间的时间。这对于提供指标和 SLO 也很有用。&lt;/p&gt;
&lt;!--
For more details about this feature please visit the [PersistentVolume documentation page](/docs/concepts/storage/persistent-volumes/).
--&gt;
&lt;p&gt;有关此特性的更多详细信息，请访问 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;PersistentVolume 文档页面&lt;/a&gt;。&lt;/p&gt;
&lt;!--

his work was done as a part of [KEP #3762](https://github.com/kubernetes/enhancements/issues/3762) by [SIG Storage](https://github.com/kubernetes/community/tree/master/sig-storage).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3762&#34;&gt;KEP #3762&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;!--
## Highlights of features graduating to Beta
--&gt;
&lt;h2 id=&#34;晋级为-beta-版的功能亮点&#34;&gt;晋级为 Beta 版的功能亮点&lt;/h2&gt;
&lt;!--
_This is a selection of some of the improvements that are now beta following the v1.31 release._
--&gt;
&lt;p&gt;&lt;em&gt;以下是 v1.31 发布后晋级为 Beta 版的部分改进。&lt;/em&gt;&lt;/p&gt;
&lt;!--
### nftables backend for kube-proxy
--&gt;
&lt;h3 id=&#34;kube-proxy-的-nftables-后端&#34;&gt;kube-proxy 的 nftables 后端&lt;/h3&gt;
&lt;!--
The nftables backend moves to beta in v1.31, behind the `NFTablesProxyMode` feature gate which is now enabled by default.
--&gt;
&lt;p&gt;nftables 后端在 v1.31 中晋级为 Beta 版，由 &lt;code&gt;NFTablesProxyMode&lt;/code&gt; 特性门控控制，现在默认启用。&lt;/p&gt;
&lt;!--
The nftables API is the successor to the iptables API and is designed to provide better performance and scalability than iptables. 
The `nftables` proxy mode is able to process changes to service endpoints faster and more efficiently than the `iptables` mode, and is also able to more efficiently process packets in the kernel (though this only
becomes noticeable in clusters with tens of thousands of services).
--&gt;
&lt;p&gt;nftables API 是 iptables API 的继任者，旨在提供比 iptables 更好的性能和可扩展性。
&lt;code&gt;nftables&lt;/code&gt; 代理模式能够比 &lt;code&gt;iptables&lt;/code&gt; 模式更快、更高效地处理服务端点的变化，并且在内核中也能更高效地处理数据包（尽管这只有在拥有数万个服务的集群中才会显著）。&lt;/p&gt;
&lt;!--
As of Kubernetes v1.31, the `nftables` mode is still relatively new, and may not be compatible with all network plugins; consult the documentation for your network plugin. 
This proxy mode is only available on Linux nodes, and requires kernel 5.13 or later.
Before migrating, note that some features, especially around NodePort services, are not implemented exactly the same in nftables mode as they are in iptables mode. 
Check the [migration guide](/docs/reference/networking/virtual-ips/#migrating-from-iptables-mode-to-nftables) to see if you need to override the default configuration.
--&gt;
&lt;p&gt;截至 Kubernetes v1.31，nftables 模式仍相对较新，可能与某些网络插件不兼容；请查阅您的网络插件文档。
此代理模式仅在 Linux 节点上可用，并且需要内核 5.13 或更高版本。
在迁移之前，请注意某些功能，特别是与 NodePort 服务相关的功能，在 nftables 模式下的实现方式与 iptables 模式不完全相同。
查看&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/networking/virtual-ips/#migrating-from-iptables-mode-to-nftables&#34;&gt;迁移指南&lt;/a&gt;以了解是否需要覆盖默认配置。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #3866](https://github.com/kubernetes/enhancements/issues/3866) by [SIG Network](https://github.com/kubernetes/community/tree/master/sig-network).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3866&#34;&gt;KEP #3866&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-network&#34;&gt;SIG Network&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Changes to reclaim policy for PersistentVolumes
--&gt;
&lt;h3 id=&#34;persistentvolumes-回收策略的变更&#34;&gt;PersistentVolumes 回收策略的变更&lt;/h3&gt;
&lt;!--
The Always Honor PersistentVolume Reclaim Policy feature has advanced to beta in Kubernetes v1.31. 
This enhancement ensures that the PersistentVolume (PV) reclaim policy is respected even after the associated PersistentVolumeClaim (PVC) is deleted, thereby preventing the leakage of volumes.
--&gt;
&lt;p&gt;始终遵循 PersistentVolume 回收策略这一特性在 Kubernetes v1.31 中晋级为 Beta 版。
这项增强确保即使在所关联的 PersistentVolumeClaim (PVC) 被删除后，PersistentVolume (PV) 回收策略也会被遵循，从而防止卷的泄漏。&lt;/p&gt;
&lt;!--
Prior to this feature, the reclaim policy linked to a PV could be disregarded under specific conditions, depending on whether the PV or PVC was deleted first. 
Consequently, the corresponding storage resource in the external infrastructure might not be removed, even if the reclaim policy was set to &#34;Delete&#34;. 
This led to potential inconsistencies and resource leaks.
--&gt;
&lt;p&gt;在此特性之前，与 PV 相关联的回收策略可能在特定条件下被忽视，这取决于 PV 或 PVC 是否先被删除。
因此，即使回收策略设置为 &amp;quot;Delete&amp;quot;，外部基础设施中相应的存储资源也可能不会被删除。
这导致了潜在的不一致性和资源泄漏。&lt;/p&gt;
&lt;!--
With the introduction of this feature, Kubernetes now guarantees that the &#34;Delete&#34; reclaim policy will be enforced, ensuring the deletion of the underlying storage object from the backend infrastructure, regardless of the deletion sequence of the PV and PVC.
--&gt;
&lt;p&gt;随着这项功能的引入，Kubernetes 现在保证 &amp;quot;Delete&amp;quot; 回收策略将被执行，确保底层存储对象从后端基础设施中删除，无论 PV 和 PVC 的删除顺序如何。&lt;/p&gt;
&lt;!--
This work was done as a part of [KEP #2644](https://github.com/kubernetes/enhancements/issues/2644) and by [SIG Storage](https://github.com/kubernetes/community/tree/master/sig-storage).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/2644&#34;&gt;KEP #2644&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;!--
### Bound service account token improvements
--&gt;
&lt;h3 id=&#34;绑定服务账户令牌的改进&#34;&gt;绑定服务账户令牌的改进&lt;/h3&gt;
&lt;!--
The `ServiceAccountTokenNodeBinding` feature is promoted to beta in v1.31. 
This feature allows requesting a token bound only to a node, not to a pod, which includes node information in claims in the token and validates the existence of the node when the token is used. 
For more information, read the [bound service account tokens documentation](/docs/reference/access-authn-authz/service-accounts-admin/#bound-service-account-tokens).
--&gt;
&lt;p&gt;&lt;code&gt;ServiceAccountTokenNodeBinding&lt;/code&gt; 功能在 v1.31 中晋级为 Beta 版。
此特性允许请求仅绑定到节点而不是 Pod 的令牌，在令牌中包含节点信息的声明，并在使用令牌时验证节点的存在。
有关更多信息，请阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/service-accounts-admin/#bound-service-account-tokens&#34;&gt;绑定服务账户令牌文档&lt;/a&gt;。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4193](https://github.com/kubernetes/enhancements/issues/4193) by [SIG Auth](https://github.com/kubernetes/community/tree/master/sig-auth).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4193&#34;&gt;KEP #4193&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-auth&#34;&gt;SIG Auth&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Multiple Service CIDRs
--&gt;
&lt;h3 id=&#34;多个-service-cidr&#34;&gt;多个 Service CIDR&lt;/h3&gt;
&lt;!--
Support for clusters with multiple Service CIDRs moves to beta in v1.31 (disabled by default).
--&gt;
&lt;p&gt;支持具有多个服务 CIDR 的集群在 v1.31 中晋级为 Beta 版(默认禁用)。&lt;/p&gt;
&lt;!--
There are multiple components in a Kubernetes cluster that consume IP addresses: Nodes, Pods and Services. 
Nodes and Pods IP ranges can be dynamically changed because depend on the infrastructure or the network plugin respectively. 
However, Services IP ranges are defined during the cluster creation as a hardcoded flag in the kube-apiserver. 
IP exhaustion has been a problem for long lived or large clusters, as admins needed to expand, shrink or even replace entirely the assigned Service CIDR range. 
These operations were never supported natively and were performed via complex and delicate maintenance operations, often causing downtime on their clusters. This new feature allows users and cluster admins to dynamically modify Service CIDR ranges with zero downtime.
--&gt;
&lt;p&gt;Kubernetes 集群中有多个组件消耗 IP 地址: Node、Pod 和 Service。
Node 和 Pod 的 IP 范围可以动态更改，因为它们分别取决于基础设施或网络插件。
然而，Service IP 范围是在集群创建期间作为 kube-apiserver 中的硬编码标志定义的。
IP 耗尽一直是长期存在或大型集群的问题，因为管理员需要扩展、缩小甚至完全替换分配的服务 CIDR 范围。
这些操作从未得到原生支持，并且是通过复杂和精细的维护操作执行的，经常导致集群无法正常服务。
这个新特性允许用户和集群管理员以零中断时间动态修改服务 CIDR 范围。&lt;/p&gt;
&lt;!--
For more details about this feature please visit the
[Virtual IPs and Service Proxies](/docs/reference/networking/virtual-ips/#ip-address-objects) documentation page.
--&gt;
&lt;p&gt;有关此特性的更多详细信息，请访问&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/networking/virtual-ips/#ip-address-objects&#34;&gt;虚拟 IP 和服务代理&lt;/a&gt;文档页面。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #1880](https://github.com/kubernetes/enhancements/issues/1880) by [SIG Network](https://github.com/kubernetes/community/tree/master/sig-network).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/1880&#34;&gt;KEP #1880&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-network&#34;&gt;SIG Network&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Traffic distribution for Services
--&gt;
&lt;h3 id=&#34;service-的流量分配&#34;&gt;Service 的流量分配&lt;/h3&gt;
&lt;!--
Traffic distribution for Services moves to beta in v1.31 and is enabled by default. 
--&gt;
&lt;p&gt;Service 的流量分配在 v1.31 中晋级为 Beta 版，并默认启用。&lt;/p&gt;
&lt;!--
After several iterations on finding the best user experience and traffic engineering capabilities for Services networking, SIG Networking implemented the `trafficDistribution` field in the Service specification, which serves as a guideline for the underlying implementation to consider while making routing decisions.
--&gt;
&lt;p&gt;为实现 Service 联网的最佳用户体验和流量工程能力，经过多次迭代后，SIG Networking 在服务规约中实现了
&lt;code&gt;trafficDistribution&lt;/code&gt; 字段，作为底层实现在做出路由决策时考虑的指导原则。&lt;/p&gt;
&lt;!--
For more details about this feature please read the
[1.30 Release Blog](/blog/2024/04/17/kubernetes-v1-30-release/#traffic-distribution-for-services-sig-network-https-github-com-kubernetes-community-tree-master-sig-network)
or visit the [Service](/docs/concepts/services-networking/service/#traffic-distribution) documentation page.
--&gt;
&lt;p&gt;有关此特性的更多详细信息，请阅读 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2024/04/17/kubernetes-v1-30-release/#traffic-distribution-for-services-sig-network-https-github-com-kubernetes-community-tree-master-sig-network&#34;&gt;1.30 发布博客&lt;/a&gt; 或访问 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/service/#traffic-distribution&#34;&gt;Service&lt;/a&gt; 文档页面。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4444](https://github.com/kubernetes/enhancements/issues/4444) by [SIG Network](https://github.com/kubernetes/community/tree/master/sig-network).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4444&#34;&gt;KEP #4444&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-network&#34;&gt;SIG Network&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Kubernetes VolumeAttributesClass ModifyVolume
--&gt;
&lt;h3 id=&#34;kubernetes-volumeattributesclass-modifyvolume&#34;&gt;Kubernetes VolumeAttributesClass ModifyVolume&lt;/h3&gt;
&lt;!--
[VolumeAttributesClass](/docs/concepts/storage/volume-attributes-classes/) API is moving to beta in v1.31.
The VolumeAttributesClass provides a generic,
Kubernetes-native API for modifying dynamically volume parameters like provisioned IO.
This allows workloads to vertically scale their volumes on-line to balance cost and performance, if supported by their provider.
This feature had been alpha since Kubernetes 1.29.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volume-attributes-classes/&#34;&gt;VolumeAttributesClass&lt;/a&gt; API 在 v1.31 中晋级为 Beta 版。
VolumeAttributesClass 提供了一个通用的、Kubernetes 原生的 API，用于修改动态卷参数，如所提供的 IO 能力。
这允许工作负载在线垂直扩展其卷，以平衡成本和性能（如果提供商支持）。
该功能自 Kubernetes 1.29 以来一直处于 Alpha 状态。&lt;/p&gt;
&lt;!--
This work was done as a part of [KEP #3751](https://github.com/kubernetes/enhancements/issues/3751) and lead by [SIG Storage](https://github.com/kubernetes/community/tree/master/sig-storage).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3751&#34;&gt;KEP #3751&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;!--
## New features in Alpha
--&gt;
&lt;h2 id=&#34;alpha-版的新功能&#34;&gt;Alpha 版的新功能&lt;/h2&gt;
&lt;!--
_This is a selection of some of the improvements that are now alpha following the v1.31 release._
--&gt;
&lt;p&gt;&lt;em&gt;以下是 v1.31 发布后晋级为 Alpha 版的部分改进。&lt;/em&gt;&lt;/p&gt;
&lt;!--
### New DRA APIs for better accelerators and other hardware management
--&gt;
&lt;h3 id=&#34;用于更好管理加速器和其他硬件的新-dra-api&#34;&gt;用于更好管理加速器和其他硬件的新 DRA API&lt;/h3&gt;
&lt;!--
Kubernetes v1.31 brings an updated dynamic resource allocation (DRA) API and design. 
The main focus in the update is on structured parameters because they make resource information and requests transparent to Kubernetes and clients and enable implementing features like cluster autoscaling. 
DRA support in the kubelet was updated such that version skew between kubelet and the control plane is possible. With structured parameters, the scheduler allocates ResourceClaims while scheduling a pod. 
Allocation by a DRA driver controller is still supported through what is now called &#34;classic DRA&#34;.
--&gt;
&lt;p&gt;Kubernetes v1.31 带来了更新的动态资源分配（DRA）API 和设计。
此次更新的主要焦点是结构化参数，因为它们使资源信息和请求对 Kubernetes 和客户端透明，并能够实现集群自动扩缩容等功能。
kubelet 中的 DRA 支持已更新，使得 kubelet 和控制平面之间的版本偏差成为可能。通过结构化参数，调度器在调度 Pod 时分配 ResourceClaims。
通过现在称为&amp;quot;经典 DRA&amp;quot;的方式，仍然支持由 DRA 驱动程序控制器进行分配。&lt;/p&gt;
&lt;!--
With Kubernetes v1.31, classic DRA has a separate feature gate named `DRAControlPlaneController`, which you need to enable explicitly. 
With such a control plane controller, a DRA driver can implement allocation policies that are not supported yet through structured parameters.
--&gt;
&lt;p&gt;从 Kubernetes v1.31 开始,经典 DRA 有一个单独的特性门控名为 &lt;code&gt;DRAControlPlaneController&lt;/code&gt;，您需要显式启用它。
通过这样的控制平面控制器，DRA 驱动程序可以实现尚未通过结构化参数支持的分配策略。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #3063](https://github.com/kubernetes/enhancements/issues/3063) by [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3063&#34;&gt;KEP #3063&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;SIG Node&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Support for image volumes
--&gt;
&lt;h3 id=&#34;对镜像卷的支持&#34;&gt;对镜像卷的支持&lt;/h3&gt;
&lt;!--
The Kubernetes community is moving towards fulfilling more Artificial Intelligence (AI) and Machine Learning (ML) use cases in the future. 
--&gt;
&lt;p&gt;Kubernetes 社区正在朝着在未来满足更多人工智能(AI)和机器学习(ML)用例的方向发展。&lt;/p&gt;
&lt;!--
One of the requirements to fulfill these use cases is to support Open Container Initiative (OCI) 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.
--&gt;
&lt;p&gt;满足这些用例的要求之一是直接将开放容器倡议(OCI)兼容的镜像和工件(称为 OCI 对象)作为原生卷源支持。
这允许用户专注于 OCI 标准，并使他们能够使用 OCI 注册表存储和分发任何内容。&lt;/p&gt;
&lt;!--
Given that, v1.31 adds a new alpha feature to allow using an OCI image as a volume in a Pod.
This feature allows users to specify an image reference as volume in a pod while reusing it as volume
mount within containers. You need to enable the `ImageVolume` feature gate to try this out.
--&gt;
&lt;p&gt;鉴于此，v1.31 添加了一个新的 Alpha 特性，允许在 Pod 中使用 OCI 镜像作为卷。
此特性允许用户在 pod 中指定镜像引用作为卷，同时在容器内重用它作为卷挂载。您需要启用 &lt;code&gt;ImageVolume&lt;/code&gt; 特性门控才能尝试此特性。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4639](https://github.com/kubernetes/enhancements/issues/4639) by [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node) and [SIG Storage](https://github.com/kubernetes/community/tree/master/sig-storage).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4639&#34;&gt;KEP #4639&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-storage&#34;&gt;SIG Storage&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Exposing device health information through Pod status
--&gt;
&lt;h3 id=&#34;通过-pod-状态暴露设备健康信息&#34;&gt;通过 Pod 状态暴露设备健康信息&lt;/h3&gt;
&lt;!--
Expose device health information through the Pod Status is added as a new alpha feature in v1.31, disabled by default.
--&gt;
&lt;p&gt;通过 Pod 状态暴露设备健康信息作为新的 Alpha 特性添加到 v1.31 中，默认被禁用。&lt;/p&gt;
&lt;!--
Before Kubernetes v1.31, the way to know whether or not a Pod is associated with the failed device is to use the [PodResources API](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources). 
--&gt;
&lt;p&gt;在 Kubernetes v1.31 之前，了解 Pod 是否与故障设备关联的方法是使用 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources&#34;&gt;PodResources API&lt;/a&gt;。&lt;/p&gt;
&lt;!--
By enabling this feature, the field `allocatedResourcesStatus` will be added to each container status, within the `.status` for each Pod. The `allocatedResourcesStatus` field reports health information for each device assigned to the container.
--&gt;
&lt;p&gt;通过启用此特性，字段 &lt;code&gt;allocatedResourcesStatus&lt;/code&gt; 将添加到每个容器状态中，在每个 Pod 的 &lt;code&gt;.status&lt;/code&gt; 内。
&lt;code&gt;allocatedResourcesStatus&lt;/code&gt; 字段报告分配给容器的各个设备的健康信息。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4680](https://github.com/kubernetes/enhancements/issues/4680) by [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4680&#34;&gt;KEP #4680&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;SIG Node&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Finer-grained authorization based on selectors
--&gt;
&lt;h3 id=&#34;基于选择算符的细粒度鉴权&#34;&gt;基于选择算符的细粒度鉴权&lt;/h3&gt;
&lt;!--
This feature allows webhook authorizers and future (but not currently designed) in-tree authorizers to
allow **list** and **watch** requests, provided those requests use label and/or field selectors.
For example, it is now possible for an authorizer to express: this user cannot list all pods, but can list all pods where `.spec.nodeName` matches some specific value. Or to allow a user to watch all Secrets in a namespace
that are _not_ labelled as `confidential: true`.
Combined with CRD field selectors (also moving to beta in v1.31), it is possible to write more secure
per-node extensions.
--&gt;
&lt;p&gt;此特性允许 Webhook 鉴权组件和未来（但目前尚未设计）的树内鉴权组件允许 &lt;strong&gt;list&lt;/strong&gt; 和 &lt;strong&gt;watch&lt;/strong&gt; 请求，
前提是这些请求使用标签和/或字段选择算符。
例如，现在鉴权组件可以表达：此用户不能列出所有 Pod，但可以列举所有 &lt;code&gt;.spec.nodeName&lt;/code&gt; 匹配某个特定值的 Pod。
或者允许用户监视命名空间中所有&lt;strong&gt;未&lt;/strong&gt;标记为 &lt;code&gt;confidential: true&lt;/code&gt; 的 Secret。
结合 CRD 字段选择器（在 v1.31 中也晋级为 Beta 版），可以编写更安全的节点级别扩展。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4601](https://github.com/kubernetes/enhancements/issues/4601) by [SIG Auth](https://github.com/kubernetes/community/tree/master/sig-auth).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4601&#34;&gt;KEP #4601&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-auth&#34;&gt;SIG Auth&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
### Restrictions on anonymous API access
--&gt;
&lt;h3 id=&#34;对匿名-api-访问的限制&#34;&gt;对匿名 API 访问的限制&lt;/h3&gt;
&lt;!--
By enabling the feature gate `AnonymousAuthConfigurableEndpoints` users can now use the authentication configuration file to configure the endpoints that can be accessed by anonymous requests. 
This allows users to protect themselves against RBAC misconfigurations that can give anonymous users broad access to the cluster.
--&gt;
&lt;p&gt;通过启用特性门控 &lt;code&gt;AnonymousAuthConfigurableEndpoints&lt;/code&gt;，用户现在可以使用身份认证配置文件来配置可以通过匿名请求访问的端点。
这允许用户保护自己免受 RBAC 错误配置的影响；错误的配置可能会给匿名用户提供对集群的更多访问权限。&lt;/p&gt;
&lt;!--
This work was done as a part of [KEP #4633](https://github.com/kubernetes/enhancements/issues/4633) and by [SIG Auth](https://github.com/kubernetes/community/tree/master/sig-auth).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4633&#34;&gt;KEP #4633&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-auth&#34;&gt;SIG Auth&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
## Graduations, deprecations, and removals in 1.31
--&gt;
&lt;h2 id=&#34;1-31-中的晋级-弃用和移除&#34;&gt;1.31 中的晋级、弃用和移除&lt;/h2&gt;
&lt;!--
### Graduations to Stable
--&gt;
&lt;h3 id=&#34;晋级为稳定版&#34;&gt;晋级为稳定版&lt;/h3&gt;
&lt;!--
This lists all the features that graduated to stable (also known as _general availability_). For a full list of updates including new features and graduations from alpha to beta, see the release notes.
--&gt;
&lt;p&gt;以下列出了所有晋级为稳定版（也称为 &lt;em&gt;正式可用&lt;/em&gt; ）的功能。有关包括新功能和从 Alpha 晋级到 Beta 的完整列表，请参阅发行说明。&lt;/p&gt;
&lt;!--
This release includes a total of 11 enhancements promoted to Stable:
--&gt;
&lt;p&gt;此版本包括总共 11 项晋级为稳定版的增强:&lt;/p&gt;
&lt;!--
* [PersistentVolume last phase transition time](https://github.com/kubernetes/enhancements/issues/3762)
* [Metric cardinality enforcement](https://github.com/kubernetes/enhancements/issues/2305)
* [Kube-proxy improved ingress connectivity reliability](https://github.com/kubernetes/enhancements/issues/3836)
* [Add CDI devices to device plugin API](https://github.com/kubernetes/enhancements/issues/4009)
* [Move cgroup v1 support into maintenance mode](https://github.com/kubernetes/enhancements/issues/4569)
* [AppArmor support](https://github.com/kubernetes/enhancements/issues/24)
* [PodHealthyPolicy for PodDisruptionBudget](https://github.com/kubernetes/enhancements/issues/3017)
* [Retriable and non-retriable Pod failures for Jobs](https://github.com/kubernetes/enhancements/issues/3329)
* [Elastic Indexed Jobs](https://github.com/kubernetes/enhancements/issues/3715)
* [Allow StatefulSet to control start replica ordinal numbering](https://github.com/kubernetes/enhancements/issues/3335)
* [Random Pod selection on ReplicaSet downscaling](https://github.com/kubernetes/enhancements/issues/2185)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3762&#34;&gt;PersistentVolume 最后阶段转换时间&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/2305&#34;&gt;Metric 基数强制执行&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3836&#34;&gt;Kube-proxy 改进的入站连接可靠性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4009&#34;&gt;将 CDI 设备添加到设备插件 API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4569&#34;&gt;将 cgroup v1 支持移入维护模式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/24&#34;&gt;AppArmor 支持&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3017&#34;&gt;PodDisruptionBudget 的 PodHealthyPolicy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3329&#34;&gt;Job 的可重试和不可重试 Pod 失败&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3715&#34;&gt;弹性的带索引的 Job&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3335&#34;&gt;允许 StatefulSet 控制起始副本序号编号&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/2185&#34;&gt;ReplicaSet 缩小时随机选择 Pod&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### Deprecations and Removals 
--&gt;
&lt;h3 id=&#34;弃用和移除&#34;&gt;弃用和移除&lt;/h3&gt;
&lt;!--
As Kubernetes develops and matures, features may be deprecated, removed, or replaced with better ones for the project&#39;s overall health. 
See the Kubernetes [deprecation and removal policy](/docs/reference/using-api/deprecation-policy/) for more details on this process.
--&gt;
&lt;p&gt;随着 Kubernetes 的发展和成熟，某些特性可能会被弃用、移除或替换为更好的特性，以确保项目的整体健康。
有关此过程的更多详细信息，请参阅 Kubernetes &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-policy/&#34;&gt;弃用和移除策略&lt;/a&gt;。&lt;/p&gt;
&lt;!--
#### Cgroup v1 enters the maintenance mode
--&gt;
&lt;h4 id=&#34;cgroup-v1-进入维护模式&#34;&gt;Cgroup v1 进入维护模式&lt;/h4&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 in v1.31.
This shift aligns with the broader industry&#39;s move towards [cgroup v2](/docs/concepts/architecture/cgroups/), offering improved functionality, scalability, and a more consistent interface. 
Kubernetes maintance mode means that no new features will be added to cgroup v1 support. 
Critical security fixes will still be provided, however, bug-fixing is now best-effort, meaning major bugs may be fixed if feasible, but some issues might remain unresolved.
--&gt;
&lt;p&gt;随着 Kubernetes 继续发展并适应容器编排不断变化的格局，社区决定在 v1.31 中将 cgroup v1 支持移入维护模式。
这一转变与行业中普遍向 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cgroups/&#34;&gt;cgroup v2&lt;/a&gt; 迁移的趋势一致，
提供了改进的功能、可扩展性和更一致的接口。
Kubernetes 维护模式意味着不会向 cgroup v1 支持添加新功能。
社区仍将提供关键的安全修复，但是，错误修复现在是尽力而为。
这意味着如果可行，可能会修复重大错误，但某些问题可能保持未解决状态。&lt;/p&gt;
&lt;!--
It is recommended that you start switching to use cgroup v2 as soon as possible. 
This transition depends on your architecture, including ensuring the underlying operating systems and container runtimes support cgroup v2 and testing workloads to verify that workloads and applications function correctly with cgroup v2.
--&gt;
&lt;p&gt;建议您尽快开始切换到使用 cgroup v2。
这种转变取决于您的架构，包括确保底层操作系统和容器运行时支持 cgroup v2，以及测试工作负载以验证工作负载和应用程序在 cgroup v2 下是否正常运行。&lt;/p&gt;
&lt;!--
Please report any problems you encounter by filing an [issue](https://github.com/kubernetes/kubernetes/issues/new/choose).
--&gt;
&lt;p&gt;如果遇到任何问题,请通过提交 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/new/choose&#34;&gt;issue&lt;/a&gt; 进行报告。&lt;/p&gt;
&lt;!--
This work was done as part of [KEP #4569](https://github.com/kubernetes/enhancements/issues/4569) by [SIG Node](https://github.com/kubernetes/community/tree/master/sig-node).
--&gt;
&lt;p&gt;这项工作是作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4569&#34;&gt;KEP #4569&lt;/a&gt; 的一部分由
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;SIG Node&lt;/a&gt; 完成的。&lt;/p&gt;
&lt;!--
#### A note about SHA-1 signature support
--&gt;
&lt;h4 id=&#34;关于-sha-1-签名支持的说明&#34;&gt;关于 SHA-1 签名支持的说明&lt;/h4&gt;
&lt;!--
In [go1.18](https://go.dev/doc/go1.18#sha1) (released in March 2022), the crypto/x509 library started to reject certificates signed with a SHA-1 hash function. 
While SHA-1 is established to be unsafe and publicly trusted Certificate Authorities have not issued SHA-1 certificates since 2015, there might still be cases in the context of Kubernetes where user-provided certificates are signed using a SHA-1 hash function through private authorities with them being used for Aggregated API Servers or webhooks. 
If you have relied on SHA-1 based certificates, you must explicitly opt back into its support by setting `GODEBUG=x509sha1=1` in your environment.
--&gt;
&lt;p&gt;在 &lt;a href=&#34;https://go.dev/doc/go1.18#sha1&#34;&gt;go1.18&lt;/a&gt;（2022 年 3 月发布）中，crypto/x509 库开始拒绝使用 SHA-1 哈希函数签名的证书。
虽然 SHA-1 已被确定为不安全，并且公共信任的证书颁发机构自 2015 年以来就不再颁发 SHA-1 证书，
但在 Kubernetes 语境中可能仍然存在用户提供的证书通过私有机构使用 SHA-1 哈希函数签名的情况，
这些证书用于聚合 API 服务器或 Webhook。
如果您依赖基于 SHA-1 的证书，必须通过在环境变量中设置 &lt;code&gt;GODEBUG=x509sha1=1&lt;/code&gt; 来明确选择重新启用其支持。&lt;/p&gt;
&lt;!--
Given Go&#39;s [compatibility policy for GODEBUGs](https://go.dev/blog/compat), the `x509sha1` GODEBUG and the support for SHA-1 certificates will [fully go away in go1.24](https://tip.golang.org/doc/go1.23) which will be released in the first half of 2025. 
If you rely on SHA-1 certificates, please start moving off them.
--&gt;
&lt;p&gt;鉴于 Go 的 &lt;a href=&#34;https://go.dev/blog/compat&#34;&gt;GODEBUG 兼容性策略&lt;/a&gt;，&lt;code&gt;x509sha1&lt;/code&gt; GODEBUG 和对 SHA-1
证书的支持&lt;a href=&#34;https://tip.golang.org/doc/go1.23&#34;&gt;将在 go1.24 中完全消失&lt;/a&gt;，
而 go1.24 将在 2025 年上半年发布。
如果您依赖 SHA-1 证书,请开始迁移离开它们。&lt;/p&gt;
&lt;!--
Please see [Kubernetes issue #125689](https://github.com/kubernetes/kubernetes/issues/125689) to get a better idea of timelines around the support for SHA-1 going away, when Kubernetes releases plans to adopt go1.24, and for more details on how to detect usage of SHA-1 certificates via metrics and audit logging. 
--&gt;
&lt;p&gt;请查看 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/125689&#34;&gt;Kubernetes issue #125689&lt;/a&gt;
以了解有关 SHA-1 支持消失的时间线、Kubernetes 发布计划何时采用 go1.24，
以及如何通过指标和审计日志检测 SHA-1 证书使用情况的更多详细信息。&lt;/p&gt;
&lt;!--
#### Deprecation of `status.nodeInfo.kubeProxyVersion` field for Nodes ([KEP 4004](https://github.com/kubernetes/enhancements/issues/4004))
--&gt;
&lt;h4 id=&#34;弃用-node-节点的-status-nodeinfo-kubeproxyversion-字段-kep-4004-https-github-com-kubernetes-enhancements-issues-4004&#34;&gt;弃用 Node 节点的 &lt;code&gt;status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段 (&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4004&#34;&gt;KEP 4004&lt;/a&gt;)&lt;/h4&gt;
&lt;!--
The `.status.nodeInfo.kubeProxyVersion` field of Nodes has been deprecated in Kubernetes v1.31,
and will be removed in a later release.
It&#39;s being deprecated because the value of this field wasn&#39;t (and isn&#39;t) accurate.
This field is set by the kubelet, which does not have reliable information about the kube-proxy version or whether kube-proxy is running. 
--&gt;
&lt;p&gt;节点的 &lt;code&gt;.status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段在 Kubernetes v1.31 中已被弃用,
并将在以后的版本中删除。
它被弃用是因为这个字段的值不准确（现在也不准确）。
这个字段是由 kubelet 设置的，而 kubelet 没有关于 kube-proxy 版本或 kube-proxy 是否正在运行的可靠信息。&lt;/p&gt;
&lt;!--
The `DisableNodeKubeProxyVersion` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) will be set to `true` in by default in v1.31 and the kubelet will no longer attempt to set the `.status.kubeProxyVersion` field for its associated Node.
--&gt;
&lt;p&gt;&lt;code&gt;DisableNodeKubeProxyVersion&lt;/code&gt; &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;将在 v1.31
中默认设置为 &lt;code&gt;true&lt;/code&gt;，kubelet 将不再尝试为其关联的节点设置 &lt;code&gt;.status.kubeProxyVersion&lt;/code&gt; 字段。&lt;/p&gt;
&lt;!--
#### Removal of all in-tree integrations with cloud providers
--&gt;
&lt;h4 id=&#34;移除所有树内云提供商集成&#34;&gt;移除所有树内云提供商集成&lt;/h4&gt;
&lt;!--
As highlighted in a [previous article](/blog/2024/05/20/completing-cloud-provider-migration/), the last remaining in-tree support for cloud provider integration has been removed as part of the v1.31 release.
This doesn&#39;t mean you can&#39;t integrate with a cloud provider, however you now **must** use the
recommended approach using an external integration. Some integrations are part of the Kubernetes
project and others are third party software.
--&gt;
&lt;p&gt;正如之前的文章中强调的那样，作为 v1.31 发布的一部分，最后剩余的树内云平台集成支持已被移除。
这并不意味着您不能与云平台集成，但是您现在&lt;strong&gt;必须&lt;/strong&gt;使用推荐的方法使用外部集成。一些集成是 Kubernetes 项目的一部分，而其他则是第三方软件。&lt;/p&gt;
&lt;!--
This milestone marks the completion of the externalization process for all cloud providers&#39; integrations from the Kubernetes core ([KEP-2395](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md)), a process started with Kubernetes v1.26. 
This change helps Kubernetes to get closer to being a truly vendor-neutral platform.
--&gt;
&lt;p&gt;这一里程碑标志着所有云提供商集成从 Kubernetes 核心外部化过程的完成（&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md&#34;&gt;KEP-2395&lt;/a&gt;），这个过程始于 Kubernetes v1.26。
这一变化有助于 Kubernetes 更接近成为一个真正供应商中立的平台。&lt;/p&gt;
&lt;!--
For further details on the cloud provider integrations, read our [v1.29 Cloud Provider Integrations feature blog](/blog/2023/12/14/cloud-provider-integration-changes/). 
For additional context about the in-tree code removal, we invite you to check the ([v1.29 deprecation blog](/blog/2023/11/16/kubernetes-1-29-upcoming-changes/#removal-of-in-tree-integrations-with-cloud-providers-kep-2395-https-kep-k8s-io-2395)).
--&gt;
&lt;p&gt;有关云提供商集成的更多详细信息，请阅读我们的 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/12/14/cloud-provider-integration-changes/&#34;&gt;v1.29 云提供商集成功能博客&lt;/a&gt;。
有关树内代码移除的额外背景，我们邀请您查看（&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/11/16/kubernetes-1-29-upcoming-changes/#removal-of-in-tree-integrations-with-cloud-providers-kep-2395-https-kep-k8s-io-2395&#34;&gt;v1.29 弃用博客&lt;/a&gt;）。&lt;/p&gt;
&lt;!--
The latter blog also contains useful information for users who need to migrate to version v1.29 and later.
--&gt;
&lt;p&gt;后者的博客还包含了需要迁移到 v1.29 及更高版本的用户的有用信息。&lt;/p&gt;
&lt;!--
#### Removal of in-tree provider feature gates
--&gt;
&lt;h4 id=&#34;移除树内供应商特性门控&#34;&gt;移除树内供应商特性门控&lt;/h4&gt;
&lt;!--
In Kubernetes v1.31, the following alpha feature gates `InTreePluginAWSUnregister`, `InTreePluginAzureDiskUnregister`, `InTreePluginAzureFileUnregister`, `InTreePluginGCEUnregister`, `InTreePluginOpenStackUnregister`, and `InTreePluginvSphereUnregister` have been removed. These feature gates were introduced to facilitate the testing of scenarios where in-tree volume plugins were removed from the codebase, without actually removing them. Since Kubernetes 1.30 had deprecated these in-tree volume plugins, these feature gates were redundant and no longer served a purpose. The only CSI migration gate still standing is `InTreePluginPortworxUnregister`, which will remain in alpha until the CSI migration for Portworx is completed and its in-tree volume plugin will be ready for removal.
--&gt;
&lt;p&gt;在 Kubernetes v1.31 中，以下 Alpha 特性门控 &lt;code&gt;InTreePluginAWSUnregister&lt;/code&gt;、&lt;code&gt;InTreePluginAzureDiskUnregister&lt;/code&gt;、
&lt;code&gt;InTreePluginAzureFileUnregister&lt;/code&gt;、&lt;code&gt;InTreePluginGCEUnregister&lt;/code&gt;、&lt;code&gt;InTreePluginOpenStackUnregister&lt;/code&gt;
和 &lt;code&gt;InTreePluginvSphereUnregister&lt;/code&gt; 已被移除。
这些特性门控的引入是为了便于测试从代码库中移除树内卷插件的场景，而无需实际移除它们。
由于 Kubernetes 1.30 已弃用这些树内卷插件，这些特性门控变得多余，不再有用。
唯一仍然存在的 CSI 迁移门控是 &lt;code&gt;InTreePluginPortworxUnregister&lt;/code&gt;，它将保持 Alpha 状态，
直到 Portworx 的 CSI 迁移完成，其树内卷插件准备好被移除。&lt;/p&gt;
&lt;!--
#### Removal of kubelet `--keep-terminated-pod-volumes` command line flag
--&gt;
&lt;h4 id=&#34;移除-kubelet-的-keep-terminated-pod-volumes-命令行标志&#34;&gt;移除 kubelet 的 &lt;code&gt;--keep-terminated-pod-volumes&lt;/code&gt; 命令行标志&lt;/h4&gt;
&lt;!--
The kubelet flag `--keep-terminated-pod-volumes`, which was deprecated in 2017, has been removed as
part of the v1.31 release.

You can find more details in the pull request [#122082](https://github.com/kubernetes/kubernetes/pull/122082).
--&gt;
&lt;p&gt;作为 v1.31 版本的一部分，已移除 kubelet 标志 &lt;code&gt;--keep-terminated-pod-volumes&lt;/code&gt;。该标志于 2017 年被弃用。&lt;/p&gt;
&lt;p&gt;您可以在拉取请求 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/122082&#34;&gt;#122082&lt;/a&gt; 中找到更多详细信息。&lt;/p&gt;
&lt;!--
#### Removal of CephFS volume plugin 

[CephFS volume plugin](/docs/concepts/storage/volumes/#cephfs) was removed in this release and the `cephfs` volume type became non-functional. 

It is recommended that you use the [CephFS CSI driver](https://github.com/ceph/ceph-csi/) as a third-party storage driver instead. If you were using the CephFS volume plugin before upgrading the cluster version to v1.31, you must re-deploy your application to use the new driver.

CephFS volume plugin was formally marked as deprecated in v1.28.
--&gt;
&lt;h4 id=&#34;移除-cephfs-卷插件&#34;&gt;移除 CephFS 卷插件&lt;/h4&gt;
&lt;p&gt;本次发布中移除了 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#cephfs&#34;&gt;CephFS 卷插件&lt;/a&gt;，&lt;code&gt;cephfs&lt;/code&gt; 卷类型变为不可用。&lt;/p&gt;
&lt;p&gt;建议您改用 &lt;a href=&#34;https://github.com/ceph/ceph-csi/&#34;&gt;CephFS CSI 驱动&lt;/a&gt; 作为第三方存储驱动程序。
如果您在将集群版本升级到 v1.31 之前使用了 CephFS 卷插件，则必须重新部署应用程序以使用新的驱动程序。&lt;/p&gt;
&lt;p&gt;CephFS 卷插件在 v1.28 中正式标记为废弃。&lt;/p&gt;
&lt;!--
#### Removal of Ceph RBD volume plugin

The v1.31 release removes the [Ceph RBD volume plugin](/docs/concepts/storage/volumes/#rbd) and its CSI migration support, making the `rbd` volume type non-functional.

It&#39;s recommended that you use the [RBD CSI driver](https://github.com/ceph/ceph-csi/) in your clusters instead. 
If you were using Ceph RBD volume plugin before upgrading the cluster version to v1.31, you must re-deploy your application to use the new driver.

The Ceph RBD volume plugin was formally marked as deprecated in v1.28.
--&gt;
&lt;h4 id=&#34;移除-ceph-rbd-卷插件&#34;&gt;移除 Ceph RBD 卷插件&lt;/h4&gt;
&lt;p&gt;v1.31 版本移除了 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#rbd&#34;&gt;Ceph RBD volume plugin&lt;/a&gt; 及其 CSI 迁移支持，使 &lt;code&gt;rbd&lt;/code&gt; 卷类型变为不可用。&lt;/p&gt;
&lt;p&gt;建议您在集群中改用 &lt;a href=&#34;https://github.com/ceph/ceph-csi/&#34;&gt;RBD CSI driver&lt;/a&gt;。
如果您在将集群版本升级到 v1.31 之前使用了 Ceph RBD 卷插件，则必须重新部署应用程序以使用新的驱动程序。&lt;/p&gt;
&lt;p&gt;Ceph RBD 卷插件在 v1.28 中正式标记为废弃。&lt;/p&gt;
&lt;!--
#### Deprecation of non-CSI volume limit plugins in kube-scheduler
--&gt;
&lt;h4 id=&#34;废弃-kube-scheduler-中的非-csi-卷限制插件&#34;&gt;废弃 kube-scheduler 中的非 CSI 卷限制插件&lt;/h4&gt;
&lt;!--
The v1.31 release will deprecate all non-CSI volume limit scheduler plugins, and will remove some
already deprected plugins from the [default plugins](/docs/reference/scheduling/config/), including:

- `AzureDiskLimits`
- `CinderLimits`
- `EBSLimits`
- `GCEPDLimits`
--&gt;
&lt;p&gt;v1.31 版本将废弃所有非 CSI 卷限制调度器插件，并将从&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/scheduling/config/&#34;&gt;默认插件&lt;/a&gt;中移除一些已废弃的插件，包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AzureDiskLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CinderLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EBSLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GCEPDLimits&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
It&#39;s recommended that you use the `NodeVolumeLimits` plugin instead because it can handle the same functionality as the removed plugins since those volume types have been migrated to CSI. 
Please replace the deprecated plugins with the `NodeVolumeLimits` plugin if you explicitly use them in the [scheduler config](/docs/reference/scheduling/config/). 
The `AzureDiskLimits`, `CinderLimits`, `EBSLimits`, and `GCEPDLimits` plugins will be removed in a future release.
--&gt;
&lt;p&gt;建议您改用 &lt;code&gt;NodeVolumeLimits&lt;/code&gt; 插件，因为自从这些卷类型迁移到 CSI 后，该插件可以处理与已移除插件相同的功能。
如果您在调度器配置中明确使用了已废弃的插件，请将它们替换为 &lt;code&gt;NodeVolumeLimits&lt;/code&gt; 插件。
&lt;code&gt;AzureDiskLimits&lt;/code&gt;、&lt;code&gt;CinderLimits&lt;/code&gt;、&lt;code&gt;EBSLimits&lt;/code&gt; 和 &lt;code&gt;GCEPDLimits&lt;/code&gt; 插件将在未来的版本中被移除。&lt;/p&gt;
&lt;!--
These plugins will be removed from the default scheduler plugins list as they have been deprecated since Kubernetes v1.14.
--&gt;
&lt;p&gt;这些插件自 Kubernetes v1.14 以来已被废弃，将从默认调度器插件列表中移除。&lt;/p&gt;
&lt;!--
### Release notes and upgrade actions required

Check out the full details of the Kubernetes v1.31 release in our [release notes](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md).
--&gt;
&lt;h3 id=&#34;发布说明和所需的升级操作&#34;&gt;发布说明和所需的升级操作&lt;/h3&gt;
&lt;p&gt;请在我们的&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md&#34;&gt;发布说明&lt;/a&gt;中查看 Kubernetes v1.31 版本的完整详细信息。&lt;/p&gt;
&lt;!--
#### Scheduler now uses QueueingHint when `SchedulerQueueingHints` is enabled
Added support to the scheduler to start using a QueueingHint registered for Pod/Updated events,
to determine whether updates to  previously unschedulable Pods have made them schedulable.
The new support is active when the feature gate `SchedulerQueueingHints` is enabled.

Previously, when unschedulable Pods were updated, the scheduler always put Pods back to into a queue
(`activeQ` / `backoffQ`). However not all updates to Pods make Pods schedulable, especially considering
many scheduling constraints nowadays are immutable. Under the new behaviour, once unschedulable Pods
are updated, the scheduling queue checks with QueueingHint(s) whether the update may make the
pod(s) schedulable, and requeues them to `activeQ` or `backoffQ` only when at least one
QueueingHint returns `Queue`.
--&gt;
&lt;h4 id=&#34;启用-schedulerqueueinghints-时-调度器现在使用-queueinghint&#34;&gt;启用 &lt;code&gt;SchedulerQueueingHints&lt;/code&gt; 时，调度器现在使用 QueueingHint&lt;/h4&gt;
&lt;p&gt;社区为调度器添加了支持，以便在启用 &lt;code&gt;SchedulerQueueingHints&lt;/code&gt; 功能门控时，开始使用为 Pod/Updated
事件注册的 QueueingHint，以确定对先前不可调度的 Pod 的更新是否使其变得可调度。
以前，当不可调度的 Pod 被更新时，调度器总是将 Pod 放回队列（&lt;code&gt;activeQ&lt;/code&gt; / &lt;code&gt;backoffQ&lt;/code&gt;）。
然而，并非所有对 Pod 的更新都会使 Pod 变得可调度，特别是考虑到现在许多调度约束是不可变更的。
在新的行为下，一旦不可调度的 Pod 被更新，调度队列会通过 QueueingHint 检查该更新是否可能使 Pod 变得可调度，
并且只有当至少一个 QueueingHint 返回 Queue 时，才将它们重新排队到 &lt;code&gt;activeQ&lt;/code&gt; 或 &lt;code&gt;backoffQ&lt;/code&gt;。&lt;/p&gt;
&lt;!--
**Action required for custom scheduler plugin developers**: 
Plugins have to implement a QueueingHint for Pod/Update event if the rejection from them could be resolved by updating unscheduled Pods themselves. Example: suppose you develop a custom plugin that denies Pods that have a `schedulable=false` label. Given Pods with a `schedulable=false` label will be schedulable if the `schedulable=false` label is removed, this plugin would implement QueueingHint for Pod/Update event that returns Queue when such label changes are made in unscheduled Pods. You can find more details in the pull request [#122234](https://github.com/kubernetes/kubernetes/pull/122234).
--&gt;
&lt;p&gt;&lt;strong&gt;自定义调度器插件开发者需要采取的操作&lt;/strong&gt;：
如果插件的拒绝可以通过更新未调度的 Pod 本身来解决，那么插件必须为 Pod/Update 事件实现 QueueingHint。
例如：假设您开发了一个自定义插件，该插件拒绝具有 &lt;code&gt;schedulable=false&lt;/code&gt; 标签的 Pod。
鉴于带有 &lt;code&gt;schedulable=false&lt;/code&gt; 标签的 Pod 在移除该标签后将变得可调度，这个插件将为 Pod/Update
事件实现 QueueingHint，当在未调度的 Pod 中进行此类标签更改时返回 Queue。
您可以在 pull request &lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/122234&#34;&gt;#122234&lt;/a&gt; 中找到更多详细信息。&lt;/p&gt;
&lt;!--
#### Removal of kubelet --keep-terminated-pod-volumes command line flag
The kubelet flag `--keep-terminated-pod-volumes`, which was deprecated in 2017, was removed as part of the v1.31 release.

You can find more details in the pull request [#122082](https://github.com/kubernetes/kubernetes/pull/122082).
--&gt;
&lt;h4 id=&#34;移除-kubelet-keep-terminated-pod-volumes-命令行标志&#34;&gt;移除 kubelet --keep-terminated-pod-volumes 命令行标志&lt;/h4&gt;
&lt;p&gt;作为 v1.31 版本的一部分，已移除 kubelet 标志 &lt;code&gt;--keep-terminated-pod-volumes&lt;/code&gt;。该标志于 2017 年被弃用。
您可以在拉取请求 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/122082&#34;&gt;#122082&lt;/a&gt; 中找到更多详细信息。&lt;/p&gt;
&lt;!--
## Availability

Kubernetes v1.31 is available for download on [GitHub](https://github.com/kubernetes/kubernetes/releases/tag/v1.31.0) or on the [Kubernetes download page](/releases/download/). 

To get started with Kubernetes, check out these [interactive tutorials](/docs/tutorials/) or run local Kubernetes clusters using [minikube](https://minikube.sigs.k8s.io/). You can also easily install v1.31 using [kubeadm](/docs/setup/independent/create-cluster-kubeadm/). 
--&gt;
&lt;h2 id=&#34;可用性&#34;&gt;可用性&lt;/h2&gt;
&lt;p&gt;Kubernetes v1.31 可在 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/releases/tag/v1.31.0&#34;&gt;GitHub&lt;/a&gt; 或 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/releases/download/&#34;&gt;Kubernetes 下载页面&lt;/a&gt;上下载。&lt;/p&gt;
&lt;p&gt;要开始使用 Kubernetes，请查看这些&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tutorials/&#34;&gt;交互式教程&lt;/a&gt;或使用 &lt;a href=&#34;https://minikube.sigs.k8s.io/&#34;&gt;minikube&lt;/a&gt;
运行本地 Kubernetes 集群。您还可以使用 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/independent/create-cluster-kubeadm/&#34;&gt;kubeadm&lt;/a&gt; 轻松安装 v1.31。&lt;/p&gt;
&lt;!--
## Release team

Kubernetes is only possible with the support, commitment, and hard work of its community. 
Each release team is made up of dedicated community volunteers who work together to build the many pieces that make up the Kubernetes releases you rely on. 
This requires the specialized skills of people from all corners of our community, from the code itself to its documentation and project management.

We would like to thank the entire [release team](https://github.com/kubernetes/sig-release/blob/master/releases/release-1.31/release-team.md) for the hours spent hard at work to deliver the Kubernetes v1.31 release to our community. 
The Release Team&#39;s membership ranges from first-time shadows to returning team leads with experience forged over several release cycles. 
A very special thanks goes out our release lead, Angelos Kolaitis, for supporting us through a successful release cycle, advocating for us, making sure that we could all contribute in the best way possible, and challenging us to improve the release process.
--&gt;
&lt;h2 id=&#34;发布团队&#34;&gt;发布团队&lt;/h2&gt;
&lt;p&gt;Kubernetes 的实现离不开社区的支持、投入和辛勤工作。
每个发布团队由致力于构建 Kubernetes 发布版本各个部分的专门社区志愿者组成。
这需要来自我们社区各个角落的人员的专业技能，从代码本身到文档和项目管理。&lt;/p&gt;
&lt;p&gt;我们要感谢整个&lt;a href=&#34;https://github.com/kubernetes/sig-release/blob/master/releases/release-1.31/release-team.md&#34;&gt;发布团队&lt;/a&gt;为向我们的社区交付 Kubernetes v1.31 版本所付出的时间和努力。
发布团队的成员从首次参与的影子成员到经历多个发布周期的回归团队负责人不等。
特别感谢我们的发布负责人 Angelos Kolaitis，他支持我们完成了一个成功的发布周期，为我们发声，确保我们都能以最佳方式贡献，并挑战我们改进发布过程。&lt;/p&gt;
&lt;!--
## Project velocity
--&gt;
&lt;h2 id=&#34;项目速度&#34;&gt;项目速度&lt;/h2&gt;
&lt;!--
The CNCF K8s DevStats project aggregates a number of interesting data points related to the velocity of Kubernetes and various sub-projects. This includes everything from individual contributions to the number of companies that are contributing and is an illustration of the depth and breadth of effort that goes into evolving this ecosystem.
--&gt;
&lt;p&gt;CNCF K8s DevStats 项目汇总了许多与 Kubernetes 及各个子项目速度相关的有趣数据点。
这包括从个人贡献到贡献公司数量的所有内容，展示了进化这个生态系统所投入的深度和广度。&lt;/p&gt;
&lt;!--
In the v1.31 release cycle, which ran for 14 weeks (May 7th to August 13th), we saw contributions to Kubernetes from 113 different companies and 528 individuals.
--&gt;
&lt;p&gt;在为期 14 周的 v1.31 发布周期（5 月 7 日至 8 月 13 日）中，我们看到来自 113 家不同公司和 528 个个人对 Kubernetes 的贡献。&lt;/p&gt;
&lt;!--
In the whole Cloud Native ecosystem we have 379 companies counting 2268 total contributors - which means that respect to the previous release cycle we experienced an astounding 63% increase on individuals contributing! 
--&gt;
&lt;p&gt;在整个云原生生态系统中，我们有 379 家公司，共计 2268 名贡献者 - 这意味着相比上一个发布周期，个人贡献者数量惊人地增加了 63%！&lt;/p&gt;
&lt;!--
Source for this data: 
- [Companies contributing to Kubernetes](https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;from=1715032800000&amp;to=1723586399000&amp;var-period=d28&amp;var-repogroup_name=Kubernetes&amp;var-repo_name=kubernetes%2Fkubernetes)
- [Overall ecosystem contributions](https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;from=1715032800000&amp;to=1723586399000&amp;var-period=d28&amp;var-repogroup_name=All&amp;var-repo_name=kubernetes%2Fkubernetes)
--&gt;
&lt;p&gt;数据来源：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;from=1715032800000&amp;to=1723586399000&amp;var-period=d28&amp;var-repogroup_name=Kubernetes&amp;var-repo_name=kubernetes%2Fkubernetes&#34;&gt;为 Kubernetes 贡献的公司&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;from=1715032800000&amp;to=1723586399000&amp;var-period=d28&amp;var-repogroup_name=All&amp;var-repo_name=kubernetes%2Fkubernetes&#34;&gt;整体生态系统贡献&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
By contribution we mean when someone makes a commit, code review, comment, creates an issue or PR, reviews a PR (including blogs and documentation) or comments on issues and PRs.
--&gt;
&lt;p&gt;贡献指的是当某人进行提交、代码审查、评论、创建问题或 PR、审查 PR（包括博客和文档）或对问题和 PR 进行评论。&lt;/p&gt;
&lt;!--
If you are interested in contributing visit [this page](https://www.kubernetes.dev/docs/guide/#getting-started) to get started. 
--&gt;
&lt;p&gt;如果您有兴趣贡献，请访问&lt;a href=&#34;https://www.kubernetes.dev/docs/guide/#getting-started&#34;&gt;此页面&lt;/a&gt;开始。&lt;/p&gt;
&lt;!--
[Check out DevStats](https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;var-period=m&amp;var-repogroup_name=All) to learn more about the overall velocity of the Kubernetes project and community.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://k8s.devstats.cncf.io/d/11/companies-contributing-in-repository-groups?orgId=1&amp;var-period=m&amp;var-repogroup_name=All&#34;&gt;查看 DevStats&lt;/a&gt; 以了解更多关于 Kubernetes 项目和社区整体速度的信息。&lt;/p&gt;
&lt;!--
## Event update

Explore the upcoming Kubernetes and cloud-native events from August to November 2024, featuring KubeCon, KCD, and other notable conferences worldwide. Stay informed and engage with the Kubernetes community.
--&gt;
&lt;h2 id=&#34;活动更新&#34;&gt;活动更新&lt;/h2&gt;
&lt;p&gt;探索 2024 年 8 月至 11 月即将举行的 Kubernetes 和云原生活动，包括 KubeCon、KCD 和其他全球知名会议。保持了解并参与 Kubernetes 社区。&lt;/p&gt;
&lt;!--
**August 2024**
- [**KubeCon + CloudNativeCon + Open Source Summit China 2024**](https://events.linuxfoundation.org/kubecon-cloudnativecon-open-source-summit-ai-dev-china/): August 21-23, 2024 | Hong Kong
- [**KubeDay Japan**](https://events.linuxfoundation.org/kubeday-japan/): August 27, 2024 | Tokyo, Japan
--&gt;
&lt;p&gt;&lt;strong&gt;2024 年 8 月&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://events.linuxfoundation.org/kubecon-cloudnativecon-open-source-summit-ai-dev-china/&#34;&gt;&lt;strong&gt;KubeCon + CloudNativeCon + 开源峰会中国 2024&lt;/strong&gt;&lt;/a&gt;：2024 年 8 月 21-23 日 | 中国香港&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://events.linuxfoundation.org/kubeday-japan/&#34;&gt;&lt;strong&gt;KubeDay Japan&lt;/strong&gt;&lt;/a&gt;：2024 年 8 月 27 日 | 东京，日本&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**September 2024**
- [**KCD Lahore - Pakistan 2024**](https://community.cncf.io/events/details/cncf-kcd-lahore-presents-kcd-lahore-pakistan-2024/): September 1, 2024 | Lahore, Pakistan
- [**KuberTENes Birthday Bash Stockholm**](https://community.cncf.io/events/details/cncf-stockholm-presents-kubertenes-birthday-bash-stockholm-a-couple-of-months-late/): September 5, 2024 | Stockholm, Sweden
- [**KCD Sydney ’24**](https://community.cncf.io/events/details/cncf-kcd-australia-presents-kcd-sydney-24/): September 5-6, 2024 | Sydney, Australia
- [**KCD Washington DC 2024**](https://community.cncf.io/events/details/cncf-kcd-washington-dc-presents-kcd-washington-dc-2024/): September 24, 2024 | Washington, DC, United States
- [**KCD Porto 2024**](https://community.cncf.io/events/details/cncf-kcd-porto-presents-kcd-porto-2024/): September 27-28, 2024 | Porto, Portugal
--&gt;
&lt;p&gt;&lt;strong&gt;2024 年 9 月&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-lahore-presents-kcd-lahore-pakistan-2024/&#34;&gt;&lt;strong&gt;KCD 拉合尔 - 巴基斯坦 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 9 月 1 日 | 拉合尔，巴基斯坦&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-stockholm-presents-kubertenes-birthday-bash-stockholm-a-couple-of-months-late/&#34;&gt;&lt;strong&gt;KuberTENes 生日庆典 斯德哥尔摩&lt;/strong&gt;&lt;/a&gt;: 2024 年 9 月 5 日 | 斯德哥尔摩，瑞典&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-australia-presents-kcd-sydney-24/&#34;&gt;&lt;strong&gt;KCD Sydney ’24&lt;/strong&gt;&lt;/a&gt;: 2024 年 9 月 5-6 日 | 悉尼，澳大利亚&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-washington-dc-presents-kcd-washington-dc-2024/&#34;&gt;&lt;strong&gt;KCD Washington DC 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 9 月 24 日 | 华盛顿特区，美国&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-porto-presents-kcd-porto-2024/&#34;&gt;&lt;strong&gt;KCD Porto 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 9 月 27-28 日 | 波尔图，葡萄牙&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**October 2024**
- [**KCD Austria 2024**](https://community.cncf.io/events/details/cncf-kcd-austria-presents-kcd-austria-2024/): October 8-10, 2024 | Wien, Austria 
- [**KubeDay Australia**](https://events.linuxfoundation.org/kubeday-australia/): October 15, 2024 | Melbourne, Australia
- [**KCD UK - London 2024**](https://community.cncf.io/events/details/cncf-kcd-uk-presents-kubernetes-community-days-uk-london-2024/): October 22-23, 2024 | Greater London, United Kingdom
--&gt;
&lt;p&gt;&lt;strong&gt;2024 年 10 月&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-austria-presents-kcd-austria-2024/&#34;&gt;&lt;strong&gt;KCD Austria 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 10 月 8-10 日 | 维也纳，奥地利&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://events.linuxfoundation.org/kubeday-australia/&#34;&gt;&lt;strong&gt;KubeDay Australia&lt;/strong&gt;&lt;/a&gt;: 2024 年 10 月 15 日 | 墨尔本，澳大利亚&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://community.cncf.io/events/details/cncf-kcd-uk-presents-kubernetes-community-days-uk-london-2024/&#34;&gt;&lt;strong&gt;KCD UK - London 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 10 月 22-23 日 | 伦敦，英国&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**November 2024**
- [**KubeCon + CloudNativeCon North America 2024**](https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/): November 12-15, 2024 | Salt Lake City, United States
- [**Kubernetes on EDGE Day North America**](https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/co-located-events/kubernetes-on-edge-day/): November 12, 2024 | Salt Lake City, United States
--&gt;
&lt;p&gt;&lt;strong&gt;2024 年 11 月&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/&#34;&gt;&lt;strong&gt;KubeCon + CloudNativeCon North America 2024&lt;/strong&gt;&lt;/a&gt;: 2024 年 11 月 12-15 日 | 盐湖城，美国&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/co-located-events/kubernetes-on-edge-day/&#34;&gt;&lt;strong&gt;Kubernetes on EDGE Day North America&lt;/strong&gt;&lt;/a&gt;: 2024 年 11 月 12 日 | 盐湖城，美国&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Upcoming release webinar

Join members of the Kubernetes v1.31 release team on Thursday, Thu Sep 12, 2024 10am PT to learn about the major features of this release, as well as deprecations and removals to help plan for upgrades. 
For more information and registration, visit the [event page](https://community.cncf.io/events/details/cncf-cncf-online-programs-presents-cncf-live-webinar-kubernetes-131-release/) on the CNCF Online Programs site.
--&gt;
&lt;h2 id=&#34;即将举行的发布网络研讨会&#34;&gt;即将举行的发布网络研讨会&lt;/h2&gt;
&lt;p&gt;加入 Kubernetes v1.31 发布团队成员，于 2024 年 9 月 12 日星期四太平洋时间上午 10 点了解此版本的主要特性，以及废弃和移除的内容，以帮助规划升级。
有关更多信息和注册，请访问 CNCF 在线项目网站上的&lt;a href=&#34;https://community.cncf.io/events/details/cncf-cncf-online-programs-presents-cncf-live-webinar-kubernetes-131-release/&#34;&gt;活动页面&lt;/a&gt;。&lt;/p&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.

- Follow us on X [@Kubernetesio](https://x.com/kubernetesio) for 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 [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;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;）之一。
您有什么想向 Kubernetes 社区广播的内容吗？
在我们的每周&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/communication&#34;&gt;社区会议&lt;/a&gt;上分享您的声音，并通过以下渠道。
感谢您持续的反馈和支持。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在 X 上关注我们 &lt;a href=&#34;https://x.com/kubernetesio&#34;&gt;@Kubernetesio&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;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/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>向 Client-Go 引入特性门控：增强灵活性和控制力</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/12/feature-gates-in-client-go/</link>
      <pubDate>Mon, 12 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/12/feature-gates-in-client-go/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Introducing Feature Gates to Client-Go: Enhancing Flexibility and Control&#39;
date: 2024-08-12
slug: feature-gates-in-client-go
author: &gt;
 Ben Luddy (Red Hat),
 Lukasz Szaszkiewicz (Red Hat)
--&gt;
&lt;!--
Kubernetes components use on-off switches called _feature gates_ to manage the risk of adding a new feature.
The feature gate mechanism is what enables incremental graduation of a feature through the stages Alpha, Beta, and GA.
--&gt;
&lt;p&gt;Kubernetes 组件使用称为“特性门控（Feature Gates）”的开关来管理添加新特性的风险，
特性门控机制使特性能够通过 Alpha、Beta 和 GA 阶段逐步升级。&lt;/p&gt;
&lt;!--
Kubernetes components, such as kube-controller-manager and kube-scheduler, use the client-go library to interact with the API. 
The same library is used across the Kubernetes ecosystem to build controllers, tools, webhooks, and more. client-go now includes 
its own feature gating mechanism, giving developers and cluster administrators more control over how they adopt client features.
--&gt;
&lt;p&gt;Kubernetes 组件（例如 kube-controller-manager 和 kube-scheduler）使用 client-go 库与 API 交互，
整个 Kubernetes 生态系统使用相同的库来构建控制器、工具、webhook 等。
client-go 现在包含自己的特性门控机制，使开发人员和集群管理员能够更好地控制如何使用客户端特性。&lt;/p&gt;
&lt;!--
To learn more about feature gates in Kubernetes, visit [Feature Gates](/docs/reference/command-line-tools-reference/feature-gates/).
--&gt;
&lt;p&gt;要了解有关 Kubernetes 中特性门控的更多信息，请参阅&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Motivation

In the absence of client-go feature gates, each new feature separated feature availability from enablement in its own way, if at all. 
Some features were enabled by updating to a newer version of client-go. Others needed to be actively configured in each program that used them. 
A few were configurable at runtime using environment variables. Consuming a feature-gated functionality exposed by the kube-apiserver sometimes 
required a client-side fallback mechanism to remain compatible with servers that don’t support the functionality due to their age or configuration. 
In cases where issues were discovered in these fallback mechanisms, mitigation required updating to a fixed version of client-go or rolling back.
--&gt;
&lt;h2 id=&#34;动机&#34;&gt;动机&lt;/h2&gt;
&lt;p&gt;在没有 client-go 特性门控的情况下，每个新特性都以自己的方式（如果有的话）将特性可用性与特性的启用分开。
某些特性可通过更新到较新版本的 client-go 来启用，其他特性则需要在每个使用它们的程序中进行主动配置，
其中一些可在运行时使用环境变量进行配置。使用 kube-apiserver 公开的特性门控功能时，有时需要客户端回退机制，
以保持与由于版本新旧或配置不同而不支持该特性服务器的兼容性。
如果在这些回退机制中发现问题，则缓解措施需要更新到 client-go 的固定版本或回滚。&lt;/p&gt;
&lt;!--
None of these approaches offer good support for enabling a feature by default in some, but not all, programs that consume client-go. 
Instead of enabling a new feature at first only for a single component, a change in the default setting immediately affects the default 
for all Kubernetes components, which broadens the blast radius significantly.
--&gt;
&lt;p&gt;这些方法都无法很好地支持为某些（但不是全部）使用 client-go 的程序默认启用特性。
默认设置的更改不会首先仅为单个组件启用新特性，而是会立即影响所有 Kubernetes 组件的默认设置，从而大大扩大影响半径。&lt;/p&gt;
&lt;!--
## Feature gates in client-go

To address these challenges, substantial client-go features will be phased in using the new feature gate mechanism. 
It will allow developers and users to enable or disable features in a way that will be familiar to anyone who has experience 
with feature gates  in the Kubernetes components.
--&gt;
&lt;h2 id=&#34;client-go-中的特性门控&#34;&gt;client-go 中的特性门控&lt;/h2&gt;
&lt;p&gt;为了应对这些挑战，大量的 client-go 特性将使用新的特性门控机制来逐步引入。
这一机制将允许开发人员和用户以类似 Kubernetes 组件特性门控的管理方式启用或禁用特性。&lt;/p&gt;
&lt;!--
Out of the box, simply by using a recent version of client-go, this offers several benefits.

For people who use software built with client-go:
--&gt;
&lt;p&gt;作为一种开箱即用的能力，用户只需使用最新版本的 client-go。这种设计带来多种好处。&lt;/p&gt;
&lt;p&gt;对于使用通过 client-go 构建的软件的用户：&lt;/p&gt;
&lt;!--
* Early adopters can enable a default-off client-go feature on a per-process basis.
* Misbehaving features can be disabled without building a new binary.
* The state of all known client-go feature gates is logged, allowing users to inspect it.
--&gt;
&lt;ul&gt;
&lt;li&gt;早期采用者可以针对各个进程分别启用默认关闭的 client-go 特性。&lt;/li&gt;
&lt;li&gt;无需构建新的二进制文件即可禁用行为不当的特性。&lt;/li&gt;
&lt;li&gt;所有已知的 client-go 特性门控的状态都会被记录到日志中，允许用户检查。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For people who develop software built with client-go:

* By default, client-go feature gate overrides are read from environment variables. 
  If a bug is found in a client-go feature, users will be able to disable it without waiting for a new release.
* Developers can replace the default environment-variable-based overrides in a program to change defaults, 
  read overrides from another source, or disable runtime overrides completely. 
  The Kubernetes components use this customizability to integrate client-go feature gates with 
  the existing `--feature-gates` command-line flag, feature enablement metrics, and logging.
--&gt;
&lt;p&gt;对于开发使用 client-go 构建的软件的人员：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;默认情况下，client-go 特性门控覆盖是从环境变量中读取的。
如果在 client-go 特性中发现错误，用户将能够禁用它，而无需等待新版本发布。&lt;/li&gt;
&lt;li&gt;开发人员可以替换程序中基于默认环境变量的覆盖值以更改默认值、从其他源读取覆盖值或完全禁用运行时覆盖值。
Kubernetes 组件使用这种可定制性将 client-go 特性门控与现有的 &lt;code&gt;--feature-gates&lt;/code&gt; 命令行标志、特性启用指标和日志记录集成在一起。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Overriding client-go feature gates

**Note**: This describes the default method for overriding client-go feature gates at runtime. 
It can be disabled or customized by the developer of a particular program. 
In Kubernetes components, client-go feature gate overrides are controlled by the `--feature-gates` flag.

Features of client-go can be enabled or disabled by setting environment variables prefixed with `KUBE_FEATURE`. 
For example, to enable a feature named `MyFeature`, set the environment variable as follows:
--&gt;
&lt;h2 id=&#34;覆盖-client-go-特性门控&#34;&gt;覆盖 client-go 特性门控&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：这描述了在运行时覆盖 client-go 特性门控的默认方法，它可以由特定程序的开发人员禁用或自定义。
在 Kubernetes 组件中，client-go 特性门控覆盖由 &lt;code&gt;--feature-gates&lt;/code&gt; 标志控制。&lt;/p&gt;
&lt;p&gt;可以通过设置以 &lt;code&gt;KUBE_FEATURE&lt;/code&gt; 为前缀的环境变量来启用或禁用 client-go 的特性。
例如，要启用名为 &lt;code&gt;MyFeature&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;&lt;span style=&#34;color:#b8860b&#34;&gt;KUBE_FEATURE_MyFeature&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#a2f&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
To disable the feature, set the environment variable to `false`:
--&gt;
&lt;p&gt;要禁用特性，可将环境变量设置为 &lt;code&gt;false&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;&lt;span style=&#34;color:#b8860b&#34;&gt;KUBE_FEATURE_MyFeature&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#a2f&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
**Note**: Environment variables are case-sensitive on some operating systems. 
Therefore, `KUBE_FEATURE_MyFeature` and `KUBE_FEATURE_MYFEATURE` would be considered two different variables.
--&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：在某些操作系统上，环境变量区分大小写。
因此，&lt;code&gt;KUBE_FEATURE_MyFeature&lt;/code&gt; 和 &lt;code&gt;KUBE_FEATURE_MYFEATURE&lt;/code&gt; 将被视为两个不同的变量。&lt;/p&gt;
&lt;!--
## Customizing client-go feature gates

The default environment-variable based mechanism for feature gate overrides can be sufficient for many programs in the Kubernetes ecosystem, 
and requires no special integration. Programs that require different behavior can replace it with their own custom feature gate provider. 
This allows a program to do things like force-disable a feature that is known to work poorly, 
read feature gates directly from a remote configuration service, or accept feature gate overrides through command-line options.
--&gt;
&lt;h2 id=&#34;自定义-client-go-特性门控&#34;&gt;自定义 client-go 特性门控&lt;/h2&gt;
&lt;p&gt;基于环境变量的默认特性门控覆盖机制足以满足 Kubernetes 生态系统中许多程序的需求，无需特殊集成。
需要不同行为的程序可以用自己的自定义特性门控提供程序替换它。
这允许程序执行诸如强制禁用已知运行不良的特性、直接从远程配置服务读取特性门控或通过命令行选项接受特性门控覆盖等操作。&lt;/p&gt;
&lt;!--
The Kubernetes components replace client-go’s default feature gate provider with a shim to the existing Kubernetes feature gate provider. 
For all practical purposes, client-go feature gates are treated the same as other Kubernetes 
feature gates: they are wired to the `--feature-gates` command-line flag, included in feature enablement metrics, and logged on startup.
--&gt;
&lt;p&gt;Kubernetes 组件将 client-go 的默认特性门控提供程序替换为现有 Kubernetes 特性门控提供程序的转换层。
在所有实际应用场合中，client-go 特性门控与其他 Kubernetes 特性门控的处理方式相同：
它们连接到 &lt;code&gt;--feature-gates&lt;/code&gt; 命令行标志，包含在特性启用指标中，并在启动时记录。&lt;/p&gt;
&lt;!--
To replace the default feature gate provider, implement the Gates interface and call ReplaceFeatureGates 
at package initialization time, as in this simple example:
--&gt;
&lt;p&gt;要替换默认的特性门控提供程序，请实现 Gates 接口并在包初始化时调用 ReplaceFeatureGates，如以下简单示例所示：&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;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;k8s.io/client-go/features&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; AlwaysEnabledGates &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;
&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; (AlwaysEnabledGates) &lt;span style=&#34;color:#00a000&#34;&gt;Enabled&lt;/span&gt;(features.Feature) &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; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&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;init&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; features.&lt;span style=&#34;color:#00a000&#34;&gt;ReplaceFeatureGates&lt;/span&gt;(AlwaysEnabledGates{})
&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;!--
Implementations that need the complete list of defined client-go features can get it by implementing the Registry interface 
and calling `AddFeaturesToExistingFeatureGates`. 
For a complete example, refer to [the usage within Kubernetes](https://github.com/kubernetes/kubernetes/blob/64ba17c605a41700f7f4c4e27dca3684b593b2b9/pkg/features/kube_features.go#L990-L997).
--&gt;
&lt;p&gt;需要定义的 client-go 特性完整列表的实现可以通过实现 Registry 接口并调用 &lt;code&gt;AddFeaturesToExistingFeatureGates&lt;/code&gt; 来获取它。
完整示例请参考
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/64ba17c605a41700f7f4c4e27dca3684b593b2b9/pkg/features/kube_features.go#L990-L997&#34;&gt;Kubernetes 内部使用&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Summary

With the introduction of feature gates in client-go v1.30, rolling out a new client-go feature has become safer and easier. 
Users and developers can control the pace of their own adoption of client-go features. 
The work of Kubernetes contributors is streamlined by having a common mechanism for graduating features that span both sides of the Kubernetes API boundary.
--&gt;
&lt;h2 id=&#34;总结&#34;&gt;总结&lt;/h2&gt;
&lt;p&gt;随着 client-go v1.30 中特性门控的引入，推出新的 client-go 特性变得更加安全、简单。
用户和开发人员可以控制自己采用 client-go 特性的步伐。
通过为跨 Kubernetes API 边界两侧的特性提供一种通用的培育机制，Kubernetes 贡献者的工作得到了简化。&lt;/p&gt;
&lt;!--
Special shoutout to [@sttts](https://github.com/sttts) and [@deads2k](https://github.com/deads2k) for their help in shaping this feature.
--&gt;
&lt;p&gt;特别感谢 &lt;a href=&#34;https://github.com/sttts&#34;&gt;@sttts&lt;/a&gt; 和 &lt;a href=&#34;https://github.com/deads2k&#34;&gt;@deads2k&lt;/a&gt; 对此特性提供的帮助。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>聚焦 SIG API Machinery</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/07/sig-api-machinery-spotlight-2024/</link>
      <pubDate>Wed, 07 Aug 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/08/07/sig-api-machinery-spotlight-2024/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG API Machinery&#34;
slug: sig-api-machinery-spotlight-2024
canonicalUrl: https://www.kubernetes.dev/blog/2024/08/07/sig-api-machinery-spotlight-2024
date: 2024-08-07
author: &#34;Frederico Muñoz (SAS Institute)&#34;
--&gt;
&lt;!--
We recently talked with [Federico Bongiovanni](https://github.com/fedebongio) (Google) and [David
Eads](https://github.com/deads2k) (Red Hat), Chairs of SIG API Machinery, to know a bit more about
this Kubernetes Special Interest Group.
--&gt;
&lt;p&gt;我们最近与 SIG API Machinery 的主席
&lt;a href=&#34;https://github.com/fedebongio&#34;&gt;Federico Bongiovanni&lt;/a&gt;（Google）和
&lt;a href=&#34;https://github.com/deads2k&#34;&gt;David Eads&lt;/a&gt;（Red Hat）进行了访谈，
了解一些有关这个 Kubernetes 特别兴趣小组的信息。&lt;/p&gt;
&lt;!--
## Introductions

**Frederico (FSM): Hello, and thank your for your time. To start with, could you tell us about
yourselves and how you got involved in Kubernetes?**
--&gt;
&lt;h2 id=&#34;introductions&#34;&gt;介绍  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Frederico (FSM)：你好，感谢你抽时间参与访谈。首先，你能做个自我介绍以及你是如何参与到 Kubernetes 的？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**David**: I started working on
[OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) (the Red Hat
distribution of Kubernetes) in the fall of 2014 and got involved pretty quickly in API Machinery. My
first PRs were fixing kube-apiserver error messages and from there I branched out to `kubectl`
(_kubeconfigs_ are my fault!), `auth` ([RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) and `*Review` APIs are ports
from OpenShift), `apps` (_workqueues_ and _sharedinformers_ for example). Don’t tell the others,
but API Machinery is still my favorite :)
--&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：我在 2014 年秋天开始在
&lt;a href=&#34;https://www.redhat.com/zh/technologies/cloud-computing/openshift&#34;&gt;OpenShift&lt;/a&gt;
（Red Hat 的 Kubernetes 发行版）工作，很快就参与到 API Machinery 的工作中。
我的第一个 PR 是修复 kube-apiserver 的错误消息，然后逐渐扩展到 &lt;code&gt;kubectl&lt;/code&gt;（&lt;em&gt;kubeconfigs&lt;/em&gt; 是我的杰作！），
&lt;code&gt;auth&lt;/code&gt;（&lt;a href=&#34;https://kubernetes.io/zh-cn/docs/reference/access-authn-authz/rbac/&#34;&gt;RBAC&lt;/a&gt;
和 &lt;code&gt;*Review&lt;/code&gt; API 是从 OpenShift 移植过来的），&lt;code&gt;apps&lt;/code&gt;（例如 &lt;em&gt;workqueues&lt;/em&gt; 和 &lt;em&gt;sharedinformers&lt;/em&gt;）。
别告诉别人，但 API Machinery 仍然是我的最爱 :)&lt;/p&gt;
&lt;!--
**Federico**: I was not as early in Kubernetes as David, but now it&#39;s been more than six years. At
my previous company we were starting to use Kubernetes for our own products, and when I came across
the opportunity to work directly with Kubernetes I left everything and boarded the ship (no pun
intended). I joined Google and Kubernetes in early 2018, and have been involved since.
--&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：我加入 Kubernetes 没有 David 那么早，但现在也已经超过六年了。
在我之前的公司，我们开始为自己的产品使用 Kubernetes，当我有机会直接参与 Kubernetes 的工作时，
我放下了一切，登上了这艘船（无意双关）。我在 2018 年初加入 Google 从事 Kubernetes 的相关工作，
从那时起一直参与其中。&lt;/p&gt;
&lt;!--
## SIG Machinery&#39;s scope

**FSM: It only takes a quick look at the SIG API Machinery charter to see that it has quite a
significant scope, nothing less than the Kubernetes control plane. Could you describe this scope in
your own words?**
--&gt;
&lt;h2 id=&#34;sig-machinerys-scope&#34;&gt;SIG Machinery 的范围  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：只需快速浏览一下 SIG API Machinery 的章程，就可以看到它的范围相当广泛，
不亚于 Kubernetes 的控制平面。你能用自己的话描述一下这个范围吗？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**David**: We own the `kube-apiserver` and how to efficiently use it. On the backend, that includes
its contract with backend storage and how it allows API schema evolution over time.  On the
frontend, that includes schema best practices, serialization, client patterns, and controller
patterns on top of all of it.

**Federico**: Kubernetes has a lot of different components, but the control plane has a really
critical mission: it&#39;s your communication layer with the cluster and also owns all the extensibility
mechanisms that make Kubernetes so powerful. We can&#39;t make mistakes like a regression, or an
incompatible change, because the blast radius is huge.
--&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：我们全权负责 &lt;code&gt;kube-apiserver&lt;/code&gt; 以及如何高效地使用它。
在后端，这包括它与后端存储的契约以及如何让 API 模式随时间演变。
在前端，这包括模式的最佳实践、序列化、客户端模式以及在其之上的控制器模式。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：Kubernetes 有很多不同的组件，但控制平面有一个非常关键的任务：
它是你与集群的通信层，同时也拥有所有使 Kubernetes 如此强大的可扩展机制。
我们不能犯像回归或不兼容变更这样的错误，因为影响范围太大了。&lt;/p&gt;
&lt;!--
**FSM: Given this breadth, how do you manage the different aspects of it?**

**Federico**: We try to organize the large amount of work into smaller areas. The working groups and
subprojects are part of it. Different people on the SIG have their own areas of expertise, and if
everything fails, we are really lucky to have people like David, Joe, and Stefan who really are &#34;all
terrain&#34;, in a way that keeps impressing me even after all these years.  But on the other hand this
is the reason why we need more people to help us carry the quality and excellence of Kubernetes from
release to release.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：鉴于这个广度，你们如何管理它的不同方面？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：我们尝试将大量工作组织成较小的领域。工作组和子项目是其中的一部分。
SIG 中的各位贡献者有各自的专长领域，如果一切都失败了，我们很幸运有像 David、Joe 和 Stefan 这样的人，
他们真的是“全能型”，这种方式让我在这些年里一直感到惊叹。但另一方面，
这也是为什么我们需要更多人来帮助我们在版本变迁之时保持 Kubernetes 的质量和卓越。&lt;/p&gt;
&lt;!--
## An evolving collaboration model

**FSM: Was the existing model always like this, or did it evolve with time - and if so, what would
you consider the main changes and the reason behind them?**

**David**: API Machinery has evolved over time both growing and contracting in scope.  When trying
to satisfy client access patterns it’s very easy to add scope both in terms of features and applying
them.
--&gt;
&lt;h2 id=&#34;an-evolving-collaboration-model&#34;&gt;不断演变的协作模式  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：现有的模式一直是这样，还是随着时间的推移而演变的 - 如果是在演变的，你认为主要的变化以及背后的原因是什么？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：API Machinery 在随着时间的推移不断发展，既有扩展也有收缩。
在尝试满足客户端访问模式时，它很容易在特性和应用方面扩大范围。&lt;/p&gt;
&lt;!--
A good example of growing scope is the way that we identified a need to reduce memory utilization by
clients writing controllers and developed shared informers.  In developing shared informers and the
controller patterns use them (workqueues, error handling, and listers), we greatly reduced memory
utilization and eliminated many expensive lists.  The downside: we grew a new set of capability to
support and effectively took ownership of that area from sig-apps.
--&gt;
&lt;p&gt;一个范围扩大的好例子是我们认识到需要减少客户端写入控制器时的内存使用率而开发了共享通知器。
在开发共享通知器和使用它们的控制器模式（工作队列、错误处理和列举器）时，
我们大大减少了内存使用率，并消除了许多占用资源较多的列表。
缺点是：我们增加了一套新的权能来提供支持，并有效地从 sig-apps 接管了该领域的所有权。&lt;/p&gt;
&lt;!--
For an example of more shared ownership: building out cooperative resource management (the goal of
server-side apply), `kubectl` expanded to take ownership of leveraging the server-side apply
capability.  The transition isn’t yet complete, but [SIG
CLI](https://github.com/kubernetes/community/tree/master/sig-cli) manages that usage and owns it.
--&gt;
&lt;p&gt;一个更多共享所有权的例子是：构建出合作的资源管理（服务器端应用的目标），
&lt;code&gt;kubectl&lt;/code&gt; 扩展为负责利用服务器端应用的权能。这个过渡尚未完成，
但 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cli&#34;&gt;SIG CLI&lt;/a&gt; 管理其使用情况并拥有它。&lt;/p&gt;
&lt;!--
**FSM: And for the boundary between approaches, do you have any guidelines?**

**David**: I think much depends on the impact. If the impact is local in immediate effect, we advise
other SIGs and let them move at their own pace.  If the impact is global in immediate effect without
a natural incentive, we’ve found a need to press for adoption directly.

**FSM: Still on that note, SIG Architecture has an API Governance subproject, is it mostly
independent from SIG API Machinery or are there important connection points?**
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：对于方法之间的权衡，你们有什么指导方针吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：我认为这很大程度上取决于影响。如果影响在立即见效中是局部的，
我们会给其他 SIG 提出建议并让他们以自己的节奏推进。
如果影响在立即见效中是全局的且没有自然的激励，我们发现需要直接推动采用。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;FSM：仍然在这个话题上，SIG Architecture 有一个 API Governance 子项目，
它与 SIG API Machinery 是否完全独立，还是有重要的连接点？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**David**: The projects have similar sounding names and carry some impacts on each other, but have
different missions and scopes.  API Machinery owns the how and API Governance owns the what.  API
conventions, the API approval process, and the final say on individual k8s.io APIs belong to API
Governance.  API Machinery owns the REST semantics and non-API specific behaviors.

**Federico**: I really like how David put it: *&#34;API Machinery owns the how and API Governance owns
the what&#34;*: we don&#39;t own the actual APIs, but the actual APIs live through us.
--&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：这些项目有相似的名称并对彼此产生一些影响，但有不同的使命和范围。
API Machinery 负责“如何做”，而 API Governance 负责“做什么”。
API 约定、API 审批过程以及对单个 k8s.io API 的最终决定权属于 API Governance。
API Machinery 负责 REST 语义和非 API 特定行为。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：我真得很喜欢 David 的说法：
&lt;strong&gt;“API Machinery 负责‘如何做’，而 API Governance 负责‘做什么’”&lt;/strong&gt;：
我们并未拥有实际的 API，但实际的 API 依靠我们存在。&lt;/p&gt;
&lt;!--
## The challenges of Kubernetes popularity

**FSM: With the growth in Kubernetes adoption we have certainly seen increased demands from the
Control Plane: how is this felt and how does it influence the work of the SIG?**

**David**: It’s had a massive influence on API Machinery.  Over the years we have often responded to
and many times enabled the evolutionary stages of Kubernetes.  As the central orchestration hub of
nearly all capability on Kubernetes clusters, we both lead and follow the community.  In broad
strokes I see a few evolution stages for API Machinery over the years, with constantly high
activity.
--&gt;
&lt;h2 id=&#34;the-challenge-of-kubernetes-popularity&#34;&gt;Kubernetes 受欢迎的挑战  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：随着 Kubernetes 的采用率上升，我们肯定看到了对控制平面的需求增加：你们对这点的感受如何，它如何影响 SIG 的工作？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：这对 API Machinery 产生了巨大的影响。多年来，我们经常响应并多次促进了 Kubernetes 的发展阶段。
作为几乎所有 Kubernetes 集群上权能的集中编排中心，我们既领导又跟随社区。
从广义上讲，我看到多年来 API Machinery 经历了一些发展阶段，活跃度一直很高。&lt;/p&gt;
&lt;!--
1. **Finding purpose**: `pre-1.0` up until `v1.3` (up to our first 1000+ nodes/namespaces) or
   so. This time was characterized by rapid change.  We went through five different versions of our
   schemas and rose to meet the need.  We optimized for quick, in-tree API evolution (sometimes to
   the detriment of longer term goals), and defined patterns for the first time.

2. **Scaling to meet the need**: `v1.3-1.9` (up to shared informers in controllers) or so.  When we
   started trying to meet customer needs as we gained adoption, we found severe scale limitations in
   terms of CPU and memory. This was where we broadened API machinery to include access patterns, but
   were still heavily focused on in-tree types.  We built the watch cache, protobuf serialization,
   and shared caches.
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;寻找目标&lt;/strong&gt;：从 &lt;code&gt;pre-1.0&lt;/code&gt; 到 &lt;code&gt;v1.3&lt;/code&gt;（我们达到了第一个 1000+ 节点/命名空间）。
这段时间以快速变化为特征。我们经历了五个不同版本的模式，并满足了需求。
我们优化了快速、树内 API 的演变（有时以牺牲长期目标为代价），并首次定义了模式。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;满足需求的扩展&lt;/strong&gt;：&lt;code&gt;v1.3-1.9&lt;/code&gt;（直到控制器中的共享通知器）。
当我们开始尝试满足客户需求时，我们发现了严重的 CPU 和内存规模限制。
这也是为什么我们将 API Machinery 扩展到包含访问模式，但我们仍然非常关注树内类型。
我们构建了 watch 缓存、protobuf 序列化和共享缓存。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. **Fostering the ecosystem**: `v1.8-1.21` (up to CRD v1) or so.  This was when we designed and wrote
   CRDs (the considered replacement for third-party-resources), the immediate needs we knew were
   coming (admission webhooks), and evolution to best practices we knew we needed (API schemas).
   This enabled an explosion of early adopters willing to work very carefully within the constraints
   to enable their use-cases for servicing pods.  The adoption was very fast, sometimes outpacing
   our capability, and creating new problems.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;&lt;strong&gt;培育生态系统&lt;/strong&gt;：&lt;code&gt;v1.8-1.21&lt;/code&gt;（直到 CRD v1）。这是我们设计和编写 CRD（视为第三方资源的替代品）的时间，
满足我们知道即将到来的即时需求（准入 Webhook），以及我们知道需要的最佳实践演变（API 模式）。
这促成了早期采用者的爆发式增长，他们愿意在约束内非常谨慎地工作，以实现服务 Pod 的用例。
采用速度非常快，有时超出了我们的权能，并形成了新的问题。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
4. **Simplifying deployments**: `v1.22+`.  In the relatively recent past, we’ve been responding to
   pressures or running kube clusters at scale with large numbers of sometimes-conflicting ecosystem
   projects using our extensions mechanisms.  Lots of effort is now going into making platform
   extensions easier to write and safer to manage by people who don&#39;t hold PhDs in kubernetes.  This
   started with things like server-side-apply and continues today with features like webhook match
   conditions and validating admission policies.
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;&lt;strong&gt;简化部署&lt;/strong&gt;：&lt;code&gt;v1.22+&lt;/code&gt;。在不久之前，
我们采用扩展机制来响应运行大规模的 Kubernetes 集群的压力，其中包含大量有时会发生冲突的生态系统项目。
我们投入了许多努力，使平台更易于扩展，管理更安全，就算不是很精通 Kubernetes 的人也能做到。
这些努力始于服务器端应用，并在如今延续到 Webhook 匹配状况和验证准入策略等特性。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Work in API Machinery has a broad impact across the project and the ecosystem.  It’s an exciting
area to work for those able to make a significant time investment on a long time horizon.

## The road ahead

**FSM: With those different evolutionary stages in mind, what would you pinpoint as the top
priorities for the SIG at this time?**
--&gt;
&lt;p&gt;API Machinery 的工作对整个项目和生态系统有广泛的影响。
对于那些能够长期投入大量时间的人来说，这是一个令人兴奋的工作领域。&lt;/p&gt;
&lt;h2 id=&#34;the-road-ahead&#34;&gt;未来发展  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：考虑到这些不同的发展阶段，你能说说这个 SIG 的当前首要任务是什么吗？&lt;/strong&gt;&lt;/p&gt;
&lt;!--
**David:** **Reliability, efficiency, and capability** in roughly that order.

With the increased usage of our `kube-apiserver` and extensions mechanisms, we find that our first
set of extensions mechanisms, while fairly complete in terms of capability, carry significant risks
in terms of potential mis-use with large blast radius.  To mitigate these risks, we’re investing in
features that reduce the blast radius for accidents (webhook match conditions) and which provide
alternative mechanisms with lower risk profiles for most actions (validating admission policy).
--&gt;
&lt;p&gt;&lt;strong&gt;David&lt;/strong&gt;：大致的顺序为&lt;strong&gt;可靠性、效率和权能&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;随着 &lt;code&gt;kube-apiserver&lt;/code&gt; 和扩展机制的使用增加，我们发现第一套扩展机制虽然在权能方面相当完整，
但在潜在误用方面存在重大风险，影响范围很大。为了减轻这些风险，我们正在致力于减少事故影响范围的特性
（Webhook 匹配状况）以及为大多数操作提供风险配置较低的替代机制（验证准入策略）。&lt;/p&gt;
&lt;!--
At the same time, the increased usage has made us more aware of scaling limitations that we can
improve both server and client-side.  Efforts here include more efficient serialization (CBOR),
reduced etcd load (consistent reads from cache), and reduced peak memory usage (streaming lists).

And finally, the increased usage has highlighted some long existing
gaps that we’re closing.  Things like field selectors for CRDs which
the [Batch Working Group](https://github.com/kubernetes/community/blob/master/wg-batch/README.md)
is eager to leverage and will eventually form the basis for a new way
to prevent trampoline pod attacks from exploited nodes.
--&gt;
&lt;p&gt;同时，使用量的增加使我们更加意识到我们可以同时改进服务器端和客户端的扩缩限制。
这里的努力包括更高效的序列化（CBOR），减少 etcd 负载（从缓存中一致读取）和减少峰值内存使用量（流式列表）。&lt;/p&gt;
&lt;p&gt;最后，使用量的增加突显了一些长期存在的、我们正在设法填补的差距。这些包括针对 CRD 的字段选择算符，
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/wg-batch/README.md&#34;&gt;Batch Working Group&lt;/a&gt;
渴望利用这些选择算符，并最终构建一种新的方法以防止从有漏洞的节点实施“蹦床式”的 Pod 攻击。&lt;/p&gt;
&lt;!--
## Joining the fun

**FSM: For anyone wanting to start contributing, what&#39;s your suggestions?**

**Federico**: SIG API Machinery is not an exception to the Kubernetes motto: **Chop Wood and Carry
Water**. There are multiple weekly meetings that are open to everybody, and there is always more
work to be done than people to do it.
--&gt;
&lt;h2 id=&#34;joining-the-fun&#34;&gt;加入有趣的我们  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM：如果有人想要开始贡献，你有什么建议？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：SIG API Machinery 毫不例外也遵循 Kubernetes 的风格：&lt;strong&gt;砍柴和挑水（踏实工作，注重细节）&lt;/strong&gt;。
有多个每周例会对所有人开放，总是有更多的工作要做，人手总是不够。&lt;/p&gt;
&lt;!--
I acknowledge that API Machinery is not easy, and the ramp up will be steep. The bar is high,
because of the reasons we&#39;ve been discussing: we carry a huge responsibility. But of course with
passion and perseverance many people has ramped up through the years, and we hope more will come.

In terms of concrete opportunities, there is the SIG meeting every two weeks. Everyone is welcome to
attend and listen, see what the group talks about, see what&#39;s going on in this release, etc.
--&gt;
&lt;p&gt;我承认 API Machinery 并不容易，入门的坡度会比较陡峭。门槛较高，就像我们所讨论的原因：我们肩负着巨大的责任。
当然凭借激情和毅力，多年来有许多人已经跟了上来，我们希望更多的人加入。&lt;/p&gt;
&lt;p&gt;具体的机会方面，每两周有一次 SIG 会议。欢迎所有人参会和听会，了解小组在讨论什么，了解这个版本中发生了什么等等。&lt;/p&gt;
&lt;!--
Also two times a week, Tuesday and Thursday, we have the public Bug Triage, where we go through
everything new from the last meeting. We&#39;ve been keeping this practice for more than 7 years
now. It&#39;s a great opportunity to volunteer to review code, fix bugs, improve documentation,
etc. Tuesday&#39;s it&#39;s at 1 PM (PST) and Thursday is on an EMEA friendly time (9:30 AM PST).  We are
always looking to improve, and we hope to be able to provide more concrete opportunities to join and
participate in the future.
--&gt;
&lt;p&gt;此外，每周两次，周二和周四，我们有公开的 Bug 分类管理会，在会上我们会讨论上次会议以来的所有新内容。
我们已经保持这种做法 7 年多了。这是一个很好的机会，你可以志愿审查代码、修复 Bug、改进文档等。
周二的会议在下午 1 点（PST），周四是在 EMEA 友好时间（上午 9:30 PST）。
我们总是在寻找改进的机会，希望能够在未来提供更多具体的参与机会。&lt;/p&gt;
&lt;!--
**FSM: Excellent, thank you! Any final comments you would like to share with our readers?**

**Federico**: As I mentioned, the first steps might be hard, but the reward is also larger. Working
on API Machinery is working on an area of huge impact (millions of users?), and your contributions
will have a direct outcome in the way that Kubernetes works and the way that it&#39;s used. For me
that&#39;s enough reward and motivation!
--&gt;
&lt;p&gt;&lt;strong&gt;FSM：太好了，谢谢！你们还有什么想与我们的读者分享吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Federico&lt;/strong&gt;：正如我提到的，第一步可能较难，但回报也更大。
参与 API Machinery 的工作就是在加入一个影响巨大（百万用户？）的领域，
你的贡献将直接影响 Kubernetes 的工作方式和使用方式。对我来说，这已经足够作为回报和动力了！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.31 中的移除和主要变更</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/07/19/kubernetes-1-31-upcoming-changes/</link>
      <pubDate>Fri, 19 Jul 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/07/19/kubernetes-1-31-upcoming-changes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes Removals and Major Changes In v1.31&#39;
date: 2024-07-19
slug: kubernetes-1-31-upcoming-changes
author: &gt;
  Abigail McCarthy,
  Edith Puclla,
  Matteo Bianchi,
  Rashan Smith,
  Yigit Demirbas 
--&gt;
&lt;!--
As Kubernetes develops and matures, features may be deprecated, removed, or replaced with better ones for the project&#39;s overall health. 
This article outlines some planned changes for the Kubernetes v1.31 release that the release team feels you should be aware of for the continued maintenance of your Kubernetes environment. 
The information listed below is based on the current status of the v1.31 release. 
It may change before the actual release date. 
--&gt;
&lt;p&gt;随着 Kubernetes 的发展和成熟，为了项目的整体健康，某些特性可能会被弃用、删除或替换为更好的特性。
本文阐述了 Kubernetes v1.31 版本的一些更改计划，发行团队认为你应当了解这些更改，
以便持续维护 Kubernetes 环境。
下面列出的信息基于 v1.31 版本的当前状态；这些状态可能会在实际发布日期之前发生变化。&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. 
It will continue to function until removal (at least one year from the deprecation), but usage will display a warning. 
Removed APIs are no longer available in the current version, so 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-50011--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 在当前版本中不再可用，因此你必须将其迁移到替换版本。&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.
--&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 because a feature graduated 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 [documentation](/docs/reference/using-api/deprecation-guide/).
--&gt;
&lt;p&gt;无论 API 是因为某个特性从 Beta 版升级到稳定版，还是因为此 API 未成功而被删除，所有删除都将符合此弃用策略。
每当删除 API 时，迁移选项都会在&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/&#34;&gt;文档&lt;/a&gt;中传达。&lt;/p&gt;
&lt;!--
## A note about SHA-1 signature support

In [go1.18](https://go.dev/doc/go1.18#sha1) (released in March 2022), the crypto/x509 library started to reject certificates signed with a SHA-1 hash function. 
While SHA-1 is established to be unsafe and publicly trusted Certificate Authorities have not issued SHA-1 certificates since 2015, there might still be cases in the context of Kubernetes where user-provided certificates are signed using a SHA-1 hash function through private authorities with them being used for Aggregated API Servers or webhooks. 
If you have relied on SHA-1 based certificates, you must explicitly opt back into its support by setting `GODEBUG=x509sha1=1` in your environment.
--&gt;
&lt;h2 id=&#34;关于-sha-1-签名支持的说明&#34;&gt;关于 SHA-1 签名支持的说明&lt;/h2&gt;
&lt;p&gt;在 &lt;a href=&#34;https://go.dev/doc/go1.18#sha1&#34;&gt;go1.18&lt;/a&gt;（2022 年 3 月发布）中，crypto/x509
库开始拒绝使用 SHA-1 哈希函数签名的证书。
虽然 SHA-1 被确定为不安全，并且公众信任的证书颁发机构自 2015 年以来就没有颁发过 SHA-1 证书，
但在 Kubernetes 环境中，仍可能存在用户提供的证书通过私人颁发机构使用 SHA-1 哈希函数签名的情况，
这些证书用于聚合 API 服务器或 Webhook。
如果你依赖基于 SHA-1 的证书，则必须通过在环境中设置 &lt;code&gt;GODEBUG=x509sha1=1&lt;/code&gt; 以明确选择重新支持这种证书。&lt;/p&gt;
&lt;!--
Given Go&#39;s [compatibility policy for GODEBUGs](https://go.dev/blog/compat), the `x509sha1` GODEBUG and the support for SHA-1 certificates will [fully go away in go1.24](https://tip.golang.org/doc/go1.23) which will be released in the first half of 2025. 
If you rely on SHA-1 certificates, please start moving off them.

Please see [Kubernetes issue #125689](https://github.com/kubernetes/kubernetes/issues/125689) to get a better idea of timelines around the support for SHA-1 going away, when Kubernetes releases plans to adopt go1.24, and for more details on how to detect usage of SHA-1 certificates via metrics and audit logging. 
--&gt;
&lt;p&gt;鉴于 Go 的 &lt;a href=&#34;https://go.dev/blog/compat&#34;&gt;GODEBUG 兼容性策略&lt;/a&gt;，&lt;code&gt;x509sha1&lt;/code&gt; GODEBUG
和对 SHA-1 证书的支持将 &lt;a href=&#34;https://tip.golang.org/doc/go1.23&#34;&gt;在 2025 年上半年发布的 go1.24&lt;/a&gt;
中完全消失。
如果你依赖 SHA-1 证书，请开始放弃使用它们。&lt;/p&gt;
&lt;p&gt;请参阅 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/125689&#34;&gt;Kubernetes 问题 #125689&lt;/a&gt;，
以更好地了解对 SHA-1 支持的时间表，以及 Kubernetes 发布采用 go1.24
的计划时间、如何通过指标和审计日志检测 SHA-1 证书使用情况的更多详细信息。&lt;/p&gt;
&lt;!--
## Deprecations and removals in Kubernetes 1.31

### Deprecation of `status.nodeInfo.kubeProxyVersion` field for Nodes ([KEP 4004](https://github.com/kubernetes/enhancements/issues/4004))
--&gt;
&lt;h2 id=&#34;kubernetes-1-31-中的弃用和删除&#34;&gt;Kubernetes 1.31 中的弃用和删除&lt;/h2&gt;
&lt;h3 id=&#34;弃用节点的-status-nodeinfo-kubeproxyversion-字段-kep-4004-https-github-com-kubernetes-enhancements-issues-4004&#34;&gt;弃用节点的 &lt;code&gt;status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段（&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4004&#34;&gt;KEP 4004&lt;/a&gt;）&lt;/h3&gt;
&lt;!--
The `.status.nodeInfo.kubeProxyVersion` field of Nodes is being deprecated in Kubernetes v1.31,and will be removed in a later release.
It&#39;s being deprecated because the value of this field wasn&#39;t (and isn&#39;t) accurate.
This field is set by the kubelet, which does not have reliable information about the kube-proxy version or whether kube-proxy is running.

The `DisableNodeKubeProxyVersion` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) will be set to `true` in by default in v1.31 and the kubelet will no longer attempt to set the `.status.kubeProxyVersion` field for its associated Node.
--&gt;
&lt;p&gt;Node 的 &lt;code&gt;.status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段在 Kubernetes v1.31 中将被弃用，
并将在后续版本中删除。该字段被弃用是因为其取值原来不准确，并且现在也不准确。
该字段由 kubelet 设置，而 kubelet 没有关于 kube-proxy 版本或 kube-proxy 是否正在运行的可靠信息。&lt;/p&gt;
&lt;p&gt;在 v1.31 中，&lt;code&gt;DisableNodeKubeProxyVersion&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;将默认设置为 &lt;code&gt;true&lt;/code&gt;，
并且 kubelet 将不再尝试为其关联的 Node 设置 &lt;code&gt;.status.kubeProxyVersion&lt;/code&gt; 字段。&lt;/p&gt;
&lt;!--
### Removal of all in-tree integrations with cloud providers

As highlighted in a [previous article](/blog/2024/05/20/completing-cloud-provider-migration/), the last remaining in-tree support for cloud provider integration will be removed as part of the v1.31 release.
This doesn&#39;t mean you can&#39;t integrate with a cloud provider, however you now **must** use the
recommended approach using an external integration. Some integrations are part of the Kubernetes
project and others are third party software.
--&gt;
&lt;h3 id=&#34;删除所有云驱动的树内集成组件&#34;&gt;删除所有云驱动的树内集成组件&lt;/h3&gt;
&lt;p&gt;正如&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2024/05/20/completing-cloud-provider-migration/&#34;&gt;之前一篇文章&lt;/a&gt;中所强调的，
v1.31 版本将删除云驱动集成的树内支持的最后剩余部分。
这并不意味着你无法与某云驱动集成，只是你现在&lt;strong&gt;必须&lt;/strong&gt;使用推荐的外部集成方法。
一些集成组件是 Kubernetes 项目的一部分，其余集成组件则是第三方软件。&lt;/p&gt;
&lt;!--
This milestone marks the completion of the externalization process for all cloud providers&#39; integrations from the Kubernetes core ([KEP-2395](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md)), a process started with Kubernetes v1.26. 
This change helps Kubernetes to get closer to being a truly vendor-neutral platform.

For further details on the cloud provider integrations, read our [v1.29 Cloud Provider Integrations feature blog](/blog/2023/12/14/cloud-provider-integration-changes/). 
For additional context about the in-tree code removal, we invite you to check the ([v1.29 deprecation blog](/blog/2023/11/16/kubernetes-1-29-upcoming-changes/#removal-of-in-tree-integrations-with-cloud-providers-kep-2395-https-kep-k8s-io-2395)).

The latter blog also contains useful information for users who need to migrate to version v1.29 and later.
--&gt;
&lt;p&gt;这一里程碑标志着将所有云驱动集成组件从 Kubernetes 核心外部化的过程已经完成
（&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md&#34;&gt;KEP-2395&lt;/a&gt;），
该过程从 Kubernetes v1.26 开始。
这一变化有助于 Kubernetes 进一步成为真正的供应商中立平台。&lt;/p&gt;
&lt;p&gt;有关云驱动集成的更多详细信息，请阅读我们的 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/14/cloud-provider-integration-changes/&#34;&gt;v1.29 云驱动集成特性的博客&lt;/a&gt;。
有关树内代码删除的更多背景信息，请阅读
（&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/11/16/kubernetes-1-29-upcoming-changes/#removal-of-in-tree-integrations-with-cloud-providers-kep-2395-https-kep-k8s-io-2395&#34;&gt;v1.29 弃用博客&lt;/a&gt;）。&lt;/p&gt;
&lt;p&gt;后一个博客还包含对需要迁移到 v1.29 及更高版本的用户有用的信息。&lt;/p&gt;
&lt;!--
### Removal of kubelet `--keep-terminated-pod-volumes` command line flag

The kubelet flag `--keep-terminated-pod-volumes`, which was deprecated in 2017, will be removed as
part of the v1.31 release.

You can find more details in the pull request [#122082](https://github.com/kubernetes/kubernetes/pull/122082).
--&gt;
&lt;h3 id=&#34;删除-kubelet-keep-terminated-pod-volumes-命令行标志&#34;&gt;删除 kubelet &lt;code&gt;--keep-terminated-pod-volumes&lt;/code&gt; 命令行标志&lt;/h3&gt;
&lt;p&gt;kubelet 标志 &lt;code&gt;--keep-terminated-pod-volumes&lt;/code&gt; 已于 2017 年弃用，将在 v1.31 版本中被删除。&lt;/p&gt;
&lt;p&gt;你可以在拉取请求 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/122082&#34;&gt;#122082&lt;/a&gt;
中找到更多详细信息。&lt;/p&gt;
&lt;!--
### Removal of CephFS volume plugin 

[CephFS volume plugin](/docs/concepts/storage/volumes/#cephfs) was removed in this release and the `cephfs` volume type became non-functional. 

It is recommended that you use the [CephFS CSI driver](https://github.com/ceph/ceph-csi/) as a third-party storage driver instead. If you were using the CephFS volume plugin before upgrading the cluster version to v1.31, you must re-deploy your application to use the new driver.

CephFS volume plugin was formally marked as deprecated in v1.28.
--&gt;
&lt;h3 id=&#34;删除-cephfs-卷插件&#34;&gt;删除 CephFS 卷插件&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#cephfs&#34;&gt;CephFS 卷插件&lt;/a&gt;已在此版本中删除，
并且 &lt;code&gt;cephfs&lt;/code&gt; 卷类型已无法使用。&lt;/p&gt;
&lt;p&gt;建议你改用 &lt;a href=&#34;https://github.com/ceph/ceph-csi/&#34;&gt;CephFS CSI 驱动程序&lt;/a&gt; 作为第三方存储驱动程序。
如果你在将集群版本升级到 v1.31 之前在使用 CephFS 卷插件，则必须重新部署应用才能使用新驱动。&lt;/p&gt;
&lt;p&gt;CephFS 卷插件在 v1.28 中正式标记为已弃用。&lt;/p&gt;
&lt;!--
### Removal of Ceph RBD volume plugin

The v1.31 release will remove the [Ceph RBD volume plugin](/docs/concepts/storage/volumes/#rbd) and its CSI migration support, making the `rbd` volume type non-functional.

It&#39;s recommended that you use the [RBD CSI driver](https://github.com/ceph/ceph-csi/) in your clusters instead. 
If you were using Ceph RBD volume plugin before upgrading the cluster version to v1.31, you must re-deploy your application to use the new driver.

The Ceph RBD volume plugin was formally marked as deprecated in v1.28.
--&gt;
&lt;h3 id=&#34;删除-ceph-rbd-卷插件&#34;&gt;删除 Ceph RBD 卷插件&lt;/h3&gt;
&lt;p&gt;v1.31 版本将删除 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#rbd&#34;&gt;Ceph RBD 卷插件&lt;/a&gt;及其 CSI 迁移支持，
&lt;code&gt;rbd&lt;/code&gt; 卷类型将无法继续使用。&lt;/p&gt;
&lt;p&gt;建议你在集群中使用 &lt;a href=&#34;https://github.com/ceph/ceph-csi/&#34;&gt;RBD CSI 驱动&lt;/a&gt;。
如果你在将集群版本升级到 v1.31 之前在使用 Ceph RBD 卷插件，则必须重新部署应用以使用新驱动。&lt;/p&gt;
&lt;p&gt;Ceph RBD 卷插件在 v1.28 中正式标记为已弃用。&lt;/p&gt;
&lt;!--
### Deprecation of non-CSI volume limit plugins in kube-scheduler

The v1.31 release will deprecate all non-CSI volume limit scheduler plugins, and will remove some
already deprected plugins from the [default plugins](/docs/reference/scheduling/config/), including:
--&gt;
&lt;h3 id=&#34;kube-scheduler-中非-csi-卷限制插件的弃用&#34;&gt;kube-scheduler 中非 CSI 卷限制插件的弃用&lt;/h3&gt;
&lt;p&gt;v1.31 版本将弃用所有非 CSI 卷限制调度程序插件，
并将从&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/scheduling/config/&#34;&gt;默认插件&lt;/a&gt;中删除一些已弃用的插件，包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AzureDiskLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CinderLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EBSLimits&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GCEPDLimits&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
It&#39;s recommended that you use the `NodeVolumeLimits` plugin instead because it can handle the same functionality as the removed plugins since those volume types have been migrated to CSI. 
Please replace the deprecated plugins with the `NodeVolumeLimits` plugin if you explicitly use them in the [scheduler config](/docs/reference/scheduling/config/). 
The `AzureDiskLimits`, `CinderLimits`, `EBSLimits`, and `GCEPDLimits` plugins will be removed in a future release.

These plugins will be removed from the default scheduler plugins list as they have been deprecated since Kubernetes v1.14.
--&gt;
&lt;p&gt;建议你改用 &lt;code&gt;NodeVolumeLimits&lt;/code&gt; 插件，因为它可以处理与已删除插件相同的功能，因为这些卷类型已迁移到 CSI。
如果你在&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/scheduling/config/&#34;&gt;调度器配置&lt;/a&gt;中显式使用已弃用的插件，
请用 &lt;code&gt;NodeVolumeLimits&lt;/code&gt; 插件替换它们。
&lt;code&gt;AzureDiskLimits&lt;/code&gt;、&lt;code&gt;CinderLimits&lt;/code&gt;、&lt;code&gt;EBSLimits&lt;/code&gt; 和 &lt;code&gt;GCEPDLimits&lt;/code&gt; 插件将在未来的版本中被删除。&lt;/p&gt;
&lt;p&gt;这些插件将从默认调度程序插件列表中删除，因为它们自 Kubernetes v1.14 以来已被弃用。&lt;/p&gt;
&lt;!--
## Looking ahead
The official list of API removals planned for [Kubernetes v1.32](/docs/reference/using-api/deprecation-guide/#v1-32) include:

* The `flowcontrol.apiserver.k8s.io/v1beta3` API version of FlowSchema and PriorityLevelConfiguration will be 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;h2 id=&#34;展望未来&#34;&gt;展望未来&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-50011--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;ul&gt;
&lt;li&gt;将删除 &lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; API 版本的 FlowSchema 和 PriorityLevelConfiguration。
为了做好准备，你可以编辑现有清单并重写客户端软件以使用自 v1.29 起可用的 &lt;code&gt;flowcontrol.apiserver.k8s.io/v1 API&lt;/code&gt; 版本。
所有现有的持久化对象都可以通过新 API 访问。&lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; 中需要注意的变化包括优先级配置
&lt;code&gt;spec.limited.nominalConcurrencyShares&lt;/code&gt; 字段仅在未指定时默认为 30，并且显式设置为 0 的话不会被更改为 30。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有关更多信息，请参阅 &lt;a href=&#34;https://deploy-preview-50011--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;!--
## Want to know more?
The Kubernetes release notes announce deprecations. 
We will formally announce the deprecations in [Kubernetes v1.31](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md#deprecation) as part of the CHANGELOG for that release.

You can see the announcements of pending deprecations 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.31.md#deprecation&#34;&gt;Kubernetes v1.31&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.30.md#deprecation&#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#deprecation&#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#deprecation&#34;&gt;Kubernetes v1.28&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.27.md#deprecation&#34;&gt;Kubernetes v1.27&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 的十年</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/</link>
      <pubDate>Thu, 06 Jun 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;10 Years of Kubernetes&#34;
date: 2024-06-06
slug: 10-years-of-kubernetes
author: &gt;
  [Bob Killen](https://github.com/mrbobbytables) (CNCF),
  [Chris Short](https://github.com/chris-short) (AWS),
  [Frederico Muñoz](https://github.com/fsmunoz) (SAS),
  [Kaslin Fields](https://github.com/kaslin) (Google),
  [Tim Bannister](https://github.com/sftim) (The Scale Factory),
  and every contributor across the globe
--&gt;
&lt;!--
![KCSEU 2024 group photo](kcseu2024.jpg)

Ten (10) years ago, on June 6th, 2014, the
[first commit](https://github.com/kubernetes/kubernetes/commit/2c4b3a562ce34cddc3f8218a2c4d11c7310e6d56)
of Kubernetes was pushed to GitHub. That first commit with 250 files and 47,501 lines of go, bash
and markdown kicked off the project we have today. Who could have predicted that 10 years later,
Kubernetes would grow to become one of the largest Open Source projects to date with over
[88,000 contributors](https://k8s.devstats.cncf.io/d/24/overall-project-statistics?orgId=1) from
more than [8,000 companies](https://www.cncf.io/reports/kubernetes-project-journey-report/), across
44 countries.
--&gt;
&lt;p&gt;&lt;img alt=&#34;KCSEU 2024 团体照片&#34; src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/kcseu2024.jpg&#34;&gt;&lt;/p&gt;
&lt;p&gt;十年前的 2014 年 6 月 6 日，Kubernetes
的&lt;a href=&#34;https://github.com/kubernetes/kubernetes/commit/2c4b3a562ce34cddc3f8218a2c4d11c7310e6d56&#34;&gt;第一次提交&lt;/a&gt;被推送到 GitHub。
第一次提交包含了 250 个文件和 47,501 行的 Go、Bash 和 Markdown 代码，
开启了我们今天所拥有的项目。谁能预测到 10 年后，Kubernetes 会成长为迄今为止最大的开源项目之一，
拥有来自超过 8,000 家公司、来自 44 个国家的
&lt;a href=&#34;https://k8s.devstats.cncf.io/d/24/overall-project-statistics?orgId=1&#34;&gt;88,000 名贡献者&lt;/a&gt;。&lt;/p&gt;
&lt;img src=&#34;kcscn2019.jpg&#34; alt=&#34;KCSCN 2019&#34; class=&#34;left&#34; style=&#34;max-width: 20em; margin: 1em&#34; &gt;
&lt;!--
This milestone isn&#39;t just for Kubernetes but for the Cloud Native ecosystem that blossomed from
it. There are close to [200 projects](https://all.devstats.cncf.io/d/18/overall-project-statistics-table?orgId=1)
within the CNCF itself, with contributions from
[240,000+ individual contributors](https://all.devstats.cncf.io/d/18/overall-project-statistics-table?orgId=1) and
thousands more in the greater ecosystem. Kubernetes would not be where it is today without them, the
[7M+ Developers](https://www.cncf.io/blog/2022/05/18/slashdata-cloud-native-continues-to-grow-with-more-than-7-million-developers-worldwide/),
and the even larger user community that have all helped shape the ecosystem that it is today.
--&gt;
&lt;p&gt;这一里程碑不仅属于 Kubernetes，也属于由此蓬勃发展的云原生生态系统。
在 CNCF 本身就有近 &lt;a href=&#34;https://all.devstats.cncf.io/d/18/overall-project-statistics-table?orgId=1&#34;&gt;200 个项目&lt;/a&gt;，有来自
&lt;a href=&#34;https://all.devstats.cncf.io/d/18/overall-project-statistics-table?orgId=1&#34;&gt;240,000 多名个人贡献者&lt;/a&gt;，
还有数千名来自更大的生态系统的贡献者的贡献。
如果没有 &lt;a href=&#34;https://www.cncf.io/blog/2022/05/18/slashdata-cloud-native-continues-to-grow-with-more-than-7-million-developers-worldwide/&#34;&gt;700 多万开发者&lt;/a&gt;和更庞大的用户社区，
Kubernetes 就不会达到今天的成就，他们一起帮助塑造了今天的生态系统。&lt;/p&gt;
&lt;!--
## Kubernetes&#39; beginnings - a converging of technologies

The ideas underlying Kubernetes started well before the first commit, or even the first prototype
([which came about in 2013](/blog/2018/07/20/the-history-of-kubernetes-the-community-behind-it/)).
In the early 2000s, Moore&#39;s Law was well in effect. Computing hardware was becoming more and more
powerful at an incredibly fast rate. Correspondingly, applications were growing more and more
complex. This combination of hardware commoditization and application complexity pointed to a need
to further abstract software from hardware, and solutions started to emerge.
--&gt;
&lt;h2 id=&#34;kubernetes-的起源-技术的融合&#34;&gt;Kubernetes 的起源 - 技术的融合&lt;/h2&gt;
&lt;p&gt;Kubernetes 背后的理念早在第一次提交之前，
甚至第一个原型（&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2018/07/20/the-history-of-kubernetes-the-community-behind-it/&#34;&gt;在 2013 年问世&lt;/a&gt;之前就已经存在。
在 21 世纪初，摩尔定律仍然成立。计算硬件正以惊人的速度变得越来越强大。
相应地，应用程序变得越来越复杂。硬件商品化和应用程序复杂性的结合表明需要进一步将软件从硬件中抽象出来，
因此解决方案开始出现。&lt;/p&gt;
&lt;!--
Like many companies at the time, Google was scaling rapidly, and its engineers were interested in
the idea of creating a form of isolation in the Linux kernel. Google engineer Rohit Seth described
the concept in an [email in 2006](https://lwn.net/Articles/199643/):
--&gt;
&lt;p&gt;像当时的许多公司一样，Google 正在快速扩张，其工程师对在 Linux 内核中创建一种隔离形式的想法很感兴趣。
Google 工程师 Rohit Seth 在 &lt;a href=&#34;https://lwn.net/Articles/199643/&#34;&gt;2006 年的一封电子邮件&lt;/a&gt;中描述了这个概念：&lt;/p&gt;
&lt;!--
&gt; We use the term container to indicate a structure against which we track and charge utilization of
system resources like memory, tasks, etc. for a Workload.
--&gt;
&lt;blockquote&gt;
&lt;p&gt;我们使用术语 “容器” 来表示一种结构，通过该结构我们可以对负载的系统资源（如内存、任务等）利用情况进行跟踪和计费。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;img src=&#34;future.png&#34; alt=&#34;The future of Linux containers&#34; class=&#34;right&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;
&lt;!--
In March of 2013, a 5-minute lightning talk called
[&#34;The future of Linux Containers,&#34; presented by Solomon Hykes at PyCon](https://youtu.be/wW9CAH9nSLs?si=VtK_VFQHymOT7BIB),
introduced an upcoming open source tool called &#34;Docker&#34; for creating and using Linux
Containers. Docker introduced a level of usability to Linux Containers that made them accessible to
more users than ever before, and the popularity of Docker, and thus of Linux Containers,
skyrocketed. With Docker making the abstraction of Linux Containers accessible to all, running
applications in much more portable and repeatable ways was suddenly possible, but the question of
scale remained.
--&gt;
&lt;p&gt;2013 年 3 月，&lt;a href=&#34;https://youtu.be/wW9CAH9nSLs?si=VtK_VFQHymOT7BIB&#34;&gt;Solomon Hykes 在 PyCon 上进行了一场名为 “Linux容器的未来”&lt;/a&gt;的
5 分钟闪电演讲，介绍了名为 “Docker” 的一款即将被推出的开源工具，用于创建和使用 Linux 容器。Docker
提升了 Linux 容器的可用性，使其比以往更容易被更多用户使用，从而使
Docker 和Linux 容器的流行度飙升。随着 Docker 使 Linux 容器的抽象概念可供所有人使用，
以更便于移植且可重复的方式运行应用突然成为可能，但大规模使用的问题仍然存在。&lt;/p&gt;
&lt;!--
Google&#39;s Borg system for managing application orchestration at scale had adopted Linux containers as
they were developed in the mid-2000s. Since then, the company had also started working on a new
version of the system called &#34;Omega.&#34; Engineers at Google who were familiar with the Borg and Omega
systems saw the popularity of containerization driven by Docker. They recognized not only the need
for an open source container orchestration system but its &#34;inevitability,&#34; as described by Brendan
Burns in this [blog post](/blog/2018/07/20/the-history-of-kubernetes-the-community-behind-it/). That
realization in the fall of 2013 inspired a small team to start working on a project that would later
become **Kubernetes**. That team included Joe Beda, Brendan Burns, Craig McLuckie, Ville Aikas, Tim
Hockin, Dawn Chen, Brian Grant, and Daniel Smith.
--&gt;
&lt;p&gt;Google 用来管理大规模应用编排的 Borg 系统在 2000 年代中期采用当时所开发的 Linux 容器技术。
此后，该公司还开始研发该系统的一个新版本，名为 “Omega”。
熟悉 Borg 和 Omega 系统的 Google 工程师们看到了 Docker 所推动的容器化技术的流行。
他们意识到对一个开源的容器编排系统的需求，而且意识到这一系统的“必然性”，正如
Brendan Burns 在这篇&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2018/07/20/the-history-of-kubernetes-the-community-behind-it/&#34;&gt;博文&lt;/a&gt;中所描述的。
这一认识在 2013 年秋天激发了一个小团队开始着手一个后来成为 &lt;strong&gt;Kubernetes&lt;/strong&gt;
的项目。该团队包括 Joe Beda、Brendan Burns、Craig McLuckie、Ville Aikas、Tim Hockin、Dawn Chen、Brian Grant
和 Daniel Smith。&lt;/p&gt;
&lt;!--
## A decade of Kubernetes

&lt;img src=&#34;kubeconeu2017.jpg&#34; alt=&#34;KubeCon EU 2017&#34; class=&#34;left&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;

Kubernetes&#39; history begins with that historic commit on June 6th, 2014, and the subsequent
announcement of the project in a June 10th
[keynote by Google engineer Eric Brewer at DockerCon 2014](https://youtu.be/YrxnVKZeqK8?si=Q_wYBFn7dsS9H3k3)
(and its corresponding [Google blog](https://cloudplatform.googleblog.com/2014/06/an-update-on-container-support-on-google-cloud-platform.html)).
--&gt;
&lt;h2 id=&#34;kubernetes-十年回顾&#34;&gt;Kubernetes 十年回顾&lt;/h2&gt;
&lt;img src=&#34;kubeconeu2017.jpg&#34; alt=&#34;KubeCon EU 2017&#34; class=&#34;left&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;
&lt;p&gt;Kubernetes 的历史始于 2014 年 6 月 6 日的那次历史性提交，随后，
&lt;a href=&#34;https://youtu.be/YrxnVKZeqK8?si=Q_wYBFn7dsS9H3k3&#34;&gt;Google 工程师 Eric Brewer 在 2014 年 6 月 10 日的 DockerCon 2014
上的主题演讲&lt;/a&gt;(&lt;a href=&#34;https://cloudplatform.googleblog.com/2014/06/an-update-on-container-support-on-google-cloud-platform.html&#34;&gt;及其相应的 Google 博客&lt;/a&gt;)中由宣布了该项目。&lt;/p&gt;
&lt;!--
Over the next year, a small community of
[contributors, largely from Google and Red Hat](https://k8s.devstats.cncf.io/d/9/companies-table?orgId=1&amp;var-period_name=Before%20joining%20CNCF&amp;var-metric=contributors),
worked hard on the project, culminating in a [version 1.0 release on July 21st, 2015](https://cloudplatform.googleblog.com/2015/07/Kubernetes-V1-Released.html).
Alongside 1.0, Google announced that Kubernetes would be donated to a newly formed branch of the
Linux Foundation called the
[Cloud Native Computing Foundation (CNCF)](https://www.cncf.io/announcements/2015/06/21/new-cloud-native-computing-foundation-to-drive-alignment-among-container-technologies/).
--&gt;
&lt;p&gt;在接下来的一年里，一个由&lt;a href=&#34;https://k8s.devstats.cncf.io/d/9/companies-table?orgId=1&amp;var-period_name=Before%20joining%20CNCF&amp;var-metric=contributors&#34;&gt;主要来自 Google 和 Red Hat 等公司的贡献者&lt;/a&gt;组成的小型社区为该项目付出了辛勤的努力，最终在
2015 年 7 月 21 日发布了 &lt;a href=&#34;https://cloudplatform.googleblog.com/2015/07/Kubernetes-V1-Released.html&#34;&gt;1.0 版本&lt;/a&gt;。
在发布 1.0 版本的同时，Google 宣布将 Kubernetes 捐赠给 Linux 基金会下的一个新成立的分支，
即&lt;a href=&#34;https://www.cncf.io/announcements/2015/06/21/new-cloud-native-computing-foundation-to-drive-alignment-among-container-technologies/&#34;&gt;云原生计算基金会 (Cloud Native Computing Foundation，CNCF)&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Despite reaching 1.0, the Kubernetes project was still very challenging to use and
understand. Kubernetes contributor Kelsey Hightower took special note of the project&#39;s shortcomings
in ease of use and on July 7, 2016, he pushed the
[first commit of his famed &#34;Kubernetes the Hard Way&#34; guide](https://github.com/kelseyhightower/kubernetes-the-hard-way/commit/9d7ace8b186f6ebd2e93e08265f3530ec2fba81c).
--&gt;
&lt;p&gt;尽管到了 1.0 版本，但 Kubernetes 项目的使用和理解仍然很困难。Kubernetes
贡献者 Kelsey Hightower 特别注意到了该项目在易用性方面的不足，并于 2016 年 7 月 7 日推出了他著名的
“Kubernetes the Hard Way” 指南的&lt;a href=&#34;https://github.com/kelseyhightower/kubernetes-the-hard-way/commit/9d7ace8b186f6ebd2e93e08265f3530ec2fba81c&#34;&gt;第一次提交&lt;/a&gt;。&lt;/p&gt;
&lt;!--
The project has changed enormously since its original 1.0 release; experiencing a number of big wins
such as
[Custom Resource Definitions (CRD) going GA in 1.16](/blog/2019/09/18/kubernetes-1-16-release-announcement/)
or [full dual stack support launching in 1.23](/blog/2021/12/08/dual-stack-networking-ga/) and
community &#34;lessons learned&#34; from the [removal of widely used beta APIs in 1.22](/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/)
or the deprecation of [Dockershim](/blog/2020/12/02/dockershim-faq/
--&gt;
&lt;p&gt;自从最初的 1.0 版本发布以来，项目经历了巨大的变化，取得了许多重大的成就，例如
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2019/09/18/kubernetes-1-16-release-announcement/&#34;&gt;在 1.16 版本中正式发布的 Custom Resource Definitions (CRD) &lt;/a&gt;，
或者&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2021/12/08/dual-stack-networking-ga/&#34;&gt;在 1.23 版本中推出的全面双栈支持&lt;/a&gt;，以及社区从
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/&#34;&gt;1.22 版本中移除广泛使用的 Beta API&lt;/a&gt;
和&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2020/12/02/dockershim-faq/&#34;&gt;弃用 Dockershim&lt;/a&gt; 中吸取的“教训”。&lt;/p&gt;
&lt;!--
Some notable updates, milestones and events since 1.0 include:

* December 2016 - [Kubernetes 1.5](/blog/2016/12/kubernetes-1-5-supporting-production-workloads/) introduces runtime pluggability with initial CRI support and alpha Windows node support. OpenAPI also appears for the first time, paving the way for clients to be able to discover extension APIs.
  * This release also introduced StatefulSets and PodDisruptionBudgets in Beta.
--&gt;
&lt;p&gt;自 1.0 版本以来的一些值得注意的更新、里程碑和事件包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;2016 年 12 月 - &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2016/12/kubernetes-1-5-supporting-production-workloads/&#34;&gt;Kubernetes 1.5&lt;/a&gt;
引入了运行时可插拔性，初步支持 CRI 和 Alpha 版 Windows 节点支持。
OpenAPI 也首次出现，为客户端能够发现扩展 API 铺平了道路。
&lt;ul&gt;
&lt;li&gt;此版本还引入了 Beta 版的 StatefulSet 和 PodDisruptionBudget。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* April 2017 — [Introduction of Role-Based Access Controls or RBAC](/blog/2017/04/rbac-support-in-kubernetes/).
* June 2017 — In [Kubernetes 1.7](/blog/2017/06/kubernetes-1-7-security-hardening-stateful-application-extensibility-updates/), ThirdPartyResources or &#34;TPRs&#34; are replaced with CustomResourceDefinitions (CRDs).
* December 2017 — [Kubernetes 1.9](/blog/2017/12/kubernetes-19-workloads-expanded-ecosystem/) sees the Workloads API becoming GA (Generally Available). The release blog states: _&#34;Deployment and ReplicaSet, two of the most commonly used objects in Kubernetes, are now stabilized after more than a year of real-world use and feedback.&#34;_
--&gt;
&lt;ul&gt;
&lt;li&gt;2017 年 4 月 — &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2017/04/rbac-support-in-kubernetes/&#34;&gt;引入基于角色的访问控制（RBAC）&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;2017 年 6 月 — 在 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2017/06/kubernetes-1-7-security-hardening-stateful-application-extensibility-updates/&#34;&gt;Kubernetes 1.7&lt;/a&gt;
中，ThirdPartyResources 或 &amp;quot;TPRs&amp;quot; 被 CustomResourceDefinitions（CRD）取代。&lt;/li&gt;
&lt;li&gt;2017 年 12 月 — &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2017/12/kubernetes-19-workloads-expanded-ecosystem/&#34;&gt;Kubernetes 1.9&lt;/a&gt; 中，
工作负载 API 成为 GA（正式可用）。发布博客中指出：“Deployment 和 ReplicaSet 是 Kubernetes 中最常用的两个对象，
在经过一年多的实际使用和反馈后，现在已经稳定下来。”&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* December 2018 — In 1.13, the Container Storage Interface (CSI) reaches GA, kubeadm tool for bootstrapping minimum viable clusters reaches GA, and CoreDNS becomes the default DNS server.
* September 2019 — [Custom Resource Definitions go GA](/blog/2019/09/18/kubernetes-1-16-release-announcement/) in Kubernetes 1.16.
* August 2020 — [Kubernetes 1.19](/blog/2020/08/31/kubernetes-1-19-feature-one-year-support/) increases the support window for releases to 1 year.
* December 2020 — [Dockershim is deprecated](/blog/2020/12/18/kubernetes-1.20-pod-impersonation-short-lived-volumes-in-csi/)  in 1.20
--&gt;
&lt;ul&gt;
&lt;li&gt;2018 年 12 月 — 在 1.13 版本中，容器存储接口（CSI）达到 GA，用于引导最小可用集群的 kubeadm 工具达到 GA，并且 CoreDNS 成为默认的 DNS 服务器。&lt;/li&gt;
&lt;li&gt;2019 年 9 月 — &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2019/09/18/kubernetes-1-16-release-announcement/&#34;&gt;自定义资源定义（Custom Resource Definition）在 Kubernetes 1.16 中正式发布&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;2020 年 8 月 — &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2020/08/31/kubernetes-1-19-feature-one-year-support/&#34;&gt;Kubernetes 1.19&lt;/a&gt; 将发布支持窗口增加到 1 年。&lt;/li&gt;
&lt;li&gt;2020 年 12 月 — &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2020/12/18/kubernetes-1.20-pod-impersonation-short-lived-volumes-in-csi/&#34;&gt;Dockershim 在 1.20 版本中被弃用&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* April 2021 — the [Kubernetes release cadence changes](/blog/2021/07/20/new-kubernetes-release-cadence/#:~:text=On%20April%2023%2C%202021%2C%20the,Kubernetes%20community&#39;s%20contributors%20and%20maintainers.) from 4 releases per year to 3 releases per year.
* July 2021 — Widely used beta APIs are [removed](/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/)  in Kubernetes 1.22.
* May 2022 — Kubernetes 1.24 sees  [beta APIs become disabled by default](/blog/2022/05/03/kubernetes-1-24-release-announcement/) to reduce upgrade conflicts and removal of [Dockershim](/dockershim), leading to [widespread user confusion](https://www.youtube.com/watch?v=a03Hh1kd6KE) (we&#39;ve since [improved our communication!](https://github.com/kubernetes/community/tree/master/communication/contributor-comms))
* December 2022 — In 1.26, there was a significant batch and  [Job API overhaul](/blog/2022/12/29/scalable-job-tracking-ga/) that paved the way for better support for AI  /ML / batch workloads.
--&gt;
&lt;ul&gt;
&lt;li&gt;2021 年 4 月 - &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2021/07/20/new-kubernetes-release-cadence/#:~:text=On%20April%2023%2C%202021%2C%20the,Kubernetes%20community&#39;s%20contributors%20and%20maintainers.&#34;&gt;Kubernetes 发布节奏变更&lt;/a&gt;，从每年发布 4 个版本变为每年发布 3 个版本。&lt;/li&gt;
&lt;li&gt;2021 年 7 月 - 在 Kubernetes 1.22 中&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/&#34;&gt;移除了广泛使用的 Beta API&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;2022 年 5 月 - 在 Kubernetes 1.24 中，&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2022/05/03/kubernetes-1-24-release-announcement/&#34;&gt;Beta API 默认被禁用&lt;/a&gt;，
以减少升级冲突，并移除了 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/dockershim&#34;&gt;Dockershim&lt;/a&gt;，导致&lt;a href=&#34;https://www.youtube.com/watch?v=a03Hh1kd6KE&#34;&gt;用户普遍感到困惑&lt;/a&gt;
（我们已经&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/communication/contributor-comms&#34;&gt;改进了我们的沟通方式！&lt;/a&gt;）&lt;/li&gt;
&lt;li&gt;2022 年 12 月 - 在 1.26 版本中，进行了重大的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2022/12/29/scalable-job-tracking-ga/&#34;&gt;批处理和作业 API 改进&lt;/a&gt;，
为更好地支持 AI/ML/批处理工作负载铺平了道路。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**PS:** Curious to see how far the project has come for yourself? Check out this [tutorial for spinning up a Kubernetes 1.0 cluster](https://github.com/spurin/kubernetes-v1.0-lab) created by community members Carlos Santana, Amim Moises Salum Knabben, and James Spurin.
--&gt;
&lt;p&gt;&lt;strong&gt;附言:&lt;/strong&gt; 想亲自体会一下这个项目的进展么？可以查看由社区成员 Carlos Santana、Amim Moises Salum Knabben 和 James Spurin
创建的 &lt;a href=&#34;https://github.com/spurin/kubernetes-v1.0-lab&#34;&gt;Kubernetes 1.0 集群搭建教程&lt;/a&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;!--
Kubernetes offers more extension points than we can count. Originally designed to work with Docker
and only Docker, now you can plug in any container runtime that adheres to the CRI standard. There
are other similar interfaces: CSI for storage and CNI for networking. And that&#39;s far from all you
can do. In the last decade, whole new patterns have emerged, such as using

[Custom Resource Definitions](/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
(CRDs) to support third-party controllers - now a huge part of the Kubernetes ecosystem.
--&gt;
&lt;p&gt;Kubernetes 提供的扩展点多得数不胜数。最初设计用于与 Docker 一起工作，现在你可以插入任何符合
CRI 标准的容器运行时。还有其他类似的接口：用于存储的 CSI 和用于网络的 CNI。
而且这还远远不是全部。在过去的十年中，出现了全新的模式，例如使用&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources/&#34;&gt;自定义资源定义&lt;/a&gt;（CRD）
来支持第三方控制器 - 这现在是 Kubernetes 生态系统的重要组成部分。&lt;/p&gt;
&lt;!--
The community building the project has also expanded immensely over the last decade. Using
[DevStats](https://k8s.devstats.cncf.io/d/24/overall-project-statistics?orgId=1), we can see the
incredible volume of contribution over the last decade that has made Kubernetes the
[second-largest open source project in the world](https://www.cncf.io/reports/kubernetes-project-journey-report/):

* **88,474** contributors
* **15,121** code committers
* **4,228,347** contributions
* **158,530** issues
* **311,787** pull requests
--&gt;
&lt;p&gt;在过去十年间，参与构建该项目的社区也得到了巨大的扩展。通过使用
&lt;a href=&#34;https://k8s.devstats.cncf.io/d/24/overall-project-statistics?orgId=1&#34;&gt;DevStats&lt;/a&gt;，我们可以看到过去十年中令人难以置信的贡献量，这使得
Kubernetes 成为了&lt;a href=&#34;https://www.cncf.io/reports/kubernetes-project-journey-report/&#34;&gt;全球第二大开源项目&lt;/a&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;88,474&lt;/strong&gt; 位贡献者&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;15,121&lt;/strong&gt; 位代码提交者&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;4,228,347&lt;/strong&gt; 次贡献&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;158,530&lt;/strong&gt; 个问题&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;311,787&lt;/strong&gt; 个拉取请求&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Kubernetes today

&lt;img src=&#34;welcome.jpg&#34; alt=&#34;KubeCon NA 2023&#34; class=&#34;left&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;

Since its early days, the project has seen enormous growth in technical capability, usage, and
contribution. The project is still actively working to improve and better serve its users.
--&gt;
&lt;h2 id=&#34;kubernetes-现状&#34;&gt;Kubernetes 现状&lt;/h2&gt;
&lt;img src=&#34;welcome.jpg&#34; alt=&#34;KubeCon NA 2023&#34; class=&#34;left&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;
&lt;p&gt;自项目初期以来，项目在技术能力、使用率和贡献方面取得了巨大的增长。
项目仍在积极努力改进并更好地为用户服务。&lt;/p&gt;
&lt;!--
In the upcoming 1.31 release, the project will celebrate the culmination of an important long-term
project: the removal of in-tree cloud provider code. In this
[largest migration in Kubernetes history](/blog/2024/05/20/completing-cloud-provider-migration/),
roughly 1.5 million lines of code have been removed, reducing the binary sizes of core components
by approximately 40%. In the project&#39;s early days, it was clear that extensibility would be key to
success. However, it wasn&#39;t always clear how that extensibility should be achieved. This migration
removes a variety of vendor-specific capabilities from the core Kubernetes code
base. Vendor-specific capabilities can now be better served by other pluggable extensibility
features or patterns, such as
[Custom Resource Definitions (CRDs)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
or API standards like the [Gateway API](https://gateway-api.sigs.k8s.io/).
Kubernetes also faces new challenges in serving its vast user base, and the community is adapting
accordingly. One example of this is the migration of image hosting to the new, community-owned
registry.k8s.io. The egress bandwidth and costs of providing pre-compiled binary images for user
consumption have become immense. This new registry change enables the community to continue
providing these convenient images in more cost- and performance-efficient ways. Make sure you check
out the [blog post](/blog/2022/11/28/registry-k8s-io-faster-cheaper-ga/) and
update any automation you have to use registry.k8s.io!
--&gt;
&lt;p&gt;在即将发布的 1.31 版本中，该项目将庆祝一个重要的长期项目的完成：移除内部云提供商代码。在这个
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/20/completing-cloud-provider-migration/&#34;&gt;Kubernetes 历史上最大的迁移&lt;/a&gt;中，大约删除了
150 万行代码，将核心组件的二进制文件大小减小了约 40%。在项目早期，很明显可扩展性是成功的关键。
然而，如何实现这种可扩展性并不总是很清楚。此次迁移从核心 Kubernetes 代码库中删除了各种特定于供应商的功能。
现在，特定于供应商的功能可以通过其他可插拔的扩展功能或模式更好地提供，例如&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources/&#34;&gt;自定义资源定义（CRD）&lt;/a&gt;
或 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/&#34;&gt;Gateway API&lt;/a&gt; 等 API 标准。
Kubernetes 在为其庞大的用户群体提供服务时也面临着新的挑战，社区正在相应地进行调整。其中一个例子是将镜像托管迁移到新的、由社区拥有的
registry.k8s.io。为用户提供预编译二进制镜像的出口带宽和成本已经变得非常巨大。这一新的仓库变更使社区能够以更具成本效益和性能高效的方式继续提供这些便利的镜像。
请务必查看&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2022/11/28/registry-k8s-io-faster-cheaper-ga/&#34;&gt;此博客文章&lt;/a&gt;并更新你必须使用 registry.k8s.io 仓库的任何自动化设施！&lt;/p&gt;
&lt;!--
## The future of Kubernetes

&lt;img src=&#34;lts.jpg&#34; alt=&#34;&#34; class=&#34;right&#34; width=&#34;300px&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;

A decade in, the future of Kubernetes still looks bright. The community is prioritizing changes that
both improve the user experiences, and enhance the sustainability of the project. The world of
application development continues to evolve, and Kubernetes is poised to change along with it.
--&gt;
&lt;h2 id=&#34;kubernetes-的未来&#34;&gt;Kubernetes 的未来&lt;/h2&gt;
&lt;img src=&#34;lts.jpg&#34; alt=&#34;&#34; class=&#34;right&#34; width=&#34;300px&#34; style=&#34;max-width: 20em; margin: 1em&#34;&gt;
&lt;p&gt;十年过去了，Kubernetes 的未来依然光明。社区正在优先考虑改进用户体验和增强项目可持续性的变革。
应用程序开发的世界不断演变，Kubernetes 正准备随之变化。&lt;/p&gt;
&lt;!--
In 2024, the advent of AI changed a once-niche workload type into one of prominent
importance. Distributed computing and workload scheduling has always gone hand-in-hand with the
resource-intensive needs of Artificial Intelligence, Machine Learning, and High Performance
Computing workloads. Contributors are paying close attention to the needs of newly developed
workloads and how Kubernetes can best serve them. The new
[Serving Working Group](https://github.com/kubernetes/community/tree/master/wg-serving) is one
example of how the community is organizing to address these workloads&#39; needs. It&#39;s likely that the
next few years will see improvements to Kubernetes&#39; ability to manage various types of hardware, and
its ability to manage the scheduling of large batch-style workloads which are run across hardware in
chunks.
--&gt;
&lt;p&gt;2024 年，人工智能的进展将一种曾经小众的工作负载类型变成了一种非常重要的工作负载类型。
分布式计算和工作负载调度一直与人工智能、机器学习和高性能计算工作负载的资源密集需求密切相关。
贡献者们密切关注新开发的工作负载的需求以及 Kubernetes 如何为它们提供最佳服务。新成立的
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/wg-serving&#34;&gt;Serving 工作组&lt;/a&gt;
就是社区组织来解决这些工作负载需求的一个例子。未来几年可能会看到
Kubernetes 在管理各种类型的硬件以及管理跨硬件运行的大型批处理工作负载的调度能力方面的改进。&lt;/p&gt;
&lt;!--
The ecosystem around Kubernetes will continue to grow and evolve. In the future, initiatives to
maintain the sustainability of the project, like the migration of in-tree vendor code and the
registry change, will be ever more important.
--&gt;
&lt;p&gt;Kubernetes 周围的生态系统将继续发展壮大。未来，为了保持项目的可持续性，
像内部供应商代码的迁移和仓库变更这样的举措将变得更加重要。&lt;/p&gt;
&lt;!--
The next 10 years of Kubernetes will be guided by its users and the ecosystem, but most of all, by
the people who contribute to it. The community remains open to new contributors. You can find more
information about contributing in our New Contributor Course at
[https://k8s.dev/docs/onboarding](https://k8s.dev/docs/onboarding).

We look forward to building the future of Kubernetes with you!



&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/kcsna2023.jpg&#34;
         alt=&#34;KCSNA 2023&#34;/&gt; 
&lt;/figure&gt;
--&gt;
&lt;p&gt;Kubernetes 的未来 10 年将由其用户和生态系统引领，但最重要的是，由为其做出贡献的人引领。
社区对新贡献者持开放态度。你可以在我们的新贡献者课程
&lt;a href=&#34;https://k8s.dev/docs/onboarding&#34;&gt;https://k8s.dev/docs/onboarding&lt;/a&gt; 中找到更多有关贡献的信息。&lt;/p&gt;
&lt;p&gt;我们期待与你一起构建 Kubernetes 的未来！&lt;/p&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/06/06/10-years-of-kubernetes/kcsna2023.jpg&#34;
         alt=&#34;KCSNA 2023&#34;/&gt; 
&lt;/figure&gt;

      </description>
    </item>
    
    <item>
      <title>完成 Kubernetes 史上最大规模迁移</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/20/completing-cloud-provider-migration/</link>
      <pubDate>Mon, 20 May 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/20/completing-cloud-provider-migration/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Completing the largest migration in Kubernetes history&#39;
date: 2024-05-20
slug: completing-cloud-provider-migration
author: &gt;
  Andrew Sy Kim (Google),
  Michelle Au (Google),
  Walter Fender (Google),
  Michael McCune (Red Hat)
--&gt;
&lt;!--
Since as early as Kubernetes v1.7, the Kubernetes project has pursued the ambitious goal of removing built-in cloud provider integrations ([KEP-2395](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md)).
While these integrations were instrumental in Kubernetes&#39; early development and growth, their removal was driven by two key factors:
the growing complexity of maintaining native support for every cloud provider across millions of lines of Go code, and the desire to establish
Kubernetes as a truly vendor-neutral platform.
--&gt;
&lt;p&gt;早自 Kubernetes v1.7 起，Kubernetes 项目就开始追求取消集成内置云驱动
（&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2395-removing-in-tree-cloud-providers/README.md&#34;&gt;KEP-2395&lt;/a&gt;）。
虽然这些集成对于 Kubernetes 的早期发展和增长发挥了重要作用，但它们的移除是由两个关键因素驱动的：
为各云启动维护数百万行 Go 代码的原生支持所带来的日趋增长的复杂度，以及将 Kubernetes 打造为真正的供应商中立平台的愿景。&lt;/p&gt;
&lt;!--
After many releases, we&#39;re thrilled to announce that all cloud provider integrations have been successfully migrated from the core Kubernetes repository to external plugins.
In addition to achieving our initial objectives, we&#39;ve also significantly streamlined Kubernetes by removing roughly 1.5 million lines of code and reducing the binary sizes of core components by approximately 40%.
--&gt;
&lt;p&gt;历经很多发布版本之后，我们很高兴地宣布所有云驱动集成组件已被成功地从核心 Kubernetes 仓库迁移到外部插件中。
除了实现我们最初的目标之外，我们还通过删除大约 150 万行代码，将核心组件的可执行文件大小减少了大约 40%，
极大简化了 Kubernetes。&lt;/p&gt;
&lt;!--
This migration was a complex and long-running effort due to the numerous impacted components and the critical code paths that relied on the built-in integrations for the
five initial cloud providers: Google Cloud, AWS, Azure, OpenStack, and vSphere. To successfully complete this migration, we had to build four new subsystems from the ground up:
--&gt;
&lt;p&gt;由于受影响的组件众多，而且关键代码路径依赖于五个初始云驱动（Google Cloud、AWS、Azure、OpenStack 和 vSphere）
的内置集成，因此此次迁移是一项复杂且耗时的工作。
为了成功完成此迁移，我们必须从头开始构建四个新的子系统：&lt;/p&gt;
&lt;!--
1. **Cloud controller manager** ([KEP-2392](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cloud-provider/2392-cloud-controller-manager/README.md))
1. **API server network proxy** ([KEP-1281](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1281-network-proxy))
1. **kubelet credential provider plugins** ([KEP-2133](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2133-kubelet-credential-providers))
1. **Storage migration to use [CSI](https://github.com/container-storage-interface/spec?tab=readme-ov-file#container-storage-interface-csi-specification-)** ([KEP-625](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/625-csi-migration/README.md))
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;云控制器管理器（Cloud controller manager）&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;!--
Each subsystem was critical to achieve full feature parity with built-in capabilities and required several releases to bring each subsystem to GA-level maturity with a safe and
reliable migration path. More on each subsystem below.
--&gt;
&lt;p&gt;就与内置功能实现完全的特性等价而言，每个子系统都至关重要，
并且需要迭代多个版本才能使每个子系统达到 GA 级别并具有安全可靠的迁移路径。
下面详细介绍每个子系统。&lt;/p&gt;
&lt;!--
### Cloud controller manager

The cloud controller manager was the first external component introduced in this effort, replacing functionality within the kube-controller-manager and kubelet that directly interacted with cloud APIs.
This essential component is responsible for initializing nodes by applying metadata labels that indicate the cloud region and zone a Node is running on, as well as IP addresses that are only known to the cloud provider.
Additionally, it runs the service controller, which is responsible for provisioning cloud load balancers for Services of type LoadBalancer.
--&gt;
&lt;h3 id=&#34;云控制器管理器&#34;&gt;云控制器管理器&lt;/h3&gt;
&lt;p&gt;云控制器管理器是这项工作中引入的第一个外部组件，取代了 kube-controller-manager 和 kubelet 中直接与云 API 交互的功能。
这个基本组件负责通过施加元数据标签来初始化节点。所施加的元数据标签标示节点运行所在的云区域和可用区，
以及只有云驱动知道的 IP 地址。
此外，它还运行服务控制器，该控制器负责为 LoadBalancer 类型的 Service 配置云负载均衡器。&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;Kubernetes 组件&#34; src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/images/docs/components-of-kubernetes.svg&#34;&gt;&lt;/p&gt;
&lt;!--
To learn more, read [Cloud Controller Manager](/docs/concepts/architecture/cloud-controller/) in the Kubernetes documentation.
--&gt;
&lt;p&gt;要进一步了解相关信息，请阅读 Kubernetes 文档中的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cloud-controller/&#34;&gt;云控制器管理器&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### API server network proxy

The API Server Network Proxy project, initiated in 2018 in collaboration with SIG API Machinery, aimed to replace the SSH tunneler functionality within the kube-apiserver.
This tunneler had been used to securely proxy traffic between the Kubernetes control plane and nodes, but it heavily relied on provider-specific implementation details embedded in the kube-apiserver to establish these SSH tunnels.
--&gt;
&lt;h3 id=&#34;api-服务器网络代理&#34;&gt;API 服务器网络代理&lt;/h3&gt;
&lt;p&gt;API 服务器网络代理项目于 2018 年与 SIG API Machinery 合作启动，旨在取代 kube-apiserver 中的 SSH 隧道功能。
该隧道器原用于安全地代理 Kubernetes 控制平面和节点之间的流量，但它重度依赖于
kube-apiserver 中所嵌入的、特定于提供商的实现细节来建立这些 SSH 隧道。&lt;/p&gt;
&lt;!--
Now, the API Server Network Proxy is a GA-level extension point within the kube-apiserver. It offers a generic proxying mechanism that can route traffic from the API server to nodes through a secure proxy,
eliminating the need for the API server to have any knowledge of the specific cloud provider it is running on. This project also introduced the Konnectivity project, which has seen growing adoption in production environments.
--&gt;
&lt;p&gt;现在，API 服务器网络代理成为 kube-apiserver 中 GA 级别的扩展点。
提供了一种通用代理机制，可以通过一个安全的代理将流量从 API 服务器路由到节点，
从而使 API 服务器无需了解其运行所在的特定云驱动。
此项目还引入了 Konnectivity 项目，该项目在生产环境中的采用越来越多。&lt;/p&gt;
&lt;!--
You can learn more about the API Server Network Proxy from its [README](https://github.com/kubernetes-sigs/apiserver-network-proxy#readme).
--&gt;
&lt;p&gt;你可以在其 &lt;a href=&#34;https://github.com/kubernetes-sigs/apiserver-network-proxy#readme&#34;&gt;README&lt;/a&gt;
中了解有关 API 服务器网络代理的更多信息。&lt;/p&gt;
&lt;!--
### Credential provider plugins for the kubelet

The Kubelet credential provider plugin was developed to replace the kubelet&#39;s built-in functionality for dynamically fetching credentials for image registries hosted on Google Cloud, AWS, or Azure.
The legacy capability was convenient as it allowed the kubelet to seamlessly retrieve short-lived tokens for pulling images from GCR, ECR, or ACR. However, like other areas of Kubernetes, supporting
this required the kubelet to have specific knowledge of different cloud environments and APIs.
--&gt;
&lt;h3 id=&#34;kubelet-的凭据提供程序插件&#34;&gt;kubelet 的凭据提供程序插件&lt;/h3&gt;
&lt;p&gt;kubelet 凭据提供程序插件的开发是为了取代 kubelet 的内置功能，用于动态获取用于托管在
Google Cloud、AWS 或 Azure 上的镜像仓库的凭据。
原来所实现的功能很方便，因为它允许 kubelet 无缝地获取短期令牌以从 GCR、ECR 或 ACR 拉取镜像
然而，与 Kubernetes 的其他领域一样，支持这一点需要 kubelet 具有不同云环境和 API 的特定知识。&lt;/p&gt;
&lt;!--
Introduced in 2019, the credential provider plugin mechanism offers a generic extension point for the kubelet to execute plugin binaries that dynamically provide credentials for images hosted on various clouds.
This extensibility expands the kubelet&#39;s capabilities to fetch short-lived tokens beyond the initial three cloud providers.
--&gt;
&lt;p&gt;凭据驱动插件机制于 2019 年推出，为 kubelet 提供了一个通用扩展点用于执行插件的可执行文件，
进而为访问各种云上托管的镜像动态提供凭据。
可扩展性扩展了 kubelet 获取短期令牌的能力，且不受限于最初的三个云驱动。&lt;/p&gt;
&lt;!--
To learn more, read [kubelet credential provider for authenticated image pulls](/docs/concepts/containers/images/#kubelet-credential-provider).
--&gt;
&lt;p&gt;要了解更多信息，请阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/containers/images/#kubelet-credential-provider&#34;&gt;用于认证镜像拉取的 kubelet 凭据提供程序&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Storage plugin migration from in-tree to CSI

The Container Storage Interface (CSI) is a control plane standard for managing block and file storage systems in Kubernetes and other container orchestrators that went GA in 1.13.
It was designed to replace the in-tree volume plugins built directly into Kubernetes with drivers that can run as Pods within the Kubernetes cluster.
These drivers communicate with kube-controller-manager storage controllers via the Kubernetes API, and with kubelet through a local gRPC endpoint.
Now there are over 100 CSI drivers available across all major cloud and storage vendors, making stateful workloads in Kubernetes a reality.
--&gt;
&lt;h3 id=&#34;存储插件从树内迁移到-csi&#34;&gt;存储插件从树内迁移到 CSI&lt;/h3&gt;
&lt;p&gt;容器存储接口（Container Storage Interface，CSI）是一种控制平面标准，用于管理 Kubernetes
和其他容器编排系统中的块和文件存储系统，已在 1.13 中进入正式发布状态。
它的设计目标是用可在 Kubernetes 集群中 Pod 内运行的驱动程序替换直接内置于 Kubernetes 中的树内卷插件。
这些驱动程序通过 Kubernetes API 与 kube-controller-manager 存储控制器通信，并通过本地 gRPC 端点与 kubelet 进行通信。
现在，所有主要云和存储供应商一起提供了 100 多个 CSI 驱动，使 Kubernetes 中运行有状态工作负载成为现实。&lt;/p&gt;
&lt;!--
However, a major challenge remained on how to handle all the existing users of in-tree volume APIs. To retain API backwards compatibility,
we built an API translation layer into our controllers that will convert the in-tree volume API into the equivalent CSI API. This allowed us to redirect all storage operations to the CSI driver,
paving the way for us to remove the code for the built-in volume plugins without removing the API.
--&gt;
&lt;p&gt;然而，如何处理树内卷 API 的所有现有用户仍然是一个重大挑战。
为了保持 API 向后兼容性，我们在控制器中构建了一个 API 转换层，把树内卷 API 转换为等效的 CSI API。
这使我们能够将所有存储操作重定向到 CSI 驱动程序，为我们在不删除 API 的情况下删除内置卷插件的代码铺平了道路。&lt;/p&gt;
&lt;!--
You can learn more about In-tree Storage migration in [Kubernetes In-Tree to CSI Volume Migration Moves to Beta](https://kubernetes.io/blog/2019/12/09/kubernetes-1-17-feature-csi-migration-beta/).
--&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://kubernetes.io/blog/2019/12/09/kubernetes-1-17-feature-csi-migration-beta/&#34;&gt;Kubernetes 树内卷到 CSI 卷的迁移进入 Beta 阶段&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## What&#39;s next?

This migration has been the primary focus for SIG Cloud Provider over the past few years. With this significant milestone achieved, we will be shifting our efforts towards exploring new
and innovative ways for Kubernetes to better integrate with cloud providers, leveraging the external subsystems we&#39;ve built over the years. This includes making Kubernetes smarter in
hybrid environments where nodes in the cluster can run on both public and private clouds, as well as providing better tools and frameworks for developers of external providers to simplify and streamline their integration efforts.
--&gt;
&lt;h2 id=&#34;下一步是什么&#34;&gt;下一步是什么？&lt;/h2&gt;
&lt;p&gt;过去几年，这一迁移工程一直是 SIG Cloud Provider 的主要关注点。
随着这一重要里程碑的实现，我们将把努力转向探索新的创新方法，让 Kubernetes 更好地与云驱动集成，利用我们多年来构建的外部子系统。
这包括使 Kubernetes 在混合环境中变得更加智能，其集群中的节点可以运行在公共云和私有云上，
以及为外部驱动的开发人员提供更好的工具和框架，以简化他们的集成工作，提高效率。&lt;/p&gt;
&lt;!--
With all the new features, tools, and frameworks being planned, SIG Cloud Provider is not forgetting about the other side of the equation: testing. Another area of focus for the SIG&#39;s future activities is the improvement of
cloud controller testing to include more providers. The ultimate goal of this effort being to create a testing framework that will include as many providers as possible so that we give the Kubernetes community the highest
levels of confidence about their Kubernetes environments.
--&gt;
&lt;p&gt;在规划所有这些新特性、工具和框架的同时，SIG Cloud Provider 并没有忘记另一项同样重要的工作：测试。
SIG 未来活动的另一个重点领域是改进云控制器测试以涵盖更多的驱动。
这项工作的最终目标是创建一个包含尽可能多驱动的测试框架，以便我们让 Kubernetes 社区对其 Kubernetes 环境充满信心。&lt;/p&gt;
&lt;!--
If you&#39;re using a version of Kubernetes older than v1.29 and haven&#39;t migrated to an external cloud provider yet, we recommend checking out our previous blog post [Kubernetes 1.29: Cloud Provider Integrations Are Now Separate Components](/blog/2023/12/14/cloud-provider-integration-changes/).
It provides detailed information on the changes we&#39;ve made and offers guidance on how to migrate to an external provider.
Starting in v1.31, in-tree cloud providers will be permanently disabled and removed from core Kubernetes components.
--&gt;
&lt;p&gt;如果你使用的 Kubernetes 版本早于 v1.29 并且尚未迁移到外部云驱动，我们建议你查阅我们之前的博客文章
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/14/cloud-provider-integration-changes/&#34;&gt;Kubernetes 1.29：云驱动集成现在是单独的组件&lt;/a&gt;。
该博客包含与我们所作的变更相关的详细信息，并提供了有关如何迁移到外部驱动的指导。
从 v1.31 开始，树内云驱动将被永久禁用并从核心 Kubernetes 组件中删除。&lt;/p&gt;
&lt;!--
If you’re interested in contributing, come join our [bi-weekly SIG meetings](https://github.com/kubernetes/community/tree/master/sig-cloud-provider#meetings)!
--&gt;
&lt;p&gt;如果你有兴趣做出贡献，请参加我们的&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cloud-provider#meetings&#34;&gt;每两周一次的 SIG 会议&lt;/a&gt;!&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Gateway API v1.1：服务网格、GRPCRoute 和更多变化</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/09/gateway-api-v1-1/</link>
      <pubDate>Thu, 09 May 2024 09:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/09/gateway-api-v1-1/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Gateway API v1.1: Service mesh, GRPCRoute, and a whole lot more&#34;
date: 2024-05-09T09:00:00-08:00
slug: gateway-api-v1-1
author: &gt;
  [Richard Belleville](https://github.com/gnossen) (Google),
  [Frank Budinsky](https://github.com/frankbu) (IBM),
  [Arko Dasgupta](https://github.com/arkodg) (Tetrate),
  [Flynn](https://github.com/kflynn) (Buoyant),
  [Candace Holman](https://github.com/candita) (Red Hat),
  [John Howard](https://github.com/howardjohn) (Solo.io),
  [Christine Kim](https://github.com/xtineskim) (Isovalent),
  [Mattia Lavacca](https://github.com/mlavacca) (Kong),
  [Keith Mattix](https://github.com/keithmattix) (Microsoft),
  [Mike Morris](https://github.com/mikemorris) (Microsoft),
  [Rob Scott](https://github.com/robscott) (Google),
  [Grant Spence](https://github.com/gcs278) (Red Hat),
  [Shane Utt](https://github.com/shaneutt) (Kong),
  [Gina Yeh](https://github.com/ginayeh) (Google),
  and other review and release note contributors
--&gt;
&lt;p&gt;&lt;img alt=&#34;Gateway API logo&#34; src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/05/09/gateway-api-v1-1/gateway-api-logo.svg&#34;&gt;&lt;/p&gt;
&lt;!--
Following the GA release of Gateway API last October, Kubernetes
SIG Network is pleased to announce the v1.1 release of
[Gateway API](https://gateway-api.sigs.k8s.io/). In this release, several features are graduating to
_Standard Channel_ (GA), notably including support for service mesh and
GRPCRoute. We&#39;re also introducing some new experimental features, including
session persistence and client certificate verification.
--&gt;
&lt;p&gt;继去年十月正式发布 Gateway API 之后，Kubernetes SIG Network 现在又很高兴地宣布
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/&#34;&gt;Gateway API&lt;/a&gt; v1.1 版本发布。
在本次发布中，有几个特性已进阶至&lt;strong&gt;标准渠道&lt;/strong&gt;（GA），特别是对服务网格和 GRPCRoute 的支持也已进阶。
我们还引入了一些新的实验性特性，包括会话持久性和客户端证书验证。&lt;/p&gt;
&lt;!--
## What&#39;s new

### Graduation to Standard
--&gt;
&lt;h2 id=&#34;whats-new&#34;&gt;新内容  &lt;/h2&gt;
&lt;h3 id=&#34;graduation-to-standard&#34;&gt;进阶至标准渠道  &lt;/h3&gt;
&lt;!--
This release includes the graduation to Standard of four eagerly awaited features.
This means they are no longer experimental concepts; 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 certainly expect further
refinements and improvements to these new features 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;本次发布有四个备受期待的特性进阶至标准渠道。这意味着它们不再是实验性的概念；
包含在标准发布渠道中的举措展现了大家对 API 接口的高度信心，并提供向后兼容的保证。
当然，与所有其他 Kubernetes API 一样，标准渠道的特性可以随着时间的推移通过向后兼容的方式演进，
我们当然期待未来对这些新特性有进一步的优化和改进。
有关细节请参阅 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/versioning/&#34;&gt;Gateway API 版本控制政策&lt;/a&gt;。&lt;/p&gt;
&lt;!--
#### [Service Mesh Support](https://gateway-api.sigs.k8s.io/mesh/)

Service mesh support in Gateway API allows service mesh users to use the same
API to manage ingress traffic and mesh traffic, reusing the same policy and
routing interfaces. In Gateway API v1.1, routes (such as HTTPRoute) can now have
a Service as a `parentRef`, to control how traffic to specific services behave.
For more information, read the
[Gateway API service mesh documentation](https://gateway-api.sigs.k8s.io/mesh/)
or see the
[list of Gateway API implementations](https://gateway-api.sigs.k8s.io/implementations/#service-mesh-implementation-status).
--&gt;
&lt;h4 id=&#34;服务网格支持-https-gateway-api-sigs-k8s-io-mesh&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/mesh/&#34;&gt;服务网格支持&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;在 Gateway API 中支持服务网格意味着允许服务网格用户使用相同的 API 来管理 Ingress 流量和网格流量，
能够重用相同的策略和路由接口。在 Gateway API v1.1 中，路由（如 HTTPRoute）现在可以将一个 Service 作为 &lt;code&gt;parentRef&lt;/code&gt;，
以控制到特定服务的流量行为。有关细节请查阅
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/mesh/&#34;&gt;Gateway API 服务网格文档&lt;/a&gt;或
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/implementations/#service-mesh-implementation-status&#34;&gt;Gateway API 实现列表&lt;/a&gt;。&lt;/p&gt;
&lt;!--
As an example, one could do a canary deployment of a workload deep in an
application&#39;s call graph with an HTTPRoute as follows:
--&gt;
&lt;p&gt;例如，你可以使用如下 HTTPRoute 以金丝雀部署深入到应用调用图中的工作负载：&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;color-canary&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;faces&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;color&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;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;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;color&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;weight&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;50&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;color2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;weight&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;50&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 would split traffic sent to the `color` Service in the `faces` namespace
50/50 between the original `color` Service and the `color2` Service, using a
portable configuration that&#39;s easy to move from one mesh to another.
--&gt;
&lt;p&gt;通过使用一种便于从一个网格迁移到另一个网格的可移植配置，
此 HTTPRoute 对象将把发送到 &lt;code&gt;faces&lt;/code&gt; 命名空间中的 &lt;code&gt;color&lt;/code&gt; Service 的流量按 50/50
拆分到原始的 &lt;code&gt;color&lt;/code&gt; Service 和 &lt;code&gt;color2&lt;/code&gt; Service 上。&lt;/p&gt;
&lt;!--
#### [GRPCRoute](https://gateway-api.sigs.k8s.io/guides/grpc-routing/)

If you are already using the experimental version of GRPCRoute, we recommend holding
off on upgrading to the standard channel version of GRPCRoute until the
controllers you&#39;re using have been updated to support GRPCRoute v1. Until then,
it is safe to upgrade to the experimental channel version of GRPCRoute in v1.1
that includes both v1alpha2 and v1 API versions.
--&gt;
&lt;h4 id=&#34;grpcroute-https-gateway-api-sigs-k8s-io-guides-grpc-routing&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/grpc-routing/&#34;&gt;GRPCRoute&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;如果你已经在使用实验性版本的 GRPCRoute，我们建议你暂时不要升级到标准渠道版本的 GRPCRoute，
除非你正使用的控制器已被更新为支持 GRPCRoute v1。
在此之后，你才可以安全地升级到实验性渠道版本的 GRPCRoute v1.1，这个版本同时包含了 v1alpha2 和 v1 的 API。&lt;/p&gt;
&lt;!--
#### [ParentReference Port](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.ParentReference)

The `port` field was added to ParentReference, allowing you to attach resources
to Gateway Listeners, Services, or other parent resources
(depending on the implementation). Binding to a port also allows you to attach
to multiple Listeners at once.
--&gt;
&lt;h4 id=&#34;parentreference-端口-https-gateway-api-sigs-k8s-io-reference-spec-gateway-networking-k8s-io-2fv1-parentreference&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.ParentReference&#34;&gt;ParentReference 端口&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;port&lt;/code&gt; 字段已被添加到 ParentReference 中，
允许你将资源挂接到 Gateway 监听器、Service 或其他父资源（取决于实现）。
绑定到某个端口还允许你一次挂接到多个监听器。&lt;/p&gt;
&lt;!--
For example, you can attach an HTTPRoute to one or more specific Listeners of a
Gateway as specified by the Listener `port`, instead of the Listener `name` field.

For more information, see
[Attaching to Gateways](https://gateway-api.sigs.k8s.io/api-types/httproute/#attaching-to-gateways).
--&gt;
&lt;p&gt;例如，你可以将 HTTPRoute 挂接到由监听器 &lt;code&gt;port&lt;/code&gt; 而不是监听器 &lt;code&gt;name&lt;/code&gt; 字段所指定的一个或多个特定监听器。&lt;/p&gt;
&lt;p&gt;有关细节请参阅&lt;a href=&#34;https://gateway-api.sigs.k8s.io/api-types/httproute/#attaching-to-gateways&#34;&gt;挂接到 Gateways&lt;/a&gt;。&lt;/p&gt;
&lt;!--
#### [Conformance Profiles and Reports](https://gateway-api.sigs.k8s.io/concepts/conformance/#conformance-profiles)

The conformance report API has been expanded with the `mode` field (intended to
specify the working mode of the implementation), and the `gatewayAPIChannel`
(standard or experimental). The `gatewayAPIVersion` and `gatewayAPIChannel` are
now filled in automatically by the suite machinery, along with a brief
description of the testing outcome. The Reports have been reorganized in a more
structured way, and the implementations can now add information on how the tests
have been run and provide reproduction steps.
--&gt;
&lt;h4 id=&#34;合规性配置文件和报告-https-gateway-api-sigs-k8s-io-concepts-conformance-conformance-profiles&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/conformance/#conformance-profiles&#34;&gt;合规性配置文件和报告&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;合规性报告 API 被扩展了，添加了 &lt;code&gt;mode&lt;/code&gt; 字段（用于指定实现的工作模式）以及 &lt;code&gt;gatewayAPIChannel&lt;/code&gt;（标准或实验性）。
&lt;code&gt;gatewayAPIVersion&lt;/code&gt; 和 &lt;code&gt;gatewayAPIChannel&lt;/code&gt; 现在由套件机制自动填充，并附有测试结果的简要描述。
这些报告已通过更加结构化的方式进行重新组织，现在实现可以添加测试是如何运行的有关信息，还能提供复现步骤。&lt;/p&gt;
&lt;!--
### New additions to Experimental channel

#### [Gateway Client Certificate Verification](https://gateway-api.sigs.k8s.io/geps/gep-91/)

Gateways can now configure client cert verification for each Gateway Listener by
introducing a new `frontendValidation` field within `tls`. This field
supports configuring a list of CA Certificates that can be used as a trust
anchor to validate the certificates presented by the client.
--&gt;
&lt;h3 id=&#34;实验性渠道的新增内容&#34;&gt;实验性渠道的新增内容&lt;/h3&gt;
&lt;h4 id=&#34;gateway-客户端证书验证-https-gateway-api-sigs-k8s-io-geps-gep-91&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-91/&#34;&gt;Gateway 客户端证书验证&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Gateway 现在可以通过在 &lt;code&gt;tls&lt;/code&gt; 内引入的新字段 &lt;code&gt;frontendValidation&lt;/code&gt; 来为每个
Gateway 监听器配置客户端证书验证。此字段支持配置可用作信任锚的 CA 证书列表，以验证客户端呈现的证书。&lt;/p&gt;
&lt;!--
The following example shows how the CACertificate stored in
the `foo-example-com-ca-cert` ConfigMap can be used to validate the certificates
presented by clients connecting to the `foo-https` Gateway Listener.
--&gt;
&lt;p&gt;以下示例显示了如何使用存储在 &lt;code&gt;foo-example-com-ca-cert&lt;/code&gt; ConfigMap 中的 CACertificate
来验证连接到 &lt;code&gt;foo-https&lt;/code&gt; Gateway 监听器的客户端所呈现的证书。&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;client-validation-basic&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;acme-lb&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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-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;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;hostname&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo.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;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;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;foo-example-com-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:#008000;font-weight:bold&#34;&gt;frontendValidation&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;caCertificateRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;ConfigMap&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;foo-example-com-ca-cert&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;!--
#### [Session Persistence and BackendLBPolicy](https://gateway-api.sigs.k8s.io/geps/gep-1619/)

[Session Persistence](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.SessionPersistence)
is being introduced to Gateway API via a new policy
([BackendLBPolicy](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1alpha2.BackendLBPolicy))
for Service-level configuration and as fields within HTTPRoute
and GRPCRoute for route-level configuration. The BackendLBPolicy and route-level
APIs provide the same session persistence configuration, including session
timeouts, session name, session type, and cookie lifetime type.
--&gt;
&lt;h4 id=&#34;会话持久性和-backendlbpolicy-https-gateway-api-sigs-k8s-io-geps-gep-1619&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1619/&#34;&gt;会话持久性和 BackendLBPolicy&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.SessionPersistence&#34;&gt;会话持久性&lt;/a&gt;
通过新的策略（&lt;a href=&#34;https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1alpha2.BackendLBPolicy&#34;&gt;BackendLBPolicy&lt;/a&gt;）
引入到 Gateway API 中用于服务级配置，在 HTTPRoute 和 GRPCRoute 内以字段的形式用于路由级配置。
BackendLBPolicy 和路由级 API 提供相同的会话持久性配置，包括会话超时、会话名称、会话类型和 cookie 生命周期类型。&lt;/p&gt;
&lt;!--
Below is an example configuration of `BackendLBPolicy` that enables cookie-based
session persistence for the `foo` service. It sets the session name to
`foo-session`, defines absolute and idle timeouts, and configures the cookie to
be a session cookie:
--&gt;
&lt;p&gt;以下是 &lt;code&gt;BackendLBPolicy&lt;/code&gt; 的示例配置，为 &lt;code&gt;foo&lt;/code&gt; 服务启用基于 Cookie 的会话持久性。
它将会话名称设置为 &lt;code&gt;foo-session&lt;/code&gt;，定义绝对超时时间和空闲超时时间，并将 Cookie 配置为会话 Cookie：&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/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;BackendLBPolicy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;lb-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;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-ns&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;targetRefs&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;core&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;sessionPersistence&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;sessionName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;foo-session&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;absoluteTimeout&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;1h&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;idleTimeout&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;30m&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;Cookie&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;cookieConfig&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;lifetimeType&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Session&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;!--
### Everything else

#### [TLS Terminology Clarifications](https://gateway-api.sigs.k8s.io/geps/gep-2907/)
--&gt;
&lt;h3 id=&#34;其他更新&#34;&gt;其他更新&lt;/h3&gt;
&lt;h4 id=&#34;tls-术语阐述-https-gateway-api-sigs-k8s-io-geps-gep-2907&#34;&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-2907/&#34;&gt;TLS 术语阐述&lt;/a&gt;&lt;/h4&gt;
&lt;!--
As part of a broader goal of making our TLS terminology more consistent
throughout the API, we&#39;ve introduced some breaking changes to BackendTLSPolicy.
This has resulted in a new API version (v1alpha3) and will require any existing
implementations of this policy to properly handle the version upgrade, e.g.
by backing up data and uninstalling the v1alpha2 version before installing this
newer version.

Any references to v1alpha2 BackendTLSPolicy fields will need to be updated to
v1alpha3. Specific changes to fields include:
--&gt;
&lt;p&gt;为了在整个 API 中让我们的 TLS 术语更加一致以实现更广泛的目标，
我们对 BackendTLSPolicy 做了一些破坏性变更。
这就产生了新的 API 版本（v1alpha3），且将需要这个策略所有现有的实现来正确处理版本升级，
例如通过备份数据并在安装这个新版本之前卸载 v1alpha2 版本。&lt;/p&gt;
&lt;p&gt;所有引用了 v1alpha2 BackendTLSPolicy 的字段都将需要更新为 v1alpha3。这些字段的具体变更包括：&lt;/p&gt;
&lt;!--
- `targetRef` becomes `targetRefs` to allow a BackendTLSPolicy to attach to
  multiple targets
- `tls` becomes `validation`
- `tls.caCertRefs` becomes `validation.caCertificateRefs`
- `tls.wellKnownCACerts` becomes `validation.wellKnownCACertificates`
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;targetRef&lt;/code&gt; 变为 &lt;code&gt;targetRefs&lt;/code&gt; 以允许 BackendTLSPolicy 挂接到多个目标&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tls&lt;/code&gt; 变为 &lt;code&gt;validation&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tls.caCertRefs&lt;/code&gt; 变为 &lt;code&gt;validation.caCertificateRefs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tls.wellKnownCACerts&lt;/code&gt; 变为 &lt;code&gt;validation.wellKnownCACertificates&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For a full list of the changes included in this release, please refer to the
[v1.1.0 release notes](https://github.com/kubernetes-sigs/gateway-api/releases/tag/v1.1.0).
--&gt;
&lt;p&gt;有关本次发布包含的完整变更列表，请参阅
&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/releases/tag/v1.1.0&#34;&gt;v1.1.0 发布说明&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Gateway API background

The idea of Gateway API was initially [proposed](https://youtu.be/Ne9UJL6irXY?si=wgtC9w8PMB5ZHil2)
at the 2019 KubeCon San Diego as the next generation
of Ingress API. Since then, an incredible community has formed to develop what
has likely become the
[most collaborative API in Kubernetes history](https://www.youtube.com/watch?v=V3Vu_FWb4l4).
Over 200 people have contributed to this API so far, and that number continues to grow.
--&gt;
&lt;h2 id=&#34;gateway-api-background&#34;&gt;Gateway API 背景  &lt;/h2&gt;
&lt;p&gt;Gateway API 的想法最初是在 2019 年 KubeCon San Diego 上作为下一代 Ingress API
&lt;a href=&#34;https://youtu.be/Ne9UJL6irXY?si=wgtC9w8PMB5ZHil2&#34;&gt;提出的&lt;/a&gt;。
从那时起，一个令人瞩目的社区逐渐形成，共同开发出了可能成为
&lt;a href=&#34;https://www.youtube.com/watch?v=V3Vu_FWb4l4&#34;&gt;Kubernetes 历史上最具合作精神的 API&lt;/a&gt;。
到目前为止，已有超过 200 人为该 API 做过贡献，而且这一数字还在不断攀升。&lt;/p&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 literally
couldn&#39;t have gotten this far without the support of this dedicated and active
community.
--&gt;
&lt;p&gt;维护者们要感谢为 Gateway API 做出贡献的&lt;strong&gt;每一个人&lt;/strong&gt;，
无论是提交代码、参与讨论、提供创意，还是给予常规支持，我们都在此表示诚挚的感谢。
没有这个专注且活跃的社区的支持，我们不可能走到这一步。&lt;/p&gt;
&lt;!--
## Try it out

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;h2 id=&#34;try-it-out&#34;&gt;试用一下  &lt;/h2&gt;
&lt;p&gt;与其他 Kubernetes API 不同，你不需要升级到最新版本的 Kubernetes 即可获得最新版本的 Gateway API。
只要你运行的是 Kubernetes 1.26 或更高版本，你就可以使用这个版本的 Gateway API。&lt;/p&gt;
&lt;!--
To try out the API, follow our [Getting Started Guide](https://gateway-api.sigs.k8s.io/guides/).

## Get involved

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;要试用此 API，请参阅&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/&#34;&gt;入门指南&lt;/a&gt;。&lt;/p&gt;
&lt;h2 id=&#34;get-involved&#34;&gt;参与进来  &lt;/h2&gt;
&lt;p&gt;你有很多机会可以参与进来并帮助为 Ingress 和服务网格定义 Kubernetes 路由 API 的未来。&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;!--
## Related Kubernetes blog articles

* [New Experimental Features in Gateway API v1.0](/blog/2023/11/28/gateway-api-ga/)
  11/2023
* [Gateway API v1.0: GA Release](/blog/2023/10/31/gateway-api-ga/)
  10/2023
* [Introducing ingress2gateway; Simplifying Upgrades to Gateway API](/blog/2023/10/25/introducing-ingress2gateway/)
  10/2023
* [Gateway API v0.8.0: Introducing Service Mesh Support](/blog/2023/08/29/gateway-api-v0-8/)
  08/2023
--&gt;
&lt;h2 id=&#34;related-kubernetes-blog-articles&#34;&gt;相关的 Kubernetes 博文  &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;2023 年 11 月 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/11/28/gateway-api-ga/&#34;&gt;Gateway API v1.0 中的新实验性特性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2023 年 10 月 &lt;a href=&#34;https://deploy-preview-50011--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;&lt;/li&gt;
&lt;li&gt;2023 年 10 月&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/25/introducing-ingress2gateway/&#34;&gt;介绍 ingress2gateway；简化 Gateway API 升级&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2023 年 8 月 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/29/gateway-api-v0-8/&#34;&gt;Gateway API v0.8.0：引入服务网格支持&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.30：防止未经授权的卷模式转换进阶到 GA</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/30/prevent-unauthorized-volume-mode-conversion-ga/</link>
      <pubDate>Tue, 30 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/30/prevent-unauthorized-volume-mode-conversion-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.30: Preventing unauthorized volume mode conversion moves to GA&#34;
date: 2024-04-30
slug: prevent-unauthorized-volume-mode-conversion-ga
author: &gt;
  Raunak Pradip Shah (Mirantis)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Raunak Pradip Shah (Mirantis)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
With the release of Kubernetes 1.30, the feature to prevent the modification of the volume mode
of a [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/) that was created from
an existing VolumeSnapshot in a Kubernetes cluster, has moved to GA!
--&gt;
&lt;p&gt;随着 Kubernetes 1.30 的发布，防止修改从 Kubernetes 集群中现有
VolumeSnapshot 创建的 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;PersistentVolumeClaim&lt;/a&gt;
的卷模式的特性已被升级至 GA！&lt;/p&gt;
&lt;!--
## The problem

The [Volume Mode](/docs/concepts/storage/persistent-volumes/#volume-mode) of a PersistentVolumeClaim 
refers to whether the underlying volume on the storage device is formatted into a filesystem or
presented as a raw block device to the Pod that uses it.

Users can leverage the VolumeSnapshot feature, which has been stable since Kubernetes v1.20,
to create a PersistentVolumeClaim (shortened as PVC) from an existing VolumeSnapshot in
the Kubernetes cluster. The PVC spec includes a dataSource field, which can point to an
existing VolumeSnapshot instance.
Visit [Create a PersistentVolumeClaim from a Volume Snapshot](/docs/concepts/storage/persistent-volumes/#create-persistent-volume-claim-from-volume-snapshot) 
for more details on how to create a PVC from an existing VolumeSnapshot in a Kubernetes cluster.
--&gt;
&lt;h2 id=&#34;问题&#34;&gt;问题&lt;/h2&gt;
&lt;p&gt;PersistentVolumeClaim 的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#volume-mode&#34;&gt;卷模式&lt;/a&gt;
是指存储设备上的底层卷是被格式化为某文件系统还是作为原始块设备呈现给使用它的 Pod。&lt;/p&gt;
&lt;p&gt;用户可以利用自 Kubernetes v1.20 以来一直稳定的 VolumeSnapshot 特性，基于
Kubernetes 集群中现有的 VolumeSnapshot 创建 PersistentVolumeClaim（简称 PVC）。
PVC 规约中包括一个 &lt;code&gt;dataSource&lt;/code&gt; 字段，它可以指向现有的 VolumeSnapshot 实例。
有关如何基于 Kubernetes 集群中现有 VolumeSnapshot 创建 PVC 的更多详细信息，
请访问&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#create-persistent-volume-claim-from-volume-snapshot&#34;&gt;使用卷快照创建 PersistentVolumeClaim&lt;/a&gt;。&lt;/p&gt;
&lt;!--
When leveraging the above capability, there is no logic that validates whether the mode of the
original volume, whose snapshot was taken, matches the mode of the newly created volume.

This presents a security gap that allows malicious users to potentially exploit an
as-yet-unknown vulnerability in the host operating system.

There is a valid use case to allow some users to perform such conversions. Typically, storage backup
vendors convert the volume mode during the course of a backup operation, to retrieve changed blocks 
for greater efficiency of operations. This prevents Kubernetes from blocking the operation completely
and presents a challenge in distinguishing trusted users from malicious ones.
--&gt;
&lt;p&gt;当利用上述特性时，没有逻辑来验证制作快照的原始卷的模式是否与新创建的卷的模式匹配。&lt;/p&gt;
&lt;p&gt;这带来了一个安全漏洞，允许恶意用户潜在地利用主机操作系统中未知的漏洞。&lt;/p&gt;
&lt;p&gt;有一个合法的场景允许某些用户执行此类转换。
通常，存储备份供应商会在备份操作过程中转换卷模式，通过检索已被更改的块来提高操作效率。
这使得 Kubernetes 无法完全阻止此类操作，但给区分可信用户和恶意用户带来了挑战。&lt;/p&gt;
&lt;!--
## Preventing unauthorized users from converting the volume mode

In this context, an authorized user is one who has access rights to perform **update**
or **patch** operations on VolumeSnapshotContents, which is a cluster-level resource.  
It is up to the cluster administrator to provide these rights only to trusted users
or applications, like backup vendors.
Users apart from such authorized ones will never be allowed to modify the volume mode
of a PVC when it is being created from a VolumeSnapshot.
--&gt;
&lt;h2 id=&#34;防止未经授权的用户转换卷模式&#34;&gt;防止未经授权的用户转换卷模式&lt;/h2&gt;
&lt;p&gt;在此上下文中，授权用户是有权对 VolumeSnapshotContents（集群级资源）执行
&lt;strong&gt;update&lt;/strong&gt; 或 &lt;strong&gt;patch&lt;/strong&gt; 操作的用户。
集群管理员应仅向受信任的用户或应用程序（例如备份供应商）赋予这些权限。
当从 VolumeSnapshot 创建 PVC 时，除了此类授权用户之外的用户将永远不会被允许修改 PVC 的卷模式。&lt;/p&gt;
&lt;!--
To convert the volume mode, an authorized user must do the following:

1. Identify the VolumeSnapshot that is to be used as the data source for a newly
   created PVC in the given namespace.
2. Identify the VolumeSnapshotContent bound to the above VolumeSnapshot.
--&gt;
&lt;p&gt;要转换卷模式，授权用户必须执行以下操作：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;标识要用作给定命名空间中新创建的 PVC 的数据源的 VolumeSnapshot。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;识别与上述 VolumeSnapshot 绑定的 VolumeSnapshotContent。&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 describe volumesnapshot -n &amp;lt;namespace&amp;gt; &amp;lt;name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Add the annotation [`snapshot.storage.kubernetes.io/allow-volume-mode-change: &#34;true&#34;`](/docs/reference/labels-annotations-taints/#snapshot-storage-kubernetes-io-allowvolumemodechange)
   to the above VolumeSnapshotContent. The VolumeSnapshotContent annotations must include one similar to the following manifest fragment:
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;在 VolumeSnapshotContent 上添加 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/labels-annotations-taints/#snapshot-storage-kubernetes-io-allowvolumemodechange&#34;&gt;&lt;code&gt;snapshot.storage.kubernetes.io/allow-volume-mode-change: &amp;quot;true&amp;quot;&lt;/code&gt;&lt;/a&gt;
注解，VolumeSnapshotContent 注解必须包含类似于以下清单片段：&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;VolumeSnapshotContent&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;snapshot.storage.kubernetes.io/allow-volume-mode-change&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:#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;/li&gt;
&lt;/ol&gt;
&lt;!--
**Note**: For pre-provisioned VolumeSnapshotContents, you must take an extra
step of setting `spec.sourceVolumeMode` field to either `Filesystem` or `Block`,
depending on the mode of the volume from which this snapshot was taken.

An example is shown below:
--&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：对于预配置的 VolumeSnapshotContents，你必须执行额外的步骤，将
&lt;code&gt;spec.sourceVolumeMode&lt;/code&gt; 字段设置为 &lt;code&gt;Filesystem&lt;/code&gt; 或 &lt;code&gt;Block&lt;/code&gt;，
具体取决于用来制作此快照的卷的模式。&lt;/p&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;snapshot.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;VolumeSnapshotContent&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;snapshot.storage.kubernetes.io/allow-volume-mode-change&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;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;lt;volume-snapshot-content-name&amp;gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;deletionPolicy&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;driver&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;hostpath.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;source&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;snapshotHandle&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;lt;snapshot-handle&amp;gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;sourceVolumeMode&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;volumeSnapshotRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&amp;lt;volume-snapshot-name&amp;gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&amp;lt;namespace&amp;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;!--
Repeat steps 1 to 3 for all VolumeSnapshotContents whose volume mode needs to be
converted during a backup or restore operation. This can be done either via software
with credentials of an authorized user or manually by the authorized user(s).

If the annotation shown above is present on a VolumeSnapshotContent object,
Kubernetes will not prevent the volume mode from being converted.
Users should keep this in mind before they attempt to add the annotation
to any VolumeSnapshotContent.
--&gt;
&lt;p&gt;对备份或恢复操作期间需要转换卷模式的所有 VolumeSnapshotContent 重复步骤 1 至 3。
这可以通过具有授权用户凭据的软件来完成，也可以由授权用户手动完成。&lt;/p&gt;
&lt;p&gt;如果 VolumeSnapshotContent 对象上存在上面显示的注解，Kubernetes 将不会阻止卷模式转换。
用户在尝试将注解添加到任何 VolumeSnapshotContent 之前应记住这一点。&lt;/p&gt;
&lt;!--
## Action required

The `prevent-volume-mode-conversion` feature flag is enabled by default in the 
external-provisioner `v4.0.0` and external-snapshotter `v7.0.0`. Volume mode change
will be rejected when creating a PVC from a VolumeSnapshot unless the steps
described above have been performed.
--&gt;
&lt;h2 id=&#34;需要采取的行动&#34;&gt;需要采取的行动&lt;/h2&gt;
&lt;p&gt;默认情况下，在 external-provisioner &lt;code&gt;v4.0.0&lt;/code&gt; 和 external-snapshotter &lt;code&gt;v7.0.0&lt;/code&gt;
中启用 &lt;code&gt;prevent-volume-mode-conversion&lt;/code&gt; 特性标志。
基于 VolumeSnapshot 来创建 PVC 时，卷模式更改将被拒绝，除非已执行上述步骤。&lt;/p&gt;
&lt;!--
## What&#39;s next

To determine which CSI external sidecar versions support this feature, please head
over to the [CSI docs page](https://kubernetes-csi.github.io/docs/).
For any queries or issues, join [Kubernetes on Slack](https://slack.k8s.io/) and
create a thread in the #csi or #sig-storage channel. Alternately, create an issue in the
CSI external-snapshotter [repository](https://github.com/kubernetes-csi/external-snapshotter).
--&gt;
&lt;h2 id=&#34;接下来&#34;&gt;接下来&lt;/h2&gt;
&lt;p&gt;要确定哪些 CSI 外部 sidecar 版本支持此功能，请前往 &lt;a href=&#34;https://kubernetes-csi.github.io/docs/&#34;&gt;CSI 文档页面&lt;/a&gt;。
对于任何疑问或问题，请加入 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;Slack 上的 Kubernetes&lt;/a&gt; 并在 #csi 或 #sig-storage 频道中发起讨论。
或者，在 CSI 外部快照&lt;a href=&#34;https://github.com/kubernetes-csi/external-snapshotter&#34;&gt;仓库&lt;/a&gt;中登记问题。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.30：结构化身份认证配置进阶至 Beta</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/25/structured-authentication-moves-to-beta/</link>
      <pubDate>Thu, 25 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/25/structured-authentication-moves-to-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.30: Structured Authentication Configuration Moves to Beta&#34;
date: 2024-04-25
slug: structured-authentication-moves-to-beta
author: &gt;
  [Anish Ramasekar](https://github.com/aramase) (Microsoft)
--&gt;
&lt;!--
With Kubernetes 1.30, we (SIG Auth) are moving Structured Authentication Configuration to beta.

Today&#39;s article is about _authentication_: finding out who&#39;s performing a task, and checking
that they are who they say they are. Check back in tomorrow to find about what&#39;s new in
Kubernetes v1.30 around _authorization_ (deciding what someone can and can&#39;t access).
--&gt;
&lt;p&gt;在 Kubernetes 1.30 中，我们（SIG Auth）将结构化身份认证配置（Structured Authentication Configuration）进阶至 Beta。&lt;/p&gt;
&lt;p&gt;今天的文章是关于&lt;strong&gt;身份认证&lt;/strong&gt;：找出谁在执行任务，核查他们是否是自己所说的那个人。
本文还述及 Kubernetes v1.30 中关于 &lt;strong&gt;鉴权&lt;/strong&gt;（决定某些人能访问什么，不能访问什么）的新内容。&lt;/p&gt;
&lt;!--
## Motivation
Kubernetes has had a long-standing need for a more flexible and extensible
authentication system. The current system, while powerful, has some limitations
that make it difficult to use in certain scenarios. For example, it is not
possible to use multiple authenticators of the same type (e.g., multiple JWT
authenticators) or to change the configuration without restarting the API server. The
Structured Authentication Configuration feature is the first step towards
addressing these limitations and providing a more flexible and extensible way
to configure authentication in Kubernetes.
--&gt;
&lt;h2 id=&#34;motivation&#34;&gt;动机  &lt;/h2&gt;
&lt;p&gt;Kubernetes 长期以来都需要一个更灵活、更好扩展的身份认证系统。
当前的系统虽然强大，但有一些限制，使其难以用在某些场景下。
例如，不可能同时使用多个相同类型的认证组件（例如，多个 JWT 认证组件），
也不可能在不重启 API 服务器的情况下更改身份认证配置。
结构化身份认证配置特性是解决这些限制并提供一种更灵活、更好扩展的方式来配置 Kubernetes 中身份认证的第一步。&lt;/p&gt;
&lt;!--
## What is structured authentication configuration?
Kubernetes v1.30 builds on the experimental support for configurating authentication based on
a file, that was added as alpha in Kubernetes v1.30. At this beta stage, Kubernetes only supports configuring JWT
authenticators, which serve as the next iteration of the existing OIDC
authenticator. JWT authenticator is an authenticator to
authenticate Kubernetes users using JWT compliant tokens. The authenticator
will attempt to parse a raw ID token, verify it&#39;s been signed by the configured 
issuer.
--&gt;
&lt;h2 id=&#34;what-is-structured-authentication-configuration&#34;&gt;什么是结构化身份认证配置？  &lt;/h2&gt;
&lt;p&gt;Kubernetes v1.30 针对基于文件来配置身份认证提供实验性支持，这是在 Kubernetes v1.30 中新增的 Alpha 特性。
在此 Beta 阶段，Kubernetes 仅支持配置 JWT 认证组件，这是现有 OIDC 认证组件的下一次迭代。
JWT 认证组件使用符合 JWT 标准的令牌对 Kubernetes 用户进行身份认证。
此认证组件将尝试解析原始 ID 令牌，验证其是否由配置的签发方签名。&lt;/p&gt;
&lt;!--
The Kubernetes project added configuration from a file so that it can provide more
flexibility than using command line options (which continue to work, and are still supported).
Supporting a configuration file also makes it easy to deliver further improvements in upcoming
releases.
--&gt;
&lt;p&gt;Kubernetes 项目新增了基于文件的配置，以便提供比使用命令行选项（命令行依然有效，仍受支持）更灵活的方式。
对配置文件的支持还使得在即将发布的版本中更容易提供更多改进措施。&lt;/p&gt;
&lt;!--
### Benefits of structured authentication configuration
Here&#39;s why using a configuration file to configure cluster authentication is a benefit:
--&gt;
&lt;h3 id=&#34;benefits-of-structured-authentication-configuration&#34;&gt;结构化身份认证配置的好处  &lt;/h3&gt;
&lt;p&gt;以下是使用配置文件来配置集群身份认证的好处：&lt;/p&gt;
&lt;!--
1. **Multiple JWT authenticators**: You can configure multiple JWT authenticators
   simultaneously. This allows you to use multiple identity providers (e.g.,
   Okta, Keycloak, GitLab) without needing to use an intermediary like Dex
   that handles multiplexing between multiple identity providers.
2. **Dynamic configuration**: You can change the configuration without
   restarting the API server. This allows you to add, remove, or modify
   authenticators without disrupting the API server.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;多个 JWT 认证组件&lt;/strong&gt;：你可以同时配置多个 JWT 认证组件。
这允许你使用多个身份提供程序（例如 Okta、Keycloak、GitLab）而无需使用像
Dex 这样的中间程序来处理多个身份提供程序之间的多路复用。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;动态配置&lt;/strong&gt;：你可以在不重启 API 服务器的情况下更改配置。
这允许你添加、移除或修改认证组件而不会中断 API 服务器。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. **Any JWT-compliant token**: You can use any JWT-compliant token for
   authentication. This allows you to use tokens from any identity provider that
   supports JWT. The minimum valid JWT payload must contain the claims documented 
   in [structured authentication configuration](/docs/reference/access-authn-authz/authentication/#using-authentication-configuration)
   page in the Kubernetes documentation.
4. **CEL (Common Expression Language) support**: You can use [CEL](/docs/reference/using-api/cel/) 
   to determine whether the token&#39;s claims match the user&#39;s attributes in Kubernetes (e.g.,
   username, group). This allows you to use complex logic to determine whether a
   token is valid.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;&lt;strong&gt;任何符合 JWT 标准的令牌&lt;/strong&gt;：你可以使用任何符合 JWT 标准的令牌进行身份认证。
这允许你使用任何支持 JWT 的身份提供程序的令牌。最小有效的 JWT 载荷必须包含 Kubernetes
文档中&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/authentication/#using-authentication-configuration&#34;&gt;结构化身份认证配置&lt;/a&gt;页面中记录的申领。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CEL（通用表达式语言）支持&lt;/strong&gt;：你可以使用 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/cel/&#34;&gt;CEL&lt;/a&gt;
来确定令牌的申领是否与 Kubernetes 中用户的属性（例如用户名、组）匹配。
这允许你使用复杂逻辑来确定令牌是否有效。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
5. **Multiple audiences**: You can configure multiple audiences for a single
   authenticator. This allows you to use the same authenticator for multiple
   audiences, such as using a different OAuth client for `kubectl` and dashboard.
6. **Using identity providers that don&#39;t support OpenID connect discovery**: You
   can use identity providers that don&#39;t support [OpenID Connect 
   discovery](https://openid.net/specs/openid-connect-discovery-1_0.html). The only
   requirement is to host the discovery document at a different location than the
   issuer (such as locally in the cluster) and specify the `issuer.discoveryURL` in
   the configuration file.
--&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;&lt;strong&gt;多个受众群体&lt;/strong&gt;：你可以为单个认证组件配置多个受众群体。
这允许你为多个受众群体使用相同的认证组件，例如为 &lt;code&gt;kubectl&lt;/code&gt; 和仪表板使用不同的 OAuth 客户端。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;使用不支持 OpenID 连接发现的身份提供程序&lt;/strong&gt;：你可以使用不支持
&lt;a href=&#34;https://openid.net/specs/openid-connect-discovery-1_0.html&#34;&gt;OpenID 连接发现&lt;/a&gt; 的身份提供程序。
唯一的要求是将发现文档托管到与签发方不同的位置（例如在集群中本地），并在配置文件中指定 &lt;code&gt;issuer.discoveryURL&lt;/code&gt;。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## How to use Structured Authentication Configuration
To use structured authentication configuration, you specify
the path to the authentication configuration using the `--authentication-config`
command line argument in the API server. The configuration file is a YAML file
that specifies the authenticators and their configuration. Here is an example
configuration file that configures two JWT authenticators:
--&gt;
&lt;h2 id=&#34;how-to-use-structured-authentication-configuration&#34;&gt;如何使用结构化身份认证配置  &lt;/h2&gt;
&lt;p&gt;要使用结构化身份认证配置，你可以使用 &lt;code&gt;--authentication-config&lt;/code&gt; 命令行参数在
API 服务器中指定身份认证配置的路径。此配置文件是一个 YAML 文件，指定认证组件及其配置。
以下是一个配置两个 JWT 认证组件的示例配置文件：&lt;/p&gt;
&lt;!--
# Someone with a valid token from either of these issuers could authenticate
# against this cluster.
# second authenticator that exposes the discovery document at a different location
# than the issuer
--&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;apiserver.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;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;AuthenticationConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#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;# 如果某人具有这些 issuer 之一签发的有效令牌，则此人可以在集群上进行身份认证&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;jwt&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;issuer&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;url&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;https://issuer1.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;audiences&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- audience1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- audience2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;audienceMatchPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;MatchAny&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claimValidationRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.hd == &amp;#34;example.com&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;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;the hosted domain name must be example.com&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;claimMappings&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;username&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.username&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;groups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.groups&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;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.uid&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;extra&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;example.com/tenant&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.tenant&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;userValidationRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;!user.username.startsWith(&amp;#39;system:&amp;#39;)&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;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;username cannot use reserved system: prefix&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:#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;issuer&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;url&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;https://issuer2.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;discoveryURL&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;https://discovery.example.com/.well-known/openid-configuration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;audiences&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- audience3&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- audience4&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;audienceMatchPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;MatchAny&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claimValidationRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.hd == &amp;#34;example.com&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;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;the hosted domain name must be example.com&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;claimMappings&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;username&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.username&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;groups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.groups&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;uid&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.uid&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;extra&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;example.com/tenant&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;claims.tenant&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;userValidationRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;!user.username.startsWith(&amp;#39;system:&amp;#39;)&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;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;username cannot use reserved system: prefix&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;!--
## Migration from command line arguments to configuration file
The Structured Authentication Configuration feature is designed to be
backwards-compatible with the existing approach, based on command line options, for 
configuring the JWT authenticator. This means that you can continue to use the existing
command-line options to configure the JWT authenticator. However, we (Kubernetes SIG Auth) 
recommend migrating to the new configuration file-based approach, as it provides more
flexibility and extensibility.
--&gt;
&lt;h2 id=&#34;migration-from-command-line-arguments-to-configuration-file&#34;&gt;从命令行参数迁移到配置文件  &lt;/h2&gt;
&lt;p&gt;结构化身份认证配置特性旨在与基于命令行选项配置 JWT 认证组件的现有方法向后兼容。
这意味着你可以继续使用现有的命令行选项来配置 JWT 认证组件。
但是，我们（Kubernetes SIG Auth）建议迁移到新的基于配置文件的方法，因为这种方法更灵活，更好扩展。&lt;/p&gt;


&lt;div class=&#34;alert alert-primary&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;Note&lt;/h4&gt;

    &lt;!--
If you specify `--authentication-config` along with any of the `--oidc-*` command line arguments, this is
a misconfiguration. In this situation, the API server reports an error and then immediately exits.

If you want to switch to using structured authentication configuration, you have to remove the `--oidc-*`
command line arguments, and use the configuration file instead.
--&gt;
&lt;p&gt;如果你同时指定 &lt;code&gt;--authentication-config&lt;/code&gt; 和任何 &lt;code&gt;--oidc-*&lt;/code&gt; 命令行参数，这是一种错误的配置。
在这种情况下，API 服务器会报告错误，然后立即退出。&lt;/p&gt;
&lt;p&gt;如果你想切换到使用结构化身份认证配置，你必须移除 &lt;code&gt;--oidc-*&lt;/code&gt; 命令行参数，并改为使用配置文件。&lt;/p&gt;


&lt;/div&gt;

&lt;!--
Here is an example of how to migrate from the command-line flags to the
configuration file:

### Command-line arguments
--&gt;
&lt;p&gt;以下是如何从命令行标志迁移到配置文件的示例：&lt;/p&gt;
&lt;h3 id=&#34;command-line-arguments&#34;&gt;命令行参数  &lt;/h3&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;--oidc-issuer-url&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;https://issuer.example.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-client-id&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;example-client-id
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-username-claim&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;username
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-groups-claim&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;groups
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-username-prefix&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;oidc:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-groups-prefix&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;oidc:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-required-claim&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;hd=example.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-required-claim&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;admin=true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--oidc-ca-file&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/path/to/ca.pem
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
There is no equivalent in the configuration file for the `--oidc-signing-algs`. 
For Kubernetes v1.30, the authenticator supports all the asymmetric algorithms listed in
[`oidc.go`](https://github.com/kubernetes/kubernetes/blob/b4935d910dcf256288694391ef675acfbdb8e7a3/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go#L222-L233).

### Configuration file
--&gt;
&lt;p&gt;在配置文件中没有与 &lt;code&gt;--oidc-signing-algs&lt;/code&gt; 相对应的配置项。
对于 Kubernetes v1.30，认证组件支持在
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/b4935d910dcf256288694391ef675acfbdb8e7a3/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go#L222-L233&#34;&gt;&lt;code&gt;oidc.go&lt;/code&gt;&lt;/a&gt;
中列出的所有非对称算法。&lt;/p&gt;
&lt;h3 id=&#34;configuration-file&#34;&gt;配置文件  &lt;/h3&gt;
&lt;!--
certificateAuthority: &lt;value is the content of file /path/to/ca.pem&gt;
--&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;apiserver.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;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;AuthenticationConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;jwt&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;issuer&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;url&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;https://issuer.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;audiences&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- example-client-id&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;certificateAuthority&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;lt;取值是 /path/to/ca.pem 文件的内容&amp;gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claimMappings&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;username&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claim&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;username&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;prefix&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;oidc:&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;groups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claim&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;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;prefix&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;oidc:&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;claimValidationRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;claim&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;hd&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredValue&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;example.com&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;claim&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;admin&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;requiredValue&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## What&#39;s next?
For Kubernetes v1.31, we expect the feature to stay in beta while we get more
feedback. In the coming releases, we want to investigate:
- Making distributed claims work via CEL expressions.
- Egress selector configuration support for calls to `issuer.url` and
  `issuer.discoveryURL`.
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;下一步是什么？  &lt;/h2&gt;
&lt;p&gt;对于 Kubernetes v1.31，我们预计该特性将保持在 Beta，我们要收集更多反馈意见。
在即将发布的版本中，我们希望调查以下内容：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;通过 CEL 表达式使分布式申领生效。&lt;/li&gt;
&lt;li&gt;对 &lt;code&gt;issuer.url&lt;/code&gt; 和 &lt;code&gt;issuer.discoveryURL&lt;/code&gt; 的调用提供 Egress 选择算符配置支持。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
You can learn more about this feature on the [structured authentication
configuration](/docs/reference/access-authn-authz/authentication/#using-authentication-configuration)
page in the Kubernetes documentation. You can also follow along on the
[KEP-3331](https://kep.k8s.io/3331) to track progress across the coming
Kubernetes releases.
--&gt;
&lt;p&gt;你可以在 Kubernetes
文档的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/authentication/#using-authentication-configuration&#34;&gt;结构化身份认证配置&lt;/a&gt;页面上了解关于此特性的更多信息。
你还可以通过 &lt;a href=&#34;https://kep.k8s.io/3331&#34;&gt;KEP-3331&lt;/a&gt; 跟踪未来 Kubernetes 版本中的进展。&lt;/p&gt;
&lt;!--
## Try it out
In this post, I have covered the benefits the Structured Authentication
Configuration feature brings in Kubernetes v1.30. To use this feature, you must specify the path to the
authentication configuration using the `--authentication-config` command line
argument. From Kubernetes v1.30, the feature is in beta and enabled by default.
If you want to keep using command line arguments instead of a configuration file,
those will continue to work as-is.
--&gt;
&lt;h2 id=&#34;try-it-out&#34;&gt;试用一下  &lt;/h2&gt;
&lt;p&gt;在本文中，我介绍了结构化身份认证配置特性在 Kubernetes v1.30 中带来的好处。
要使用此特性，你必须使用 &lt;code&gt;--authentication-config&lt;/code&gt; 命令行参数指定身份认证配置的路径。
从 Kubernetes v1.30 开始，此特性处于 Beta 并默认启用。
如果你希望继续使用命令行参数而不想用配置文件，原来的命令行参数也将继续按原样起作用。&lt;/p&gt;
&lt;!--
We would love to hear your feedback on this feature. Please 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/)).
--&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;/p&gt;
&lt;!--
## How to get involved
If you are interested in getting involved in the development of this feature,
share feedback, or participate in any other ongoing SIG Auth projects, please
reach out on the [#sig-auth](https://kubernetes.slack.com/archives/C0EN96KUY)
channel on Kubernetes Slack.
--&gt;
&lt;h2 id=&#34;how-to-get-involved&#34;&gt;如何参与  &lt;/h2&gt;
&lt;p&gt;如果你有兴趣参与此特性的开发、分享反馈意见或参与任何其他 SIG Auth 项目，
请在 Kubernetes Slack 上的 &lt;a href=&#34;https://kubernetes.slack.com/archives/C0EN96KUY&#34;&gt;#sig-auth&lt;/a&gt; 频道联系我们。&lt;/p&gt;
&lt;!--
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;p&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 1.30：验证准入策略 ValidatingAdmissionPolicy 正式发布</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/24/validating-admission-policy-ga/</link>
      <pubDate>Wed, 24 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/24/validating-admission-policy-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.30: Validating Admission Policy Is Generally Available&#34;
slug: validating-admission-policy-ga
date: 2024-04-24
author: &gt;
  Jiahui Feng (Google)
--&gt;
&lt;!--
On behalf of the Kubernetes project, I am excited to announce that ValidatingAdmissionPolicy has reached
**general availability**
as part of Kubernetes 1.30 release. If you have not yet read about this new declarative alternative to
validating admission webhooks, it may be interesting to read our
[previous post](/blog/2022/12/20/validating-admission-policies-alpha/) about the new feature.
If you have already heard about ValidatingAdmissionPolicies and you are eager to try them out,
there is no better time to do it than now.

Let&#39;s have a taste of a ValidatingAdmissionPolicy, by replacing a simple webhook.
--&gt;
&lt;p&gt;我代表 Kubernetes 项目组成员，很高兴地宣布 ValidatingAdmissionPolicy 已经作为 Kubernetes 1.30 发布的一部分&lt;strong&gt;正式发布&lt;/strong&gt;。
如果你还不了解这个全新的声明式验证准入 Webhook 的替代方案，
请参阅有关这个新特性的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2022/12/20/validating-admission-policies-alpha/&#34;&gt;上一篇博文&lt;/a&gt;。
如果你已经对 ValidatingAdmissionPolicy 有所了解并且想要尝试一下，那么现在是最好的时机。&lt;/p&gt;
&lt;p&gt;让我们替换一个简单的 Webhook，体验一下 ValidatingAdmissionPolicy。&lt;/p&gt;
&lt;!--
## Example admission webhook
First, let&#39;s take a look at an example of a simple webhook. Here is an excerpt from a webhook that
enforces `runAsNonRoot`, `readOnlyRootFilesystem`, `allowPrivilegeEscalation`, and `privileged` to be set to the least permissive values.
--&gt;
&lt;h2 id=&#34;准入-webhook-示例&#34;&gt;准入 Webhook 示例&lt;/h2&gt;
&lt;p&gt;首先，让我们看一个简单 Webhook 的示例。以下是一个强制将
&lt;code&gt;runAsNonRoot&lt;/code&gt;、&lt;code&gt;readOnlyRootFilesystem&lt;/code&gt;、&lt;code&gt;allowPrivilegeEscalation&lt;/code&gt; 和 &lt;code&gt;privileged&lt;/code&gt; 设置为最低权限值的 Webhook 代码片段。&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;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;verifyDeployment&lt;/span&gt;(deploy &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;appsv1.Deployment) &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:#a2f;font-weight:bold&#34;&gt;var&lt;/span&gt; errs []&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:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; i, c &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; deploy.Spec.Template.Spec.Containers {
&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; c.Name &lt;span style=&#34;color:#666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#b44&#34;&gt;&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:#a2f;font-weight:bold&#34;&gt;return&lt;/span&gt; fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %d has no name&amp;#34;&lt;/span&gt;, i)
&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;if&lt;/span&gt; c.SecurityContext &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;			errs = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(errs, fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %q does not have SecurityContext&amp;#34;&lt;/span&gt;, c.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 style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; c.SecurityContext.RunAsNonRoot &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 style=&#34;color:#666&#34;&gt;||&lt;/span&gt; !&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;c.SecurityContext.RunAsNonRoot {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			errs = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(errs, fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %q must set RunAsNonRoot to true in its SecurityContext&amp;#34;&lt;/span&gt;, c.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 style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; c.SecurityContext.ReadOnlyRootFilesystem &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 style=&#34;color:#666&#34;&gt;||&lt;/span&gt; !&lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;c.SecurityContext.ReadOnlyRootFilesystem {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			errs = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(errs, fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %q must set ReadOnlyRootFilesystem to true in its SecurityContext&amp;#34;&lt;/span&gt;, c.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 style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; c.SecurityContext.AllowPrivilegeEscalation &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 style=&#34;color:#666&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;c.SecurityContext.AllowPrivilegeEscalation {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			errs = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(errs, fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %q must NOT set AllowPrivilegeEscalation to true in its SecurityContext&amp;#34;&lt;/span&gt;, c.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 style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; c.SecurityContext.Privileged &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 style=&#34;color:#666&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;*&lt;/span&gt;c.SecurityContext.Privileged {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			errs = &lt;span style=&#34;color:#a2f&#34;&gt;append&lt;/span&gt;(errs, fmt.&lt;span style=&#34;color:#00a000&#34;&gt;Errorf&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;container %q must NOT set Privileged to true in its SecurityContext&amp;#34;&lt;/span&gt;, c.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;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; errors.&lt;span style=&#34;color:#00a000&#34;&gt;NewAggregate&lt;/span&gt;(errs)
&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;!--
Check out [What are admission webhooks?](/docs/reference/access-authn-authz/extensible-admission-controllers/#what-are-admission-webhooks)
Or, see the [full code](webhook.go) of this webhook to follow along with this walkthrough. 

## The policy
Now let&#39;s try to recreate the validation faithfully with a ValidatingAdmissionPolicy.
--&gt;
&lt;p&gt;查阅&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/#what-are-admission-webhooks&#34;&gt;什么是准入 Webhook？&lt;/a&gt;，
或者查看这个 Webhook 的&lt;a href=&#34;webhook.go&#34;&gt;完整代码&lt;/a&gt;以便更好地理解下述演示。&lt;/p&gt;
&lt;h2 id=&#34;策略&#34;&gt;策略&lt;/h2&gt;
&lt;p&gt;现在，让我们尝试使用 ValidatingAdmissionPolicy 来忠实地重新创建验证。&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;admissionregistration.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;ValidatingAdmissionPolicy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy.example.com&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;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;Fail&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;apps&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;apiVersions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;v1&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;operations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;CREATE&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;UPDATE&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;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;deployments&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;validations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, has(c.securityContext) &amp;amp;&amp;amp; has(c.securityContext.runAsNonRoot) &amp;amp;&amp;amp; c.securityContext.runAsNonRoot)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set runAsNonRoot to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, has(c.securityContext) &amp;amp;&amp;amp; has(c.securityContext.readOnlyRootFilesystem) &amp;amp;&amp;amp; c.securityContext.readOnlyRootFilesystem)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set readOnlyRootFilesystem to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.allowPrivilegeEscalation) || !c.securityContext.allowPrivilegeEscalation)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set allowPrivilegeEscalation to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.Privileged) || !c.securityContext.Privileged)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set privileged to true&amp;#39;&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;!--
Create the policy with `kubectl`. Great, no complain so far. But let&#39;s get the policy object back and take a look at its status.
--&gt;
&lt;p&gt;使用 &lt;code&gt;kubectl&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 -oyaml validatingadmissionpolicies/pod-security.policy.example.com
&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:#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;typeChecking&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expressionWarnings&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;fieldRef&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;spec.validations[3].expression&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;warning&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;          apps/v1, Kind=Deployment: ERROR: &amp;lt;input&amp;gt;:1:76: undefined field &amp;#39;Privileged&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;           | object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.Privileged) || !c.securityContext.Privileged)
&lt;/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;          ERROR: &amp;lt;input&amp;gt;:1:128: undefined field &amp;#39;Privileged&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;           | object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.Privileged) || !c.securityContext.Privileged)
&lt;/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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The policy was checked against its matched type, which is `apps/v1.Deployment`.
Looking at the `fieldRef`, the problem was with the 3rd expression (index starts with 0)
The expression in question accessed an undefined `Privileged` field.
Ahh, looks like it was a copy-and-paste error. The field name should be in lowercase.
--&gt;
&lt;p&gt;系统根据所匹配的类别 &lt;code&gt;apps/v1.Deployment&lt;/code&gt; 对策略执行了检查。
查看 &lt;code&gt;fieldRef&lt;/code&gt; 后，发现问题出现在第 3 个表达式上（索引从 0 开始）。
有问题的表达式访问了一个未定义的 &lt;code&gt;Privileged&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;admissionregistration.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;ValidatingAdmissionPolicy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy.example.com&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;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;Fail&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;apps&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;apiVersions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;v1&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;operations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;CREATE&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;UPDATE&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;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;deployments&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;validations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, has(c.securityContext) &amp;amp;&amp;amp; has(c.securityContext.runAsNonRoot) &amp;amp;&amp;amp; c.securityContext.runAsNonRoot)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set runAsNonRoot to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, has(c.securityContext) &amp;amp;&amp;amp; has(c.securityContext.readOnlyRootFilesystem) &amp;amp;&amp;amp; c.securityContext.readOnlyRootFilesystem)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set readOnlyRootFilesystem to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.allowPrivilegeEscalation) || !c.securityContext.allowPrivilegeEscalation)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set allowPrivilegeEscalation to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers.all(c, !has(c.securityContext) || !has(c.securityContext.privileged) || !c.securityContext.privileged)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set privileged to true&amp;#39;&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;!--
Check its status again, and you should see all warnings cleared.

Next, let&#39;s create a namespace for our tests.
--&gt;
&lt;p&gt;再次检查状态，你应该看到所有警告都已被清除。&lt;/p&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 create namespace policy-test
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then, I bind the policy to the namespace. But at this point, I set the action to `Warn`
so that the policy prints out [warnings](/blog/2020/09/03/warnings/) instead of rejecting the requests.
This is especially useful to collect results from all expressions during development and automated testing.
--&gt;
&lt;p&gt;接下来，我将策略绑定到命名空间。但此时我将动作设置为 &lt;code&gt;Warn&lt;/code&gt;，
这样此策略将打印出&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2020/09/03/warnings/&#34;&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;admissionregistration.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;ValidatingAdmissionPolicyBinding&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy-binding.example.com&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;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;policyName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy.example.com&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;validationActions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Warn&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;matchResources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespaceSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&amp;#34;kubernetes.io/metadata.name&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;policy-test&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;!--
Tests out policy enforcement.
--&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 create -n policy-test -f- &lt;span style=&#34;color:#b44&#34;&gt;&amp;lt;&amp;lt;EOF
&lt;/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;apiVersion: apps/v1
&lt;/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;kind: Deployment
&lt;/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;metadata:
&lt;/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;  labels:
&lt;/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;    app: 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:#b44&#34;&gt;  name: 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:#b44&#34;&gt;spec:
&lt;/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;  selector:
&lt;/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;    matchLabels:
&lt;/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;      app: 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:#b44&#34;&gt;  template:
&lt;/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;    metadata:
&lt;/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;      labels:
&lt;/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;        app: 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:#b44&#34;&gt;    spec:
&lt;/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;      containers:
&lt;/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;      - image: 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:#b44&#34;&gt;        name: 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:#b44&#34;&gt;        securityContext:
&lt;/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;          privileged: true
&lt;/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;          allowPrivilegeEscalation: true
&lt;/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;EOF&lt;/span&gt;
&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Warning: Validation failed for ValidatingAdmissionPolicy &amp;#39;pod-security.policy.example.com&amp;#39; with binding &amp;#39;pod-security.policy-binding.example.com&amp;#39;: all containers must set runAsNonRoot to true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Warning: Validation failed for ValidatingAdmissionPolicy &amp;#39;pod-security.policy.example.com&amp;#39; with binding &amp;#39;pod-security.policy-binding.example.com&amp;#39;: all containers must set readOnlyRootFilesystem to true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Warning: Validation failed for ValidatingAdmissionPolicy &amp;#39;pod-security.policy.example.com&amp;#39; with binding &amp;#39;pod-security.policy-binding.example.com&amp;#39;: all containers must NOT set allowPrivilegeEscalation to true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Warning: Validation failed for ValidatingAdmissionPolicy &amp;#39;pod-security.policy.example.com&amp;#39; with binding &amp;#39;pod-security.policy-binding.example.com&amp;#39;: all containers must NOT set privileged to true
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Error from server: error when creating &amp;#34;STDIN&amp;#34;: admission webhook &amp;#34;webhook.example.com&amp;#34; denied the request: [container &amp;#34;nginx&amp;#34; must set RunAsNonRoot to true in its SecurityContext, container &amp;#34;nginx&amp;#34; must set ReadOnlyRootFilesystem to true in its SecurityContext, container &amp;#34;nginx&amp;#34; must NOT set AllowPrivilegeEscalation to true in its SecurityContext, container &amp;#34;nginx&amp;#34; must NOT set Privileged to true in its SecurityContext]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Looks great! The policy and the webhook give equivalent results.
After a few other cases, when we are confident with our policy, maybe it is time to do some cleanup.

- For every expression, we repeat access to `object.spec.template.spec.containers` and to each `securityContext`;
- There is a pattern of checking presence of a field and then accessing it, which looks a bit verbose.
--&gt;
&lt;p&gt;看起来很不错！策略和 Webhook 给出了等效的结果。
又测试了其他几种情形后，当我们对策略有信心时，也许是时候进行一些清理工作了。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;对于每个表达式，我们重复访问 &lt;code&gt;object.spec.template.spec.containers&lt;/code&gt; 和每个 &lt;code&gt;securityContext&lt;/code&gt;；&lt;/li&gt;
&lt;li&gt;有一个检查某字段是否存在然后访问该字段的模式，这种模式看起来有点繁琐。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Fortunately, since Kubernetes 1.28, we have new solutions for both issues.
Variable Composition allows us to extract repeated sub-expressions into their own variables.
Kubernetes enables [the optional library](https://github.com/google/cel-spec/wiki/proposal-246) for CEL, which are excellent to work with fields that are, you guessed it, optional. 

With both features in mind, let&#39;s refactor the policy a bit.
--&gt;
&lt;p&gt;幸运的是，自 Kubernetes 1.28 以来，我们对这两个问题都有了新的解决方案。
变量组合（Variable Composition）允许我们将重复的子表达式提取到单独的变量中。
Kubernetes 允许为 CEL 使用&lt;a href=&#34;https://github.com/google/cel-spec/wiki/proposal-246&#34;&gt;可选库&lt;/a&gt;，
这些库非常适合处理可选的字段，你猜对了。&lt;/p&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;admissionregistration.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;ValidatingAdmissionPolicy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy.example.com&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;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;Fail&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resourceRules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiGroups&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;apps&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;apiVersions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;v1&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;operations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;CREATE&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;UPDATE&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;resources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;   &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;deployments&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;variables&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;containers&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;object.spec.template.spec.containers&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;securityContexts&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;variables.containers.map(c, c.?securityContext)&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;validations&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;variables.securityContexts.all(c, c.?runAsNonRoot == optional.of(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;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set runAsNonRoot to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;variables.securityContexts.all(c, c.?readOnlyRootFilesystem == optional.of(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;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must set readOnlyRootFilesystem to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;variables.securityContexts.all(c, c.?allowPrivilegeEscalation != optional.of(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;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set allowPrivilegeEscalation to true&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;expression&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;variables.securityContexts.all(c, c.?privileged != optional.of(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;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;message&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;all containers must NOT set privileged to true&amp;#39;&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 policy is now much cleaner and more readable. Update the policy, and you should see
it function the same as before.

Now let&#39;s change the policy binding from warning to actually denying requests that fail validation.
--&gt;
&lt;p&gt;策略现在更简洁、更易读。更新策略后，你应该看到它的功用与之前无异。&lt;/p&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;admissionregistration.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;ValidatingAdmissionPolicyBinding&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy-binding.example.com&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;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;policyName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;pod-security.policy.example.com&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;validationActions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Deny&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;matchResources&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespaceSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;&amp;#34;kubernetes.io/metadata.name&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;policy-test&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;!--
And finally, remove the webhook. Now the result should include only messages from 
the policy.
--&gt;
&lt;p&gt;最后，移除 Webhook。现在结果应该只包含来自策略的消息。&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 create -n policy-test -f- &lt;span style=&#34;color:#b44&#34;&gt;&amp;lt;&amp;lt;EOF
&lt;/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;apiVersion: apps/v1
&lt;/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;kind: Deployment
&lt;/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;metadata:
&lt;/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;  labels:
&lt;/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;    app: 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:#b44&#34;&gt;  name: 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:#b44&#34;&gt;spec:
&lt;/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;  selector:
&lt;/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;    matchLabels:
&lt;/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;      app: 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:#b44&#34;&gt;  template:
&lt;/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;    metadata:
&lt;/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;      labels:
&lt;/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;        app: 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:#b44&#34;&gt;    spec:
&lt;/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;      containers:
&lt;/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;      - image: 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:#b44&#34;&gt;        name: 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:#b44&#34;&gt;        securityContext:
&lt;/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;          privileged: true
&lt;/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;          allowPrivilegeEscalation: true
&lt;/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;EOF&lt;/span&gt;
&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The deployments &amp;#34;nginx&amp;#34; is invalid: : ValidatingAdmissionPolicy &amp;#39;pod-security.policy.example.com&amp;#39; with binding &amp;#39;pod-security.policy-binding.example.com&amp;#39; denied request: all containers must set runAsNonRoot to true
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Please notice that, by design, the policy will stop evaluation after the first expression that causes the request to be denied.
This is different from what happens when the expressions generate only warnings.
--&gt;
&lt;p&gt;请注意，根据设计，此策略在第一个导致请求被拒绝的表达式之后停止处理。
这与表达式只生成警告时的情况不同。&lt;/p&gt;
&lt;!--
## Set up monitoring
Unlike a webhook, a policy is not a dedicated process that can expose its own metrics.
Instead, you can use metrics from the API server in their place.

Here are some examples in Prometheus Query Language of common monitoring tasks.

To find the 95th percentile execution duration of the policy shown above.
--&gt;
&lt;h2 id=&#34;设置监控&#34;&gt;设置监控&lt;/h2&gt;
&lt;p&gt;与 Webhook 不同，策略不是一个可以公开其自身指标的专用进程。
相反，你可以使用源自 API 服务器的指标来代替。&lt;/p&gt;
&lt;p&gt;以下是使用 Prometheus 查询语言执行一些常见监控任务的示例。&lt;/p&gt;
&lt;p&gt;找到上述策略执行期间的 95 分位值：&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;histogram_quantile(0.95, sum(rate(apiserver_validating_admission_policy_check_duration_seconds_bucket{policy=&amp;#34;pod-security.policy.example.com&amp;#34;}[5m])) by (le)) 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
To find the rate of the policy evaluation.
--&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rate(apiserver_validating_admission_policy_check_total{policy=&amp;#34;pod-security.policy.example.com&amp;#34;}[5m])
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can read [the metrics reference](/docs/reference/instrumentation/metrics/) to learn more about the metrics above.
The metrics of ValidatingAdmissionPolicy are currently in alpha,
and more and better metrics will come while the stability graduates in the future release.
--&gt;
&lt;p&gt;你可以阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/docs/reference/instrumentation/metrics/&#34;&gt;指标参考&lt;/a&gt;了解有关上述指标的更多信息。
ValidatingAdmissionPolicy 的指标目前处于 Alpha 阶段，随着稳定性在未来版本中的提升，将会有更多和更好的指标。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.30：只读卷挂载终于可以真正实现只读了</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/23/recursive-read-only-mounts/</link>
      <pubDate>Tue, 23 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/23/recursive-read-only-mounts/</guid>
      <description>
        
        
        &lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Akihiro Suda (NTT)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
layout: blog
title: &#39;Kubernetes 1.30: Read-only volume mounts can be finally literally read-only&#39;
date: 2024-04-23
slug: recursive-read-only-mounts
author: &gt;
  Akihiro Suda (NTT)
--&gt;
&lt;!--
Read-only volume mounts have been a feature of Kubernetes since the beginning.
Surprisingly, read-only mounts are not completely read-only under certain conditions on Linux.
As of the v1.30 release, they can be made completely read-only,
with alpha support for _recursive read-only mounts_.
--&gt;
&lt;p&gt;只读卷挂载从一开始就是 Kubernetes 的一个特性。
令人惊讶的是，在 Linux 上的某些条件下，只读挂载并不是完全只读的。
从 v1.30 版本开始，这类卷挂载可以被处理为完全只读；v1.30 为&lt;strong&gt;递归只读挂载&lt;/strong&gt;提供 Alpha 支持。&lt;/p&gt;
&lt;!--
## Read-only volume mounts are not really read-only by default

Volume mounts can be deceptively complicated.

You might expect that the following manifest makes everything under `/mnt` in the containers read-only:
--&gt;
&lt;h2 id=&#34;默认情况下-只读卷装载并不是真正的只读&#34;&gt;默认情况下，只读卷装载并不是真正的只读&lt;/h2&gt;
&lt;p&gt;卷挂载可能看似复杂。&lt;/p&gt;
&lt;p&gt;你可能期望以下清单使容器中 &lt;code&gt;/mnt&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:#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;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;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;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;mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;/mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;/mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;readOnly&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;!--
However, any sub-mounts beneath `/mnt` may still be writable!
For example, consider that `/mnt/my-nfs-server` is writeable on the host.
Inside the container, writes to `/mnt/*` will be rejected but `/mnt/my-nfs-server/*` will still be writeable.
--&gt;
&lt;p&gt;但是，&lt;code&gt;/mnt&lt;/code&gt; 下的任何子挂载可能仍然是可写的！
例如，假设 &lt;code&gt;/mnt/my-nfs-server&lt;/code&gt; 在主机上是可写的。
在容器内部，写入 &lt;code&gt;/mnt/*&lt;/code&gt; 将被拒绝，但 &lt;code&gt;/mnt/my-nfs-server/*&lt;/code&gt; 仍然可写。&lt;/p&gt;
&lt;!--
## New mount option: recursiveReadOnly

Kubernetes 1.30 added a new mount option `recursiveReadOnly` so as to make submounts recursively read-only.

The option can be enabled as follows:
--&gt;
&lt;h2 id=&#34;新的挂载选项-递归只读&#34;&gt;新的挂载选项：递归只读&lt;/h2&gt;
&lt;p&gt;Kubernetes 1.30 添加了一个新的挂载选项 &lt;code&gt;recursiveReadOnly&lt;/code&gt;，以使子挂载递归只读。&lt;/p&gt;
&lt;p&gt;可以按如下方式启用该选项：&lt;/p&gt;
&lt;!--
# Possible values are `Enabled`, `IfPossible`, and `Disabled`.
# Needs to be specified in conjunction with `readOnly: true`.
--&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;display:grid;&#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;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;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;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;mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;hostPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;/mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;/mnt&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;readOnly&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; background-color:#dfdfdf&#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;# NEW&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex; background-color:#dfdfdf&#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;# 可能的值为 `Enabled`、`IfPossible` 和 `Disabled`。&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex; background-color:#dfdfdf&#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;# 需要与 `readOnly: 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; background-color:#dfdfdf&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;recursiveReadOnly&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Enabled&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;!--
This is implemented by applying the `MOUNT_ATTR_RDONLY` attribute with the `AT_RECURSIVE` flag
using [`mount_setattr(2)`](https://man7.org/linux/man-pages/man2/mount_setattr.2.html) added in
Linux kernel v5.12.

For backwards compatibility, the `recursiveReadOnly` field is not a replacement for `readOnly`,
but is used _in conjunction_ with it.
To get a properly recursive read-only mount, you must set both fields.
--&gt;
&lt;p&gt;这是通过使用 Linux 内核 v5.12 中添加的
&lt;a href=&#34;https://man7.org/linux/man-pages/man2/mount_setattr.2.html&#34;&gt;&lt;code&gt;mount_setattr(2)&lt;/code&gt;&lt;/a&gt;
应用带有 &lt;code&gt;AT_RECURSIVE&lt;/code&gt; 标志的 &lt;code&gt;MOUNT_ATTR_RDONLY&lt;/code&gt; 属性来实现的。&lt;/p&gt;
&lt;p&gt;为了向后兼容，&lt;code&gt;recursiveReadOnly&lt;/code&gt; 字段不是 &lt;code&gt;readOnly&lt;/code&gt; 的替代品，而是与其结合使用。
要获得正确的递归只读挂载，你必须设置这两个字段。&lt;/p&gt;
&lt;!--
## Feature availability {#availability}

To enable `recursiveReadOnly` mounts, the following components have to be used:
--&gt;
&lt;h2 id=&#34;availability&#34;&gt;特性可用性  &lt;/h2&gt;
&lt;p&gt;要启用 &lt;code&gt;recursiveReadOnly&lt;/code&gt; 挂载，必须使用以下组件：&lt;/p&gt;
&lt;!--
* Kubernetes: v1.30 or later, with the `RecursiveReadOnlyMounts`
  [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) enabled.
  As of v1.30, the gate is marked as alpha.

* CRI runtime:
  * containerd: v2.0 or later

* OCI runtime:
  * runc: v1.1 or later
  * crun: v1.8.6 or later

* Linux kernel: v5.12 or later
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Kubernetes：v1.30 或更新版本，并启用 &lt;code&gt;RecursiveReadOnlyMounts&lt;/code&gt; &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;。
从 v1.30 开始，此特性被标记为 Alpha。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CRI 运行时：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;containerd：v2.0 或更新版本&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;OCI 运行时：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;runc：v1.1 或更新版本&lt;/li&gt;
&lt;li&gt;crun: v1.8.6 或更新版本&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Linux 内核: v5.12 或更新版本&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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.

The default value of `recursiveReadOnly` will still remain `Disabled`, 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;recursive ReadOnly&lt;/code&gt; 的默认值仍将保持 &lt;code&gt;Disabled&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/45159 --&gt;
&lt;!--
Please check out the [documentation](/docs/concepts/storage/volumes/#read-only-mounts)
for the further details of `recursiveReadOnly` mounts.
--&gt;
&lt;p&gt;请查看&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volumes/#read-only-mounts&#34;&gt;文档&lt;/a&gt;以获取
&lt;code&gt;recursiveReadOnly&lt;/code&gt; 挂载的更多详细信息。&lt;/p&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 1.30：对 Pod 使用用户命名空间的支持进阶至 Beta</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/22/userns-beta/</link>
      <pubDate>Mon, 22 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/22/userns-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.30: Beta Support For Pods With User Namespaces&#34;
date: 2024-04-22
slug: userns-beta
author: &gt;
  Rodrigo Campos Catelin (Microsoft),
  Giuseppe Scrivano (Red Hat),
  Sascha Grunert (Red Hat)
--&gt;
&lt;!--
Linux provides different namespaces to isolate processes from each other. For
example, a typical Kubernetes pod runs within a network namespace to isolate the
network identity and a PID namespace to isolate the processes.

One Linux namespace that was left behind is the [user
namespace](https://man7.org/linux/man-pages/man7/user_namespaces.7.html). This
namespace allows us to isolate the user and group identifiers (UIDs and GIDs) we
use inside the container from the ones on the host.
--&gt;
&lt;p&gt;Linux 提供了不同的命名空间来将进程彼此隔离。
例如，一个典型的 Kubernetes Pod 运行在一个网络命名空间中可以隔离网络身份，运行在一个 PID 命名空间中可以隔离进程。&lt;/p&gt;
&lt;p&gt;Linux 有一个以前一直未被容器化应用所支持的命名空间是&lt;a href=&#34;https://man7.org/linux/man-pages/man7/user_namespaces.7.html&#34;&gt;用户命名空间&lt;/a&gt;。
这个命名空间允许我们将容器内使用的用户标识符和组标识符（UID 和 GID）与主机上的标识符隔离开来。&lt;/p&gt;
&lt;!--
This is a powerful abstraction that allows us to run containers as &#34;root&#34;: we
are root inside the container and can do everything root can inside the pod,
but our interactions with the host are limited to what a non-privileged user can
do. This is great for limiting the impact of a container breakout.
--&gt;
&lt;p&gt;这是一个强大的抽象，允许我们以 “root” 身份运行容器：
我们在容器内部有 root 权限，可以在 Pod 内执行所有 root 能做的操作，
但我们与主机的交互仅限于非特权用户可以执行的操作。这对于限制容器逃逸的影响非常有用。&lt;/p&gt;
&lt;!--
A container breakout is when a process inside a container can break out
onto the host using some unpatched vulnerability in the container runtime or the
kernel and can access/modify files on the host or other containers. If we
run our pods with user namespaces, the privileges the container has over the
rest of the host are reduced, and the files outside the container it can access
are limited too.
--&gt;
&lt;p&gt;容器逃逸是指容器内的进程利用容器运行时或内核中的某些未打补丁的漏洞逃逸到主机上，
并可以访问/修改主机或其他容器上的文件。如果我们以用户命名空间运行我们的 Pod，
容器对主机其余部分的特权将减少，并且此容器可以访问的容器外的文件也将受到限制。&lt;/p&gt;
&lt;!--
In Kubernetes v1.25, we introduced support for user namespaces only for stateless
pods. Kubernetes 1.28 lifted that restriction, and now, with Kubernetes 1.30, we
are moving to beta!
--&gt;
&lt;p&gt;在 Kubernetes v1.25 中，我们仅为无状态 Pod 引入了对用户命名空间的支持。
Kubernetes 1.28 取消了这一限制，目前在 Kubernetes 1.30 中，这个特性进阶到了 Beta！&lt;/p&gt;
&lt;!--
## What is a user namespace?

Note: Linux user namespaces are a different concept from [Kubernetes
namespaces](/docs/concepts/overview/working-with-objects/namespaces/).
The former is a Linux kernel feature; the latter is a Kubernetes feature.
--&gt;
&lt;h2 id=&#34;what-is-a-user-namespace&#34;&gt;什么是用户命名空间？  &lt;/h2&gt;
&lt;p&gt;注意：Linux 用户命名空间与
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/working-with-objects/namespaces/&#34;&gt;Kubernetes 命名空间&lt;/a&gt;是不同的概念。
前者是一个 Linux 内核特性；后者是一个 Kubernetes 特性。&lt;/p&gt;
&lt;!--
User namespaces are a Linux feature that isolates the UIDs and GIDs of the
containers from the ones on the host. The identifiers in the container can be
mapped to identifiers on the host in a way where the host UID/GIDs used for
different containers never overlap. Furthermore, the identifiers can be mapped
to unprivileged, non-overlapping UIDs and GIDs on the host. This brings two key
benefits:
--&gt;
&lt;p&gt;用户命名空间是一个 Linux 特性，它将容器的 UID 和 GID 与主机上的隔离开来。
容器中的标识符可以被映射为主机上的标识符，并且保证不同容器所使用的主机 UID/GID 不会重叠。
此外，这些标识符可以被映射到主机上没有特权的、非重叠的 UID 和 GID。这带来了两个关键好处：&lt;/p&gt;
&lt;!--
* _Prevention of lateral movement_: As the UIDs and GIDs for different
containers are mapped to different UIDs and GIDs on the host, containers have a
harder time attacking each other, even if they escape the container boundaries.
For example, suppose container A runs with different UIDs and GIDs on the host
than container B. In that case, the operations it can do on container B&#39;s files and processes
are limited: only read/write what a file allows to others, as it will never
have permission owner or group permission (the UIDs/GIDs on the host are
guaranteed to be different for different containers).
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;防止横向移动&lt;/strong&gt;：由于不同容器的 UID 和 GID 被映射到主机上的不同 UID 和 GID，
即使这些标识符逃出了容器的边界，容器之间也很难互相攻击。
例如，假设容器 A 在主机上使用的 UID 和 GID 与容器 B 不同。
在这种情况下，它对容器 B 的文件和进程的操作是有限的：只能读取/写入某文件所允许的操作，
因为它永远不会拥有文件所有者或组权限（主机上的 UID/GID 保证对不同容器是不同的）。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* _Increased host isolation_: As the UIDs and GIDs are mapped to unprivileged
users on the host, if a container escapes the container boundaries, even if it
runs as root inside the container, it has no privileges on the host. This
greatly protects what host files it can read/write, which process it can send
signals to, etc. Furthermore, capabilities granted are only valid inside the
user namespace and not on the host, limiting the impact a container
escape can have.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;增加主机隔离&lt;/strong&gt;：由于 UID 和 GID 被映射到主机上的非特权用户，如果某容器逃出了它的边界，
即使它在容器内部以 root 身份运行，它在主机上也没有特权。
这大大保护了它可以读取/写入的主机文件，它可以向哪个进程发送信号等。
此外，所授予的权能仅在用户命名空间内有效，而在主机上无效，这就限制了容器逃逸的影响。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/images/blog/2024-04-22-userns-beta/userns-ids.png&#34;
         alt=&#34;Image showing IDs 0-65535 are reserved to the host, pods use higher IDs&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;User namespace IDs allocation&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/images/blog/2024-04-22-userns-beta/userns-ids.png&#34;
         alt=&#34;此图显示了 ID 0-65535 为主机预留，Pod 使用更大的 ID&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;用户命名空间 ID 分配&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
Without using a user namespace, a container running as root in the case of a
container breakout has root privileges on the node. If some capabilities
were granted to the container, the capabilities are valid on the host too. None
of this is true when using user namespaces (modulo bugs, of course 🙂).
--&gt;
&lt;p&gt;如果不使用用户命名空间，容器逃逸时以 root 运行的容器在节点上将具有 root 特权。
如果某些权能授权给了此容器，这些权能在主机上也会有效。
如果使用用户命名空间，就不会是这种情况（当然，除非有漏洞 🙂）。&lt;/p&gt;
&lt;!--
## Changes in 1.30

In Kubernetes 1.30, besides moving user namespaces to beta, the contributors
working on this feature:
--&gt;
&lt;h2 id=&#34;changes-in-1.30&#34;&gt;1.30 的变化  &lt;/h2&gt;
&lt;p&gt;在 Kubernetes 1.30 中，除了将用户命名空间进阶至 Beta，参与此特性的贡献者们还：&lt;/p&gt;
&lt;!--
* Introduced a way for the kubelet to use custom ranges for the UIDs/GIDs mapping 
 * Have added a way for Kubernetes to enforce that the runtime supports all the features
   needed for user namespaces. If they are not supported, Kubernetes will show a
   clear error when trying to create a pod with user namespaces. Before 1.30, if
   the container runtime didn&#39;t support user namespaces, the pod could be created
   without a user namespace.
 * Added more tests, including [tests in the
   cri-tools](https://github.com/kubernetes-sigs/cri-tools/pull/1354)
   repository.
--&gt;
&lt;ul&gt;
&lt;li&gt;为 kubelet 引入了一种使用自定义范围进行 UID/GID 映射的方式&lt;/li&gt;
&lt;li&gt;为 Kubernetes 添加了一种强制执行的方式让运行时支持用户命名空间所需的所有特性。
如果不支持这些特性，Kubernetes 在尝试创建具有用户命名空间的 Pod 时，会显示一个明确的错误。
在 1.30 之前，如果容器运行时不支持用户命名空间，Pod 可能会在没有用户命名空间的情况下被创建。&lt;/li&gt;
&lt;li&gt;新增了更多的测试，包括在 &lt;a href=&#34;https://github.com/kubernetes-sigs/cri-tools/pull/1354&#34;&gt;cri-tools&lt;/a&gt; 仓库中的测试。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
You can check the
[documentation](/docs/concepts/workloads/pods/user-namespaces/#set-up-a-node-to-support-user-namespaces)
on user namespaces for how to configure custom ranges for the mapping.
--&gt;
&lt;p&gt;你可以查阅有关用户命名空间的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/user-namespaces/#set-up-a-node-to-support-user-namespaces&#34;&gt;文档&lt;/a&gt;，
了解如何配置映射的自定义范围。&lt;/p&gt;
&lt;!--
## Demo

A few months ago, [CVE-2024-21626][runc-cve] was disclosed. This **vulnerability
score is 8.6 (HIGH)**. It allows an attacker to escape a container and
**read/write to any path on the node and other pods hosted on the same node**.

Rodrigo created a demo that exploits [CVE 2024-21626][runc-cve] and shows how
the exploit, which works without user namespaces, **is mitigated when user
namespaces are in use.**
--&gt;
&lt;h2 id=&#34;demo&#34;&gt;演示  &lt;/h2&gt;
&lt;p&gt;几个月前，&lt;a href=&#34;https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv&#34;&gt;CVE-2024-21626&lt;/a&gt; 被披露。
这个 &lt;strong&gt;漏洞评分为 8.6（高）&lt;/strong&gt;。它允许攻击者让容器逃逸，并&lt;strong&gt;读取/写入节点上的任何路径以及同一节点上托管的其他 Pod&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;Rodrigo 创建了一个滥用 &lt;a href=&#34;https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv&#34;&gt;CVE 2024-21626&lt;/a&gt; 的演示，
演示了此漏洞在没有用户命名空间时的工作方式，而在使用用户命名空间后 &lt;strong&gt;得到了缓解&lt;/strong&gt;。&lt;/p&gt;
&lt;!--


    
    &lt;div class=&#34;youtube-quote-sm&#34;&gt;
      &lt;iframe allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; allowfullscreen=&#34;allowfullscreen&#34; loading=&#34;eager&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; src=&#34;https://www.youtube.com/embed/07y5bl5UDdA?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0&#34; title=&#34;Mitigation of CVE-2024-21626 on Kubernetes by enabling User Namespace support&#34;
      &gt;&lt;/iframe&gt;
    &lt;/div&gt;

--&gt;


    
    &lt;div class=&#34;youtube-quote-sm&#34;&gt;
      &lt;iframe allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; allowfullscreen=&#34;allowfullscreen&#34; loading=&#34;eager&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; src=&#34;https://www.youtube.com/embed/07y5bl5UDdA?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0&#34; title=&#34;通过启用用户命名空间支持来在 Kubernetes 上缓解 CVE-2024-21626&#34;
      &gt;&lt;/iframe&gt;
    &lt;/div&gt;

&lt;!--
Please note that with user namespaces, an attacker can do on the host file system
what the permission bits for &#34;others&#34; allow. Therefore, the CVE is not
completely prevented, but the impact is greatly reduced.
--&gt;
&lt;p&gt;请注意，使用用户命名空间时，攻击者可以在主机文件系统上执行“其他”权限位所允许的操作。
因此，此 CVE 并没有完全被修复，但影响大大降低。&lt;/p&gt;
&lt;!--
## Node system requirements

There are requirements on the Linux kernel version and the container
runtime to use this feature.

On Linux you need Linux 6.3 or greater. This is because the feature relies on a
kernel feature named idmap mounts, and support for using idmap mounts with tmpfs
was merged in Linux 6.3.
--&gt;
&lt;h2 id=&#34;node-system-requirements&#34;&gt;节点系统要求  &lt;/h2&gt;
&lt;p&gt;使用此特性对 Linux 内核版本和容器运行时有一些要求。&lt;/p&gt;
&lt;p&gt;在 Linux 上，你需要 Linux 6.3 或更高版本。
这是因为此特性依赖于一个名为 idmap 挂载的内核特性，而支持 idmap 挂载与 tmpfs 一起使用的特性是在 Linux 6.3 中合并的。&lt;/p&gt;
&lt;!--
Suppose you are using [CRI-O][crio] with crun; as always, you can expect support for
Kubernetes 1.30 with CRI-O 1.30. Please note you also need [crun][crun] 1.9 or
greater. If you are using CRI-O with [runc][runc], this is still not supported.

Containerd support is currently targeted for [containerd][containerd] 2.0, and
the same crun version requirements apply. If you are using containerd with runc,
this is still not supported.
--&gt;
&lt;p&gt;假设你使用 &lt;a href=&#34;https://cri-o.io/&#34;&gt;CRI-O&lt;/a&gt; 和 crun；就像往常一样，你可以期待 CRI-O 1.30 支持 Kubernetes 1.30。
请注意，你还需要 &lt;a href=&#34;https://github.com/containers/crun&#34;&gt;crun&lt;/a&gt; 1.9 或更高版本。如果你使用的是 CRI-O 和 &lt;a href=&#34;https://github.com/opencontainers/runc/&#34;&gt;runc&lt;/a&gt;，则仍然不支持用户命名空间。&lt;/p&gt;
&lt;p&gt;containerd 对此特性的支持目前锁定为 &lt;a href=&#34;https://containerd.io/&#34;&gt;containerd&lt;/a&gt; 2.0，同样 crun 也有适用的版本要求。
如果你使用的是 containerd 和 runc，则仍然不支持用户命名空间。&lt;/p&gt;
&lt;!--
Please note that containerd 1.7 added _experimental_ support for user
namespaces, as implemented in Kubernetes 1.25 and 1.26. We did a redesign in
Kubernetes 1.27, which requires changes in the container runtime. Those changes
are not present in containerd 1.7, so it only works with user namespaces
support in Kubernetes 1.25 and 1.26.
--&gt;
&lt;p&gt;请注意，正如在 Kubernetes 1.25 和 1.26 中实现的那样，containerd 1.7 增加了对用户命名空间的&lt;strong&gt;实验性&lt;/strong&gt;支持。
我们曾在 Kubernetes 1.27 中进行了重新设计，所以容器运行时需要做一些变更。
而 containerd 1.7 并未包含这些变更，所以它仅在 Kubernetes 1.25 和 1.26 中支持使用用户命名空间。&lt;/p&gt;
&lt;!--
Another limitation of containerd 1.7 is that it needs to change the
ownership of every file and directory inside the container image during Pod
startup. This has a storage overhead and can significantly impact the
container startup latency. Containerd 2.0 will probably include an implementation
that will eliminate the added startup latency and storage overhead. Consider
this if you plan to use containerd 1.7 with user namespaces in
production.

None of these containerd 1.7 limitations apply to CRI-O.
--&gt;
&lt;p&gt;containerd 1.7 的另一个限制是，它需要在 Pod 启动期间变更容器镜像内的每个文件和目录的所有权。
这会增加存储开销，并可能显著影响容器启动延迟。containerd 2.0 可能会包含一个实现，以消除增加的启动延迟和存储开销。
如果你计划在生产环境中使用 containerd 1.7 和用户命名空间，请考虑这一点。&lt;/p&gt;
&lt;p&gt;containerd 1.7 的这些限制均不适用于 CRI-O。&lt;/p&gt;
&lt;!--
## How do I get involved?

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)
--&gt;
&lt;h2 id=&#34;how-do-i-get-involved&#34;&gt;如何参与？  &lt;/h2&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;提交社区 Issue/PR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
You can also contact us directly:
- GitHub: @rata @giuseppe @saschagrunert
- Slack: @rata @giuseppe @sascha
--&gt;
&lt;p&gt;你也可以通过以下方式直接联系我们：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub：@rata @giuseppe @saschagrunert&lt;/li&gt;
&lt;li&gt;Slack：@rata @giuseppe @sascha&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>SIG Architecture 特别报道：代码组织</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/11/sig-architecture-code-spotlight-2024/</link>
      <pubDate>Thu, 11 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/04/11/sig-architecture-code-spotlight-2024/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Architecture: Code Organization&#34;
slug: sig-architecture-code-spotlight-2024
canonicalUrl: https://www.kubernetes.dev/blog/2024/04/11/sig-architecture-code-spotlight-2024
date: 2024-04-11
author: &gt;
  Frederico Muñoz (SAS Institute)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Frederico Muñoz (SAS Institute)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
_This is the third interview of a SIG Architecture Spotlight series that will cover the different
subprojects. We will cover [SIG Architecture: Code Organization](https://github.com/kubernetes/community/blob/e44c2c9d0d3023e7111d8b01ac93d54c8624ee91/sig-architecture/README.md#code-organization)._

In this SIG Architecture spotlight I talked with [Madhav Jivrajani](https://github.com/MadhavJivrajani)
(VMware), a member of the Code Organization subproject.
--&gt;
&lt;p&gt;&lt;strong&gt;这是 SIG Architecture Spotlight 系列的第三次采访，该系列将涵盖不同的子项目。
我们将介绍 &lt;a href=&#34;https://github.com/kubernetes/community/blob/e44c2c9d0d3023e7111d8b01ac93d54c8624ee91/sig-architecture/README.md#code-organization&#34;&gt;SIG Architecture：代码组织&lt;/a&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在本次 SIG Architecture 聚焦中，我与代码组织子项目的成员
&lt;a href=&#34;https://github.com/MadhavJivrajani&#34;&gt;Madhav Jivrajani&lt;/a&gt;（VMware）进行了交谈。&lt;/p&gt;
&lt;!--
## Introducing the Code Organization subproject

**Frederico (FSM)**: Hello Madhav, thank you for your availability. Could you start by telling us a
bit about yourself, your role and how you got involved in Kubernetes?
--&gt;
&lt;h2 id=&#34;介绍代码组织子项目&#34;&gt;介绍代码组织子项目&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Frederico (FSM)&lt;/strong&gt;：你好，Madhav，感谢你百忙之中接受我们的采访。你能否首先向我们介绍一下你自己、你的角色以及你是如何参与 Kubernetes 的？&lt;/p&gt;
&lt;!--
**Madhav Jivrajani (MJ)**: Hello! My name is Madhav Jivrajani, I serve as a technical lead for SIG
Contributor Experience and a GitHub Admin for the Kubernetes project. Apart from that I also
contribute to SIG API Machinery and SIG Etcd, but more recently, I’ve been helping out with the work
that is needed to help Kubernetes [stay on supported versions of
Go](https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions),
and it is through this that I am involved with the Code Organization subproject of SIG Architecture.
--&gt;
&lt;p&gt;&lt;strong&gt;Madhav Jivrajani (MJ)&lt;/strong&gt;：你好！我叫 Madhav Jivrajani，担任 SIG 贡献者体验的技术主管和 Kubernetes 项目的 GitHub 管理员。
除此之外，我还为 SIG API Machinery 和 SIG Etcd 做出贡献，但最近，我一直在帮助完成 Kubernetes
&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions&#34;&gt;保留受支持的 Go 版本&lt;/a&gt; 所需的工作，
正是通过这一点，参与到了 SIG Architecture 的代码组织子项目中。&lt;/p&gt;
&lt;!--
**FSM**: A project the size of Kubernetes must have unique challenges in terms of code organization
-- is this a fair assumption?  If so, what would you pick as some of the main challenges that are
specific to Kubernetes?
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：像 Kubernetes 这样规模的项目在代码组织方面肯定会遇到独特的挑战 -- 这是一个合理的假设吗？
如果是这样，你认为 Kubernetes 特有的一些主要挑战是什么？&lt;/p&gt;
&lt;!--
**MJ**: That’s a fair assumption! The first interesting challenge comes from the sheer size of the
Kubernetes codebase. We have ≅2.2 million lines of Go code (which is steadily decreasing thanks to
[dims](https://github.com/dims) and other folks in this sub-project!), and a little over 240
dependencies that we rely on either directly or indirectly, which is why having a sub-project
dedicated to helping out with dependency management is crucial: we need to know what dependencies
we’re pulling in, what versions these dependencies are at, and tooling to help make sure we are
managing these dependencies across different parts of the codebase in a consistent manner.
--&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：这是一个合理的假设！第一个有趣的挑战来自 Kubernetes 代码库的庞大规模。
我们有大约 220 万行 Go 代码（由于 &lt;a href=&#34;https://github.com/dims&#34;&gt;dims&lt;/a&gt; 和这个子项目中的其他人的努力，该代码正在稳步减少！），
而且我们的依赖项（无论是直接还是间接）超过 240 个，这就是为什么拥有一个致力于帮助进行依赖项管理的子项目至关重要：
我们需要知道我们正在引入哪些依赖项，这些依赖项处于什么版本，
以及帮助确保我们能够以一致的方式管理代码库不同部分的依赖关系的工具。
以一致的方式管理代码库不同部分的这些依赖关系。&lt;/p&gt;
&lt;!--
Another interesting challenge with Kubernetes is that we publish a lot of Go modules as part of the
Kubernetes release cycles, one example of this is
[`client-go`](https://github.com/kubernetes/client-go).However, we as a project would also like the
benefits of having everything in one repository to get the advantages of using a monorepo, like
atomic commits... so, because of this, code organization works with other SIGs (like SIG Release) to
automate the process of publishing code from the monorepo to downstream individual repositories
which are much easier to consume, and this way you won’t have to import the entire Kubernetes
codebase!
--&gt;
&lt;p&gt;Kubernetes 的另一个有趣的挑战是，我们在 Kubernetes 发布周期中发布了许多 Go 模块，其中一个例子是
&lt;a href=&#34;https://github.com/kubernetes/client-go&#34;&gt;&lt;code&gt;client-go&lt;/code&gt;&lt;/a&gt;。
然而，作为一个项目，我们也希望将所有内容都放在一个仓库中，便获得使用单一仓库的优势，例如原子性的提交……
因此，代码组织与其他 SIG（例如 SIG Release）合作，以实现将代码从单一仓库发布到下游仓库的自动化过程，
下游仓库更容易使用，因为你就不必导入整个 Kubernetes 代码库！&lt;/p&gt;
&lt;!--
## Code organization and Kubernetes

**FSM**: For someone just starting contributing to Kubernetes code-wise, what are the main things
they should consider in terms of code organization? How would you sum up the key concepts?

**MJ**: I think one of the key things to keep in mind at least as you’re starting off is the concept
of staging directories. In the [`kubernetes/kubernetes`](https://github.com/kubernetes/kubernetes)
repository, you will come across a directory called
[`staging/`](https://github.com/kubernetes/kubernetes/tree/master/staging). The sub-folders in this
directory serve as a bunch of pseudo-repositories. For example, the
[`kubernetes/client-go`](https://github.com/kubernetes/client-go) repository that publishes releases
for `client-go` is actually a [staging
repo](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go).
--&gt;
&lt;h2 id=&#34;代码组织和-kubernetes&#34;&gt;代码组织和 Kubernetes&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：对于刚刚开始为 Kubernetes 代码做出贡献的人来说，在代码组织方面他们应该考虑的主要事项是什么？
你认为有哪些关键概念？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：我认为至少在开始时要记住的关键事情之一是 staging 目录的概念。
在 &lt;a href=&#34;https://github.com/kubernetes/kubernetes&#34;&gt;&lt;code&gt;kubernetes/kubernetes&lt;/code&gt;&lt;/a&gt; 中，你会遇到一个名为
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/tree/master/staging&#34;&gt;&lt;code&gt;staging/&lt;/code&gt;&lt;/a&gt; 的目录。
该目录中的子文件夹充当一堆伪仓库。
例如，发布 &lt;code&gt;client-go&lt;/code&gt; 版本的 &lt;a href=&#34;https://github.com/kubernetes/client-go&#34;&gt;&lt;code&gt;kubernetes/client-go&lt;/code&gt;&lt;/a&gt;
仓库实际上是一个 &lt;a href=&#34;https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go&#34;&gt;staging 仓库&lt;/a&gt;。&lt;/p&gt;
&lt;!--
**FSM**: So the concept of staging directories fundamentally impact contributions?

**MJ**: Precisely, because if you’d like to contribute to any of the staging repos, you will need to
send in a PR to its corresponding staging directory in `kubernetes/kubernetes`. Once the code merges
there, we have a bot called the [`publishing-bot`](https://github.com/kubernetes/publishing-bot)
that will sync the merged commits to the required staging repositories (like
`kubernetes/client-go`). This way we get the benefits of a monorepo but we also can modularly
publish code for downstream consumption. PS: The `publishing-bot` needs more folks to help out!

For more information on staging repositories, please see the [contributor
documentation](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/staging.md).
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：那么 staging 目录的概念会从根本上影响贡献？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：准确地说，因为如果你想为任何 staging 仓库做出贡献，你需要将 PR 发送到 &lt;code&gt;kubernetes/kubernetes&lt;/code&gt; 中相应的 staging 目录。
一旦代码合并到那里，我们就会让一个名为 &lt;a href=&#34;https://github.com/kubernetes/publishing-bot&#34;&gt;&lt;code&gt;publishing-bot&lt;/code&gt;&lt;/a&gt;
的机器人将合并的提交同步到必要的 staging 仓库（例如 &lt;code&gt;kubernetes/client-go&lt;/code&gt;）中。
通过这种方式，我们可以获得单一仓库的好处，但我们也可以以模块化的形式发布代码以供下游使用。
PS：&lt;code&gt;publishing-bot&lt;/code&gt; 需要更多人的帮助！&lt;/p&gt;
&lt;!--
**FSM**: Speaking of contributions, the very high number of contributors, both individuals and
companies, must also be a challenge: how does the subproject operate in terms of making sure that
standards are being followed?
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：说到贡献，贡献者数量非常多，包括个人和公司，也一定是一个挑战：这个子项目是如何运作的以确保大家都遵循标准呢？&lt;/p&gt;
&lt;!--
**MJ**: When it comes to dependency management in the project, there is a [dedicated
team](https://github.com/kubernetes/org/blob/a106af09b8c345c301d072bfb7106b309c0ad8e9/config/kubernetes/org.yaml#L1329)
that helps review and approve dependency changes. These are folks who have helped lay the foundation
of much of the
[tooling](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/vendor.md)
that Kubernetes uses today for dependency management. This tooling helps ensure there is a
consistent way that contributors can make changes to dependencies. The project has also worked on
additional tooling to signal statistics of dependencies that is being added or removed:
[`depstat`](https://github.com/kubernetes-sigs/depstat)
--&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：当涉及到项目中的依赖关系管理时，
有一个&lt;a href=&#34;https://github.com/kubernetes/org/blob/a106af09b8c345c301d072bfb7106b309c0ad8e9/config/kubernetes/org.yaml#L1329&#34;&gt;专门团队&lt;/a&gt;帮助审查和批准依赖关系更改。
这些人为目前 Kubernetes 用于管理依赖的许多&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/vendor.md&#34;&gt;工具&lt;/a&gt;做了开拓性的工作。
这些工具帮助我们确保贡献者可以以一致的方式更改依赖项。
这个子项目还开发了其他工具来基于被添加或删除的依赖项的统计信息发出通知：
&lt;a href=&#34;https://github.com/kubernetes-sigs/depstat&#34;&gt;&lt;code&gt;depstat&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;
&lt;!--
Apart from dependency management, another crucial task that the project does is management of the
staging repositories. The tooling for achieving this (`publishing-bot`) is completely transparent to
contributors and helps ensure that the staging repos get a consistent view of contributions that are
submitted to `kubernetes/kubernetes`.

Code Organization also works towards making sure that Kubernetes [stays on supported versions of
Go](https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions). The
linked KEP provides more context on why we need to do this. We collaborate with SIG Release to
ensure that we are testing Kubernetes as rigorously and as early as we can on Go releases and
working on changes that break our CI as a part of this. An example of how we track this process can
be found [here](https://github.com/kubernetes/release/issues/3076).
--&gt;
&lt;p&gt;除了依赖管理之外，这个项目执行的另一项重要任务是管理 staging 仓库。
用于实现此目的的工具（&lt;code&gt;publishing-bot&lt;/code&gt;）对贡献者完全透明，
有助于确保就提交给 &lt;code&gt;kubernetes/kubernetes&lt;/code&gt; 的贡献而言，各个 staging 仓库获得的视图是一致的。&lt;/p&gt;
&lt;p&gt;代码组织还致力于确保 Kubernetes
&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions&#34;&gt;一直在使用受支持的 Go 版本&lt;/a&gt;。
链接所指向的 KEP 中包含更详细的背景信息，用来说明为什么我们需要这样做。
我们与 SIG Release 合作，确保我们在 Go 版本上尽可能严格、尽早地测试 Kubernetes；
作为这些工作的一部分，我们要处理会破坏我们的 CI 的那些变更。
我们如何跟踪此过程的示例可以在&lt;a href=&#34;https://github.com/kubernetes/release/issues/3076&#34;&gt;此处&lt;/a&gt;找到。&lt;/p&gt;
&lt;!--
## Release cycle and current priorities

**FSM**: Is there anything that changes during the release cycle?

**MJ** During the release cycle, specifically before code freeze, there are often changes that go in
that add/update/delete dependencies, fix code that needs fixing as part of our effort to stay on
supported versions of Go.

Furthermore, some of these changes are also candidates for
[backporting](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md)
to our supported release branches.
--&gt;
&lt;h2 id=&#34;发布周期和当前优先级&#34;&gt;发布周期和当前优先级&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：在发布周期中有什么变化吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：在发布周期内，特别是在代码冻结之前，通常会发生添加、更新、删除依赖项的变更，以及修复需要修复的代码等更改，
这些都是我们继续使用受支持的 Go 版本的努力的一部分。&lt;/p&gt;
&lt;p&gt;此外，其中一些更改也可以&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md&#34;&gt;向后移植&lt;/a&gt;
到我们支持的发布分支。&lt;/p&gt;
&lt;!--
**FSM**: Is there any major project or theme the subproject is working on right now that you would
like to highlight?

**MJ**: I think one very interesting and immensely useful change that
has been recently added (and I take the opportunity to specifically
highlight the work of [Tim Hockin](https://github.com/thockin) on
this) is the introduction of [Go workspaces to the Kubernetes
repo](https://www.kubernetes.dev/blog/2024/03/19/go-workspaces-in-kubernetes/). A lot of our
current tooling for dependency management and code publishing, as well
as the experience of editing code in the Kubernetes repo, can be
significantly improved by this change.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：就子项目中目前正在进行的主要项目或主题而言你有什么要特别强调的吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：我认为最近添加的一个非常有趣且非常有用的变更（我借这个机会特别强调
&lt;a href=&#34;https://github.com/thockin&#34;&gt;Tim Hockin&lt;/a&gt; 在这方面的工作）是引入
&lt;a href=&#34;https://www.kubernetes.dev/blog/2024/03/19/go-workspaces-in-kubernetes/&#34;&gt;Go 工作空间的概念到Kubernetes 仓库中&lt;/a&gt;。
我们当前的许多依赖管理和代码发布工具，以及在 Kubernetes 仓库中编辑代码的体验，
都可以通过此更改得到显着改善。&lt;/p&gt;
&lt;!--
## Wrapping up

**FSM**: How would someone interested in the topic start helping the subproject?

**MJ**: The first step, as is the first step with any project in Kubernetes, is to join our slack:
[slack.k8s.io](https://slack.k8s.io), and after that join the `#k8s-code-organization` channel. There is also a
[code-organization office
hours](https://github.com/kubernetes/community/tree/master/sig-architecture#meetings) that takes
place that you can choose to attend. Timezones are hard, so feel free to also look at the recordings
or meeting notes and follow up on slack!
--&gt;
&lt;h2 id=&#34;收尾&#34;&gt;收尾&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：对这个主题感兴趣的人要怎样开始帮助这个子项目？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：与 Kubernetes 中任何项目的第一步一样，第一步是加入我们的
Slack：&lt;a href=&#34;https://slack.k8s.io&#34;&gt;slack.k8s.io&lt;/a&gt;，然后加入 &lt;code&gt;#k8s-code-organization&lt;/code&gt; 频道，
你还可以选择参加&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-architecture#meetings&#34;&gt;代码组织办公时间&lt;/a&gt;。
时区是个困难点，所以请随时查看录音或会议记录并跟进 Slack！&lt;/p&gt;
&lt;!--
**FSM**: Excellent, thank you! Any final comments you would like to share?

**MJ**: The Code Organization subproject always needs help! Especially areas like the publishing
bot, so don’t hesitate to get involved in the `#k8s-code-organization` Slack channel.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：非常好，谢谢！最后你还有什么想分享的吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MJ&lt;/strong&gt;：代码组织子项目总是需要帮助！特别是像发布机器人这样的领域，所以请不要犹豫，参与到 &lt;code&gt;#k8s-code-organization&lt;/code&gt; Slack 频道中。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.30 初探</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/03/12/kubernetes-1-30-upcoming-changes/</link>
      <pubDate>Tue, 12 Mar 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/03/12/kubernetes-1-30-upcoming-changes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;A Peek at Kubernetes v1.30&#39;
date: 2024-03-12
slug: kubernetes-1-30-upcoming-changes
--&gt;
&lt;!-- 
**Authors:** Amit Dsouza, Frederick Kautz, Kristin Martin, Abigail McCarthy, Natali Vlatko
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Amit Dsouza, Frederick Kautz, Kristin Martin, Abigail McCarthy, Natali Vlatko&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; Paco Xu (DaoCloud)&lt;/p&gt;
&lt;!--
## A quick look: exciting changes in Kubernetes v1.30

It&#39;s a new year and a new Kubernetes release. We&#39;re halfway through the release cycle and
have quite a few interesting and exciting enhancements coming in v1.30. From brand new features
in alpha, to established features graduating to stable, to long-awaited improvements, this release
has something for everyone to pay attention to!

To tide you over until the official release, here&#39;s a sneak peek of the enhancements we&#39;re most
excited about in this cycle!
--&gt;
&lt;h2 id=&#34;快速预览-kubernetes-v1-30-中令人兴奋的变化&#34;&gt;快速预览：Kubernetes v1.30 中令人兴奋的变化&lt;/h2&gt;
&lt;p&gt;新年新版本，v1.30 发布周期已过半，我们将迎来一系列有趣且令人兴奋的增强功能。
从全新的 alpha 特性，到已有的特性升级为稳定版，再到期待已久的改进，这个版本对每个人都有值得关注的内容！&lt;/p&gt;
&lt;p&gt;为了让你在正式发布之前对其有所了解，下面给出我们在这个周期中最为期待的增强功能的预览！&lt;/p&gt;
&lt;!--
## Major changes for Kubernetes v1.30
--&gt;
&lt;h2 id=&#34;kubernetes-v1-30-的主要变化&#34;&gt;Kubernetes v1.30 的主要变化&lt;/h2&gt;
&lt;!--
### Structured parameters for dynamic resource allocation ([KEP-4381](https://kep.k8s.io/4381))
--&gt;
&lt;h3 id=&#34;动态资源分配-dra-的结构化参数-kep-4381-https-kep-k8s-io-4381&#34;&gt;动态资源分配（DRA）的结构化参数 (&lt;a href=&#34;https://kep.k8s.io/4381&#34;&gt;KEP-4381&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
[Dynamic resource allocation](/docs/concepts/scheduling-eviction/dynamic-resource-allocation/) was
added to Kubernetes as an alpha feature in v1.26. It defines an alternative to the traditional
device-plugin API for requesting access to third-party resources. By design, dynamic resource
allocation uses parameters for resources that are completely opaque to core Kubernetes. This
approach poses a problem for the Cluster Autoscaler (CA) or any higher-level controller that
needs to make decisions for a group of pods (e.g. a job scheduler). It cannot simulate the effect of
allocating or deallocating claims over time. Only the third-party DRA drivers have the information
available to do this.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/dynamic-resource-allocation/&#34;&gt;动态资源分配（DRA）&lt;/a&gt; 在 Kubernetes v1.26 中作为 alpha 特性添加。
它定义了一种替代传统设备插件 device plugin API 的方式，用于请求访问第三方资源。
在设计上，动态资源分配（DRA）使用的资源参数对于核心 Kubernetes 完全不透明。
这种方法对于集群自动缩放器（CA）或任何需要为一组 Pod 做决策的高级控制器（例如作业调度器）都会带来问题。
这一设计无法模拟在不同时间分配或释放请求的效果。
只有第三方 DRA 驱动程序才拥有信息来做到这一点。&lt;/p&gt;
&lt;!--
​​Structured Parameters for dynamic resource allocation is an extension to the original
implementation that addresses this problem by building a framework to support making these claim
parameters less opaque. Instead of handling the semantics of all claim parameters themselves,
drivers could manage resources and describe them using a specific &#34;structured model&#34; pre-defined by
Kubernetes. This would allow components aware of this &#34;structured model&#34; to make decisions about
these resources without outsourcing them to some third-party controller. For example, the scheduler
could allocate claims rapidly without back-and-forth communication with dynamic resource
allocation drivers. Work done for this release centers on defining the framework necessary to enable
different &#34;structured models&#34; and to implement the &#34;named resources&#34; model. This model allows
listing individual resource instances and, compared to the traditional device plugin API, adds the
ability to select those instances individually via attributes.
--&gt;
&lt;p&gt;动态资源分配（DRA）的结构化参数是对原始实现的扩展，它通过构建一个框架来支持增加请求参数的透明度来解决这个问题。
驱动程序不再需要自己处理所有请求参数的语义，而是可以使用 Kubernetes 预定义的特定“结构化模型”来管理和描述资源。
这一设计允许了解这个“结构化规范”的组件做出关于这些资源的决策，而不再将它们外包给某些第三方控制器。
例如，调度器可以在不与动态资源分配（DRA）驱动程序反复通信的前提下快速完成分配请求。
这个版本的工作重点是定义一个框架来支持不同的“结构化模型”，并实现“命名资源”模型。
此模型允许列出各个资源实例，同时，与传统的设备插件 API 相比，模型增加了通过属性逐一选择实例的能力。&lt;/p&gt;
&lt;!--
### Node memory swap support ([KEP-2400](https://kep.k8s.io/2400))
--&gt;
&lt;h3 id=&#34;节点交换内存-swap-支持-kep-2400-https-kep-k8s-io-2400&#34;&gt;节点交换内存 SWAP 支持 (&lt;a href=&#34;https://kep.k8s.io/2400&#34;&gt;KEP-2400&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
In Kubernetes v1.30, memory swap support on Linux nodes gets a big change to how it works - with a
strong emphasis on improving system stability. In previous Kubernetes versions, the `NodeSwap`
feature gate was disabled by default, and when enabled, it used `UnlimitedSwap` behavior as the
default behavior. To achieve better stability, `UnlimitedSwap` behavior (which might compromise node
stability) will be removed in v1.30.
--&gt;
&lt;p&gt;在 Kubernetes v1.30 中，Linux 节点上的交换内存支持机制有了重大改进，其重点是提高系统的稳定性。
以前的 Kubernetes 版本默认情况下禁用了 &lt;code&gt;NodeSwap&lt;/code&gt; 特性门控。当门控被启用时，&lt;code&gt;UnlimitedSwap&lt;/code&gt; 行为被作为默认行为。
为了提高稳定性，&lt;code&gt;UnlimitedSwap&lt;/code&gt; 行为（可能会影响节点的稳定性）将在 v1.30 中被移除。&lt;/p&gt;
&lt;!--
The updated, still-beta support for swap on Linux nodes will be available by default. However, the
default behavior will be to run the node set to `NoSwap` (not `UnlimitedSwap`) mode. In `NoSwap`
mode, the kubelet supports running on a node where swap space is active, but Pods don&#39;t use any of
the page file. You&#39;ll still need to set `--fail-swap-on=false` for the kubelet to run on that node.
However, the big change is the other mode: `LimitedSwap`. In this mode, the kubelet actually uses
the page file on that node and allows Pods to have some of their virtual memory paged out.
Containers (and their parent pods)  do not have access to swap beyond their memory limit, but the
system can still use the swap space if available.
--&gt;
&lt;p&gt;更新后的 Linux 节点上的交换内存支持仍然是 beta 级别，并且默认情况下开启。
然而，节点默认行为是使用 &lt;code&gt;NoSwap&lt;/code&gt;（而不是 &lt;code&gt;UnlimitedSwap&lt;/code&gt;）模式。
在 &lt;code&gt;NoSwap&lt;/code&gt; 模式下，kubelet 支持在启用了磁盘交换空间的节点上运行，但 Pod 不会使用页面文件（pagefile）。
你仍然需要为 kubelet 设置 &lt;code&gt;--fail-swap-on=false&lt;/code&gt; 才能让 kubelet 在该节点上运行。
特性的另一个重大变化是针对另一种模式：&lt;code&gt;LimitedSwap&lt;/code&gt;。
在 &lt;code&gt;LimitedSwap&lt;/code&gt; 模式下，kubelet 会实际使用节点上的页面文件，并允许 Pod 的一些虚拟内存被换页出去。
容器（及其父 Pod）访问交换内存空间不可超出其内存限制，但系统的确可以使用可用的交换空间。&lt;/p&gt;
&lt;!--
Kubernetes&#39; Node special interest group (SIG Node) will also update the documentation to help you
understand how to use the revised implementation, based on feedback from end users, contributors,
and the wider Kubernetes community.
--&gt;
&lt;p&gt;Kubernetes 的 SIG Node 小组还将根据最终用户、贡献者和更广泛的 Kubernetes 社区的反馈更新文档，
以帮助你了解如何使用经过修订的实现。&lt;/p&gt;
&lt;!--
Read the previous [blog post](/blog/2023/08/24/swap-linux-beta/) or the [node swap
documentation](/docs/concepts/architecture/nodes/#swap-memory) for more details on 
Linux node swap support in Kubernetes.
--&gt;
&lt;p&gt;阅读之前的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/24/swap-linux-beta/&#34;&gt;博客文章&lt;/a&gt;或&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/nodes/#swap-memory&#34;&gt;交换内存管理文档&lt;/a&gt;以获取有关
Kubernetes 中 Linux 节点交换支持的更多详细信息。&lt;/p&gt;
&lt;!--
### Support user namespaces in pods ([KEP-127](https://kep.k8s.io/127))
--&gt;
&lt;h3 id=&#34;支持-pod-运行在用户命名空间-kep-127-https-kep-k8s-io-127&#34;&gt;支持 Pod 运行在用户命名空间 (&lt;a href=&#34;https://kep.k8s.io/127&#34;&gt;KEP-127&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
[User namespaces](/docs/concepts/workloads/pods/user-namespaces) is a Linux-only feature that better
isolates pods to prevent or mitigate several CVEs rated high/critical, including
[CVE-2024-21626](https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv),
published in January 2024. In Kubernetes 1.30, support for user namespaces is migrating to beta and
now supports pods with and without volumes, custom UID/GID ranges, and more!
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/user-namespaces&#34;&gt;用户命名空间&lt;/a&gt; 是一个仅在 Linux 上可用的特性，它更好地隔离 Pod，
以防止或减轻几个高/严重级别的 CVE，包括 2024 年 1 月发布的 &lt;a href=&#34;https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv&#34;&gt;CVE-2024-21626&lt;/a&gt;。
在 Kubernetes 1.30 中，对用户命名空间的支持正在迁移到 beta，并且现在支持带有和不带有卷的 Pod，自定义 UID/GID 范围等等！&lt;/p&gt;
&lt;!--
### Structured authorization configuration ([KEP-3221](https://kep.k8s.io/3221))
--&gt;
&lt;h3 id=&#34;结构化鉴权配置-kep-3221-https-kep-k8s-io-3221&#34;&gt;结构化鉴权配置(&lt;a href=&#34;https://kep.k8s.io/3221&#34;&gt;KEP-3221&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
Support for [structured authorization
configuration](/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file)
is moving to beta and will be enabled by default. This feature enables the creation of
authorization chains with multiple webhooks with well-defined parameters that validate requests in a
particular order and allows fine-grained control – such as explicit Deny on failures. The
configuration file approach even allows you to specify [CEL](/docs/reference/using-api/cel/) rules
to pre-filter requests before they are dispatched to webhooks, helping you to prevent unnecessary
invocations. The API server also automatically reloads the authorizer chain when the configuration
file is modified.
--&gt;
&lt;p&gt;对&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file&#34;&gt;结构化鉴权配置&lt;/a&gt;的支持正在晋级到 Beta 版本，并将默认启用。
这个特性支持创建具有明确参数定义的多个 Webhook 所构成的鉴权链；这些 Webhook 按特定顺序验证请求，
并允许进行细粒度的控制，例如在失败时明确拒绝。
配置文件方法甚至允许你指定 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/cel/&#34;&gt;CEL&lt;/a&gt; 规则，以在将请求分派到 Webhook 之前对其进行预过滤，帮助你防止不必要的调用。
当配置文件被修改时，API 服务器还会自动重新加载鉴权链。&lt;/p&gt;
&lt;!--
You must specify the path to that authorization configuration using the `--authorization-config`
command line argument. If you want to keep using command line flags instead of a
configuration file, those will continue to work as-is. To gain access to new authorization webhook
capabilities like multiple webhooks, failure policy, and pre-filter rules, switch to putting options
in an `--authorization-config` file. From Kubernetes 1.30, the configuration file format is
beta-level, and only requires specifying `--authorization-config` since the feature gate is enabled by
default. An example configuration with all possible values is provided in the [Authorization
docs](/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file).
For more details, read the [Authorization
docs](/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file).
--&gt;
&lt;p&gt;你必须使用 &lt;code&gt;--authorization-config&lt;/code&gt; 命令行参数指定鉴权配置的路径。
如果你想继续使用命令行标志而不是配置文件，命令行方式没有变化。
要访问新的 Webhook 功能，例如多 Webhook 支持、失败策略和预过滤规则，需要切换到将选项放在 &lt;code&gt;--authorization-config&lt;/code&gt; 文件中。
从 Kubernetes 1.30 开始，配置文件格式约定是 beta 级别的，只需要指定 &lt;code&gt;--authorization-config&lt;/code&gt;，因为特性门控默认启用。
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file&#34;&gt;鉴权文档&lt;/a&gt;
中提供了一个包含所有可能值的示例配置。
有关更多详细信息，请阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/authorization/#configuring-the-api-server-using-an-authorization-config-file&#34;&gt;鉴权文档&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Container resource based pod autoscaling ([KEP-1610](https://kep.k8s.io/1610))
--&gt;
&lt;h3 id=&#34;基于容器资源指标的-pod-自动扩缩容-kep-1610-https-kep-k8s-io-1610&#34;&gt;基于容器资源指标的 Pod 自动扩缩容 (&lt;a href=&#34;https://kep.k8s.io/1610&#34;&gt;KEP-1610&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
Horizontal pod autoscaling based on `ContainerResource` metrics will graduate to stable in v1.30.
This new behavior for HorizontalPodAutoscaler allows you to configure automatic scaling based on the
resource usage for individual containers, rather than the aggregate resource use over a Pod. See our
[previous article](/blog/2023/05/02/hpa-container-resource-metric/) for further details, or read
[container resource metrics](/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics).
--&gt;
&lt;p&gt;基于 &lt;code&gt;ContainerResource&lt;/code&gt; 指标的 Pod 水平自动扩缩容将在 v1.30 中升级为稳定版。
HorizontalPodAutoscaler 的这一新行为允许你根据各个容器的资源使用情况而不是 Pod 的聚合资源使用情况来配置自动伸缩。
有关更多详细信息，请参阅我们的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/02/hpa-container-resource-metric/&#34;&gt;先前文章&lt;/a&gt;，
或阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics&#34;&gt;容器资源指标&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### CEL for admission control ([KEP-3488](https://kep.k8s.io/3488))
--&gt;
&lt;h3 id=&#34;在准入控制中使用-cel-kep-3488-https-kep-k8s-io-3488&#34;&gt;在准入控制中使用 CEL (&lt;a href=&#34;https://kep.k8s.io/3488&#34;&gt;KEP-3488&lt;/a&gt;)&lt;/h3&gt;
&lt;!--
Integrating Common Expression Language (CEL) for admission control in Kubernetes introduces a more
dynamic and expressive way of evaluating admission requests. This feature allows complex,
fine-grained policies to be defined and enforced directly through the Kubernetes API, enhancing
security and governance capabilities without compromising performance or flexibility.
--&gt;
&lt;p&gt;Kubernetes 为准入控制集成了 Common Expression Language (CEL) 。
这一集成引入了一种更动态、表达能力更强的方式来判定准入请求。
这个特性允许通过 Kubernetes API 直接定义和执行复杂的、细粒度的策略，同时增强了安全性和治理能力，而不会影响性能或灵活性。&lt;/p&gt;
&lt;!--
CEL&#39;s addition to Kubernetes admission control empowers cluster administrators to craft intricate
rules that can evaluate the content of API requests against the desired state and policies of the
cluster without resorting to Webhook-based access controllers. This level of control is crucial for
maintaining the integrity, security, and efficiency of cluster operations, making Kubernetes
environments more robust and adaptable to various use cases and requirements. For more information
on using CEL for admission control, see the [API
documentation](/docs/reference/access-authn-authz/validating-admission-policy/) for
ValidatingAdmissionPolicy.
--&gt;
&lt;p&gt;将 CEL 引入到 Kubernetes 的准入控制后，集群管理员就具有了制定复杂规则的能力，
这些规则可以根据集群的期望状态和策略来评估 API 请求的内容，而无需使用基于 Webhook 的访问控制器。
这种控制水平对于维护集群操作的完整性、安全性和效率至关重要，使 Kubernetes 环境更加健壮，更适应各种用例和需求。
有关使用 CEL 进行准入控制的更多信息，请参阅 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/validating-admission-policy/&#34;&gt;API 文档&lt;/a&gt;中的 ValidatingAdmissionPolicy。&lt;/p&gt;
&lt;!--
We hope you&#39;re as excited for this release as we are. Keep an eye out for the official release 
blog in a few weeks for more highlights!
--&gt;
&lt;p&gt;我们希望你和我们一样对这个版本的发布感到兴奋。请在未来几周内密切关注官方发布博客，以了解其他亮点！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>走进 Kubernetes 读书会（Book Club）</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/02/22/k8s-book-club/</link>
      <pubDate>Thu, 22 Feb 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/02/22/k8s-book-club/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;A look into the Kubernetes Book Club&#34;
slug: k8s-book-club
date: 2024-02-22
canonicalUrl: https://www.k8s.dev/blog/2024/02/22/k8s-book-club/
author: &gt;
  Frederico Muñoz (SAS Institute)
--&gt;
&lt;!--
Learning Kubernetes and the entire ecosystem of technologies around it is not without its
challenges. In this interview, we will talk with [Carlos Santana
(AWS)](https://www.linkedin.com/in/csantanapr/) to learn a bit more about how he created the
[Kubernetes Book Club](https://community.cncf.io/kubernetes-virtual-book-club/), how it works, and
how anyone can join in to take advantage of a community-based learning experience.
--&gt;
&lt;p&gt;学习 Kubernetes 及其整个生态的技术并非易事。在本次采访中，我们的访谈对象是
&lt;a href=&#34;https://www.linkedin.com/in/csantanapr/&#34;&gt;Carlos Santana (AWS)&lt;/a&gt;，
了解他是如何创办 &lt;a href=&#34;https://community.cncf.io/kubernetes-virtual-book-club/&#34;&gt;Kubernetes 读书会（Book Club）&lt;/a&gt;的，
整个读书会是如何运作的，以及大家如何加入其中，进而更好地利用社区学习体验。&lt;/p&gt;
&lt;!--
![Carlos Santana speaking at KubeCon NA 2023](csantana_k8s_book_club.jpg)

**Frederico Muñoz (FSM)**: Hello Carlos, thank you so much for your availability. To start with,
could you tell us a bit about yourself?
--&gt;
&lt;p&gt;&lt;img alt=&#34;Carlos Santana 在 KubeCon NA 2023 上演讲&#34; src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/02/22/k8s-book-club/csantana_k8s_book_club.jpg&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Frederico Muñoz (FSM)&lt;/strong&gt;：你好 Carlos，非常感谢你能接受我们的采访。首先，你能介绍一下自己吗？&lt;/p&gt;
&lt;!--
**Carlos Santana (CS)**: Of course. My experience in deploying Kubernetes in production six
years ago opened the door for me to join [Knative](https://knative.dev/) and then contribute to
Kubernetes through the Release Team. Working on upstream Kubernetes has been one of the best
experiences I&#39;ve had in open-source. Over the past two years, in my role as a Senior Specialist
Solutions Architect at AWS, I have been assisting large enterprises build their internal developer
platforms (IDP) on top of Kubernetes. Going forward, my open source contributions are directed
towards [CNOE](https://cnoe.io/) and CNCF projects like [Argo](https://github.com/argoproj),
[Crossplane](https://www.crossplane.io/), and [Backstage](https://www.cncf.io/projects/backstage/).
--&gt;
&lt;p&gt;&lt;strong&gt;Carlos Santana (CS)&lt;/strong&gt;：当然可以。六年前，我在生产环境中部署 Kubernetes 的经验为我加入
&lt;a href=&#34;https://knative.dev/&#34;&gt;Knative&lt;/a&gt; 并通过 Release Team 为 Kubernetes 贡献代码打开了大门。
为上游 Kubernetes 工作是我在开源领域最好的经历之一。在过去的两年里，作为 AWS 的高级专业解决方案架构师，
我一直在帮助大型企业在 Kubernetes 之上构建他们的内部开发平台（IDP）。
未来我的开源贡献将主要集中在 &lt;a href=&#34;https://cnoe.io/&#34;&gt;CNOE&lt;/a&gt; 和 CNCF 项目，如
&lt;a href=&#34;https://github.com/argoproj&#34;&gt;Argo&lt;/a&gt;、&lt;a href=&#34;https://www.crossplane.io/&#34;&gt;Crossplane&lt;/a&gt; 和
&lt;a href=&#34;https://www.cncf.io/projects/backstage/&#34;&gt;Backstage&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Creating the Book Club

**FSM**: So your path led you to Kubernetes, and at that point what was the motivating factor for
starting the Book Club?
--&gt;
&lt;h2 id=&#34;创办读书会&#34;&gt;创办读书会&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：所以你的职业道路把你引向了 Kubernetes，那么是什么动机促使你开始创办读书会呢？&lt;/p&gt;
&lt;!--
**CS**: The idea for the Kubernetes Book Club sprang from a casual suggestion during a
[TGIK](https://github.com/vmware-archive/tgik) livestream. For me, it was more than just about
reading a book; it was about creating a learning community. This platform has not only been a source
of knowledge but also a support system, especially during the challenging times of the
pandemic. It&#39;s gratifying to see how this initiative has helped members cope and grow. The first
book [Production
Kubernetes](https://www.oreilly.com/library/view/production-kubernetes/9781492092292/) took 36
weeks, when we started on March 5th 2021. Currently don&#39;t take that long to cover a book, one or two
chapters per week.
--&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：Kubernetes 读书会的想法源于一次 &lt;a href=&#34;https://github.com/vmware-archive/tgik&#34;&gt;TGIK&lt;/a&gt; 直播中的一个临时建议。
对我来说，这不仅仅是读一本书，更是创办一个学习社区。这个社区平台不仅是知识的来源，也是一个支持系统，
特别是在疫情期间陪我度过了艰难时刻。读书会的这项倡议后来帮助许多成员学会了应对和成长，这让我感到很欣慰。
我们在 2021 年 3 月 5 日开始第一本书
&lt;a href=&#34;https://www.oreilly.com/library/view/production-kubernetes/9781492092292/&#34;&gt;Production Kubernetes&lt;/a&gt;，
花了 36 周时间。目前，一本书不会再花那么长时间了，如今每周会完成一到两章。&lt;/p&gt;
&lt;!--
**FSM**: Could you describe the way the Kubernetes Book Club works? How do you select the books and how
do you go through them?

**CS**: We collectively choose books based on the interests and needs of the group. This practical
approach helps members, especially beginners, grasp complex concepts more easily. We have two weekly
series, one for the EMEA timezone, and I organize the US one. Each organizer works with their co-host
and picks a book on Slack, then sets up a lineup of hosts for a couple of weeks to discuss each
chapter.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：你能介绍一下 Kubernetes 读书会是如何运作的吗？你们如何选书以及如何阅读它们？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：我们根据小组的兴趣和需求以集体的方式选书。这种实用的方法有助于成员们（特别是初学者）更容易地掌握复杂的概念。
我们每周有两次读书会应对不同的时区，一个针对 EMEA（欧洲、中东及非洲）时区，另一个是由我自己负责的美国时区。
每位组织者与他们的联合主持人在 Slack 上甄选一本书，然后安排几个主持人用几周时间讨论每一章。&lt;/p&gt;
&lt;!--
**FSM**: If I’m not mistaken, the Kubernetes Book Club is in its 17th book, which is significant: is
there any secret recipe for keeping things active?

**CS**: The secret to keeping the club active and engaging lies in a couple of key factors.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：如果我没记错的话，Kubernetes 读书会如今已经进行到了第 17 本书。这很了不起：有什么秘诀可以让读书这件事保持活跃吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：保持俱乐部活跃和吸引人参与的秘诀在于几个关键因素。&lt;/p&gt;
&lt;!--
Firstly, consistency has been crucial. We strive to maintain a regular schedule, only cancelling
meetups for major events like holidays or KubeCon. This regularity helps members stay engaged and
builds a reliable community.

Secondly, making the sessions interesting and interactive has been vital. For instance, I often
introduce pop-up quizzes during the meetups, which not only tests members&#39; understanding but also
adds an element of fun. This approach keeps the content relatable and helps members understand how
theoretical concepts are applied in real-world scenarios.
--&gt;
&lt;p&gt;首先，一贯性至关重要。我们努力保持定期聚会，只有在重大事件如节假日或 KubeCon 时才会取消聚会。
这种规律性有助于成员保持惯性参与，有助于建立一个可靠的社区。&lt;/p&gt;
&lt;p&gt;其次，让聚会有趣生动也非常重要。例如，我经常在聚会期间引入提问测验，不仅检测成员们的理解程度，还增加了一些乐趣。
这种方法使读书内容更加贴近实际，并帮助成员们理解理论概念在现实世界中的运用方式。&lt;/p&gt;
&lt;!--
## Topics covered in the Book Club

**FSM**: The main topics of the books have been Kubernetes, GitOps, Security, SRE, and
Observability: is this a reflection of the cloud native landscape, especially in terms of
popularity?
--&gt;
&lt;h2 id=&#34;读书会涵盖的话题&#34;&gt;读书会涵盖的话题&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：书籍的主要话题包括 Kubernetes、GitOps、安全、SRE 和可观测性：
这是否也反映了云原生领域的现状，特别是在受欢迎程度方面？&lt;/p&gt;
&lt;!--
**CS**: Our journey began with &#39;Production Kubernetes&#39;, setting the tone for our focus on practical,
production-ready solutions. Since then, we&#39;ve delved into various aspects of the CNCF landscape,
aligning our books with a different theme.  Each theme, whether it be Security, Observability, or
Service Mesh, is chosen based on its relevance and demand within the community. For instance, in our
recent themes on Kubernetes Certifications, we brought the book authors into our fold as active
hosts, enriching our discussions with their expertise.
--&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：我们的旅程始于《Production Kubernetes》，为我们专注于实用、生产就绪的解决方案定下了基调。
从那时起，我们深入探讨了 CNCF 领域的各个方面，根据不同的主题去选书。
每个主题，无论是安全性、可观测性还是服务网格，都是根据其相关性和社区需求来选择的。
例如，在我们最近关于 Kubernetes 考试认证的主题中，我们邀请了书籍的作者作为活跃现场的主持人，用他们的专业知识丰富了我们的讨论。&lt;/p&gt;
&lt;!--
**FSM**: I know that the project had recent changes, namely being integrated into the CNCF as a
[Cloud Native Community Group](https://community.cncf.io/). Could you talk a bit about this change?

**CS**: The CNCF graciously accepted the book club as a Cloud Native Community Group. This is a
significant development that has streamlined our operations and expanded our reach. This alignment
has been instrumental in enhancing our administrative capabilities, similar to those used by
Kubernetes Community Days (KCD) meetups. Now, we have a more robust structure for memberships, event
scheduling, mailing lists, hosting web conferences, and recording sessions.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：我了解到此项目最近有一些变化，即被整合到了 CNCF
作为&lt;a href=&#34;https://community.cncf.io/&#34;&gt;云原生社区组（Cloud Native Community Group）&lt;/a&gt;的一部分。你能谈谈这个变化吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：CNCF 慷慨地接受了读书会作为云原生社区组的一部分。
这是读书会发展过程中的重要一步，优化了读书会的运作并扩大了读书会的影响力。
这种拉齐对于增强读书会的管理能力至关重要，这点很像 Kubernetes Community Days (KCD) 聚会。
现在，读书会有了更稳健的会员结构、活动安排、邮件列表、托管的网络会议和录播系统。&lt;/p&gt;
&lt;!--
**FSM**: How has your involvement with the CNCF impacted the growth and engagement of the Kubernetes
Book Club over the past six months?

**CS**: Since becoming part of the CNCF community six months ago, we&#39;ve witnessed significant
quantitative changes within the Kubernetes Book Club. Our membership has surged to over 600 members,
and we&#39;ve successfully organized and conducted more than 40 events during this period. What&#39;s even
more promising is the consistent turnout, with an average of 30 attendees per event. This growth and
engagement are clear indicators of the positive influence of our CNCF affiliation on the Kubernetes
Book Club&#39;s reach and impact in the community.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：在过去的六个月里，你参与 CNCF 这件事对 Kubernetes 读书会的成长和参与度产生了什么影响？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：自从六个月前成为 CNCF 社区的一部分以来，我们在 Kubernetes 读书会中看到了一些显著的变化。
我们的会员人数激增至 600 多人，并在此期间成功组织并举办了超过 40 场活动。
更令人鼓舞的是，每场活动的出席人数都很稳定，平均约有 30 人参加。
这种增长和参与度清楚地表明了我们与 CNCF 的合作让 Kubernetes 读书会在社区中增强了影响力。&lt;/p&gt;
&lt;!--
## Joining the Book Club

**FSM**: For anyone wanting to join, what should they do?

**CS**: There are three steps to join:
--&gt;
&lt;h2 id=&#34;加入读书会&#34;&gt;加入读书会&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：若有人想加入读书会，他们应该怎么做？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：加入读书会只需三步：&lt;/p&gt;
&lt;!--
- First, join the [Kubernetes Book Club Community](https://community.cncf.io/kubernetes-virtual-book-club/)
- Then RSVP to the
  [events](https://community.cncf.io/kubernetes-virtual-book-club/)
  on the community page
- Lastly, join the CNCF Slack channel
  [#kubernetes-book-club](https://cloud-native.slack.com/archives/C05EYA14P37).
--&gt;
&lt;ul&gt;
&lt;li&gt;首先加入 &lt;a href=&#34;https://community.cncf.io/kubernetes-virtual-book-club/&#34;&gt;Kubernetes 读书会社区&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;然后注册参与在社区页面上列出的&lt;a href=&#34;https://community.cncf.io/kubernetes-virtual-book-club/&#34;&gt;活动&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;最后加入 CNCF Slack 频道 &lt;a href=&#34;https://cloud-native.slack.com/archives/C05EYA14P37&#34;&gt;#kubernetes-book-club&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**FSM**: Excellent, thank you! Any final comments you would like to share?

**CS**: The Kubernetes Book Club is more than just a group of professionals discussing books; it&#39;s a
vibrant community and amazing volunteers that help organize and host
[Neependra Khare](https://www.linkedin.com/in/neependra/),
[Eric Smalling](https://www.linkedin.com/in/ericsmalling/),
[Sevi Karakulak](https://www.linkedin.com/in/sevikarakulak/),
[Chad M. Crowell](https://www.linkedin.com/in/chadmcrowell/),
and [Walid (CNJ) Shaari](https://www.linkedin.com/in/walidshaari/).
Look us up at KubeCon and get your Kubernetes Book Club sticker!
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：太好了，谢谢你！最后你还有什么想法要跟大家分享吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CS&lt;/strong&gt;：Kubernetes 读书会不仅仅是一个讨论书籍的专业小组，它是一个充满活力的社区，
有许多令人敬佩的志愿者帮助组织和主持聚会。我想借这次机会感谢几位志愿者：
&lt;a href=&#34;https://www.linkedin.com/in/neependra/&#34;&gt;Neependra Khare&lt;/a&gt;、
&lt;a href=&#34;https://www.linkedin.com/in/ericsmalling/&#34;&gt;Eric Smalling&lt;/a&gt;、
&lt;a href=&#34;https://www.linkedin.com/in/sevikarakulak/&#34;&gt;Sevi Karakulak&lt;/a&gt;、
&lt;a href=&#34;https://www.linkedin.com/in/chadmcrowell/&#34;&gt;Chad M. Crowell&lt;/a&gt;
和 &lt;a href=&#34;https://www.linkedin.com/in/walidshaari/&#34;&gt;Walid (CNJ) Shaari&lt;/a&gt;。
欢迎来 KubeCon 与我们相聚，还能领取你的 Kubernetes 读书会贴纸！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>镜像文件系统：配置 Kubernetes 将容器存储在独立的文件系统上</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/01/23/kubernetes-separate-image-filesystem/</link>
      <pubDate>Tue, 23 Jan 2024 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2024/01/23/kubernetes-separate-image-filesystem/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Image Filesystem: Configuring Kubernetes to store containers on a separate filesystem&#39;
date: 2024-01-23
slug: kubernetes-separate-image-filesystem
--&gt;
&lt;!--
**Author:** Kevin Hannon (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Kevin Hannon (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; &lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt;&lt;/p&gt;
&lt;!--
A common issue in running/operating Kubernetes clusters is running out of disk space.
When the node is provisioned, you should aim to have a good amount of storage space for your container images and running containers.
The [container runtime](/docs/setup/production-environment/container-runtimes/) usually writes to `/var`. 
This can be located as a separate partition or on the root filesystem.
CRI-O, by default, writes its containers and images to `/var/lib/containers`, while containerd writes its containers and images to `/var/lib/containerd`.
--&gt;
&lt;p&gt;磁盘空间不足是运行或操作 Kubernetes 集群时的一个常见问题。
在制备节点时，你应该为容器镜像和正在运行的容器留足够的存储空间。
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/production-environment/container-runtimes/&#34;&gt;容器运行时&lt;/a&gt;通常会向 &lt;code&gt;/var&lt;/code&gt; 目录写入数据。
此目录可以位于单独的分区或根文件系统上。CRI-O 默认将其容器和镜像写入 &lt;code&gt;/var/lib/containers&lt;/code&gt;，
而 containerd 将其容器和镜像写入 &lt;code&gt;/var/lib/containerd&lt;/code&gt;。&lt;/p&gt;
&lt;!--
In this blog post, we want to bring attention to ways that you can configure your container runtime to store its content separately from the default partition.  
This allows for more flexibility in configuring Kubernetes and provides support for adding a larger disk for the container storage while keeping the default filesystem untouched.  

One area that needs more explaining is where/what Kubernetes is writing to disk.
--&gt;
&lt;p&gt;在这篇博文中，我们想要关注的是几种不同方式，用来配置容器运行时将其内容存储到别的位置而非默认分区。
这些配置允许我们更灵活地配置 Kubernetes，支持在保持默认文件系统不受影响的情况下为容器存储添加更大的磁盘。&lt;/p&gt;
&lt;p&gt;需要额外讲述的是 Kubernetes 向磁盘在写入数据的具体位置及内容。&lt;/p&gt;
&lt;!--
## Understanding Kubernetes disk usage

Kubernetes has persistent data and ephemeral data.  The base path for the kubelet and local
Kubernetes-specific storage is configurable, but it is usually assumed to be `/var/lib/kubelet`.
In the Kubernetes docs, this is sometimes referred to as the root or node filesystem. The bulk of this data can be categorized into:
--&gt;
&lt;h2 id=&#34;understanding-kubernetes-disk-usage&#34;&gt;了解 Kubernetes 磁盘使用情况  &lt;/h2&gt;
&lt;p&gt;Kubernetes 有持久数据和临时数据。kubelet 和特定于 Kubernetes 的本地存储的基础路径是可配置的，
但通常假定为 &lt;code&gt;/var/lib/kubelet&lt;/code&gt;。在 Kubernetes 文档中，
这一位置有时被称为根文件系统或节点文件系统。写入的数据可以大致分类为：&lt;/p&gt;
&lt;!--
- ephemeral storage
- logs
- and container runtime

This is different from most POSIX systems as the root/node filesystem is not `/` but the disk that `/var/lib/kubelet` is on.
--&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;p&gt;与大多数 POSIX 系统不同，这里的根/节点文件系统不是 &lt;code&gt;/&lt;/code&gt;，而是 &lt;code&gt;/var/lib/kubelet&lt;/code&gt; 所在的磁盘。&lt;/p&gt;
&lt;!--
### Ephemeral storage

Pods and containers can require temporary or transient local storage for their operation.
The lifetime of the ephemeral storage does not extend beyond the life of the individual pod, and the ephemeral storage cannot be shared across pods.
--&gt;
&lt;h3 id=&#34;ephemeral-storage&#34;&gt;临时存储  &lt;/h3&gt;
&lt;p&gt;Pod 和容器的某些操作可能需要临时或瞬态的本地存储。
临时存储的生命周期短于 Pod 的生命周期，且临时存储不能被多个 Pod 共享。&lt;/p&gt;
&lt;!--
### Logs

By default, Kubernetes stores the logs of each running container, as files within `/var/log`.
These logs are ephemeral and are monitored by the kubelet to make sure that they do not grow too large while the pods are running.

You can customize the [log rotation](/docs/concepts/cluster-administration/logging/#log-rotation) settings
for each node to manage the size of these logs, and configure log shipping (using a 3rd party solution)
to avoid relying on the node-local storage.
--&gt;
&lt;h3 id=&#34;logs&#34;&gt;日志  &lt;/h3&gt;
&lt;p&gt;默认情况下，Kubernetes 将每个运行容器的日志存储为 &lt;code&gt;/var/log&lt;/code&gt; 中的文件。
这些日志是临时性质的，并由 kubelet 负责监控以确保不会在 Pod 运行时变得过大。&lt;/p&gt;
&lt;p&gt;你可以为每个节点自定义&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/logging/#log-rotation&#34;&gt;日志轮换&lt;/a&gt;设置，
以管控这些日志的大小，并（使用第三方解决方案）配置日志转储以避免对节点本地存储形成依赖。&lt;/p&gt;
&lt;!--
### Container runtime

The container runtime has two different areas of storage for containers and images.
- read-only layer: Images are usually denoted as the read-only layer, as they are not modified when containers are running.
The read-only layer can consist of multiple layers that are combined into a single read-only layer.
There is a thin layer on top of containers that provides ephemeral storage for containers if the container is writing to the filesystem.
--&gt;
&lt;h3 id=&#34;container-runtime&#34;&gt;容器运行时  &lt;/h3&gt;
&lt;p&gt;容器运行时针对容器和镜像使用两个不同的存储区域。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;只读层：镜像通常被表示为只读层，因为镜像在容器处于运行状态期间不会被修改。
只读层可以由多个层组成，这些层组合到一起形成最终的只读层。
如果容器要向文件系统中写入数据，则在容器层之上会存在一个薄层为容器提供临时存储。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- writeable layer: Depending on your container runtime, local writes might be
implemented as a layered write mechanism (for example, `overlayfs` on Linux or CimFS on Windows).
This is referred to as the writable layer.
Local writes could also use a writeable filesystem that is initialized with a full clone of the container
image; this is used for some runtimes based on hypervisor virtualisation.

The container runtime filesystem contains both the read-only layer and the writeable layer.
This is considered the `imagefs` in Kubernetes documentation.
--&gt;
&lt;ul&gt;
&lt;li&gt;可写层：取决于容器运行时的不同实现，本地写入可能会用分层写入机制来实现
（例如 Linux 上的 &lt;code&gt;overlayfs&lt;/code&gt; 或 Windows 上的 CimFS）。这一机制被称为可写层。
本地写入也可以使用一个可写文件系统来实现，该文件系统使用容器镜像的完整克隆来初始化；
这种方式适用于某些基于 Hypervisor 虚拟化的运行时。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;容器运行时文件系统包含只读层和可写层。在 Kubernetes 文档中，这一文件系统被称为 &lt;code&gt;imagefs&lt;/code&gt;。&lt;/p&gt;
&lt;!--
## Container runtime configurations

### CRI-O

CRI-O uses a storage configuration file in TOML format that lets you control how the container runtime stores persistent and temporary data.
CRI-O utilizes the [storage library](https://github.com/containers/storage).  
Some Linux distributions have a manual entry for storage (`man 5 containers-storage.conf`).
The main configuration for storage is located in `/etc/containers/storage.conf` and one can control the location for temporary data and the root directory.  
The root directory is where CRI-O stores the persistent data.
--&gt;
&lt;h2 id=&#34;container-runtime-configurations&#34;&gt;容器运行时配置  &lt;/h2&gt;
&lt;h3 id=&#34;cri-o&#34;&gt;CRI-O&lt;/h3&gt;
&lt;p&gt;CRI-O 使用 TOML 格式的存储配置文件，让你控制容器运行时如何存储持久数据和临时数据。
CRI-O 使用了 &lt;a href=&#34;https://github.com/containers/storage&#34;&gt;containers-storage 库&lt;/a&gt;。
某些 Linux 发行版为 containers-storage 提供了帮助手册条目（&lt;code&gt;man 5 containers-storage.conf&lt;/code&gt;）。
存储的主要配置位于 &lt;code&gt;/etc/containers/storage.conf&lt;/code&gt; 中，你可以控制临时数据和根目录的位置。
根目录是 CRI-O 存储持久数据的位置。&lt;/p&gt;
&lt;!--
```toml
[storage]
# Default storage driver
driver = &#34;overlay&#34;
# Temporary storage location
runroot = &#34;/var/run/containers/storage&#34;
# Primary read/write location of container storage 
graphroot = &#34;/var/lib/containers/storage&#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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[storage]
&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;driver = &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;overlay&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:#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;runroot = &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;/var/run/containers/storage&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:#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;graphroot = &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;/var/lib/containers/storage&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
- `graphroot`
  - Persistent data stored from the container runtime
  - If SELinux is enabled, this must match the `/var/lib/containers/storage`
- `runroot`
  - Temporary read/write access for container
  - Recommended to have this on a temporary filesystem
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;graphroot&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;存储来自容器运行时的持久数据&lt;/li&gt;
&lt;li&gt;如果 SELinux 被启用，则此项必须是 &lt;code&gt;/var/lib/containers/storage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;runroot&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;容器的临时读/写访问&lt;/li&gt;
&lt;li&gt;建议将其放在某个临时文件系统上&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Here is a quick way to relabel your graphroot directory to match `/var/lib/containers/storage`:

```bash
semanage fcontext -a -e /var/lib/containers/storage &lt;YOUR-STORAGE-PATH&gt;
restorecon -R -v &lt;YOUR-STORAGE-PATH&gt;
```
--&gt;
&lt;p&gt;以下是为你的 graphroot 目录快速重新打标签以匹配 &lt;code&gt;/var/lib/containers/storage&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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;semanage fcontext -a -e /var/lib/containers/storage &amp;lt;你的存储路径&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;restorecon -R -v &amp;lt;你的存储路径&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### containerd

The containerd runtime uses a TOML configuration file to control where persistent and ephemeral data is stored.
The default path for the config file is located at `/etc/containerd/config.toml`.

The relevant fields for containerd storage are `root` and `state`.
--&gt;
&lt;h3 id=&#34;containerd&#34;&gt;containerd&lt;/h3&gt;
&lt;p&gt;containerd 运行时使用 TOML 配置文件来控制存储持久数据和临时数据的位置。
配置文件的默认路径位于 &lt;code&gt;/etc/containerd/config.toml&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;与 containerd 存储的相关字段是 &lt;code&gt;root&lt;/code&gt; 和 &lt;code&gt;state&lt;/code&gt;。&lt;/p&gt;
&lt;!--
- `root`
  - The root directory for containerd metadata
  - Default is `/var/lib/containerd`
  - Root also requires SELinux labels if your OS requires it
- `state`
  - Temporary data for containerd
  - Default is `/run/containerd`
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;root&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;containerd 元数据的根目录&lt;/li&gt;
&lt;li&gt;默认为 &lt;code&gt;/var/lib/containerd&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;如果你的操作系统要求，需要为根目录设置 SELinux 标签&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;state&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;containerd 的临时数据&lt;/li&gt;
&lt;li&gt;默认为 &lt;code&gt;/run/containerd&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Kubernetes node pressure eviction

Kubernetes will automatically detect if the container filesystem is split from the node filesystem. 
When one separates the filesystem, Kubernetes is responsible for monitoring both the node filesystem and the container runtime filesystem.
Kubernetes documentation refers to the node filesystem and the container runtime filesystem as nodefs and imagefs.
If either nodefs or the imagefs are running out of disk space, then the overall node is considered to have disk pressure.
Kubernetes will first reclaim space by deleting unusued containers and images, and then it will resort to evicting pods.
On a node that has a nodefs and an imagefs, the kubelet will
[garbage collect](/docs/concepts/architecture/garbage-collection/#containers-images) unused container images
on imagefs and will remove dead pods and their containers from the nodefs.
If there is only a nodefs, then Kubernetes garbage collection includes dead containers, dead pods and unused images.
--&gt;
&lt;h2 id=&#34;kubernetes-node-pressure-eviction&#34;&gt;Kubernetes 节点压力驱逐  &lt;/h2&gt;
&lt;p&gt;Kubernetes 将自动检测容器文件系统是否与节点文件系统分离。
当你分离文件系统时，Kubernetes 负责同时监视节点文件系统和容器运行时文件系统。
Kubernetes 文档将节点文件系统称为 nodefs，将容器运行时文件系统称为 imagefs。
如果 nodefs 或 imagefs 中有一个磁盘空间不足，则整个节点被视为有磁盘压力。
这种情况下，Kubernetes 先通过删除未使用的容器和镜像来回收空间，之后会尝试驱逐 Pod。
在同时具有 nodefs 和 imagefs 的节点上，kubelet 将在 imagefs
上对未使用的容器镜像执行&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/garbage-collection/#containers-images&#34;&gt;垃圾回收&lt;/a&gt;，
并从 nodefs 中移除死掉的 Pod 及其容器。
如果只有 nodefs，则 Kubernetes 垃圾回收将包括死掉的容器、死掉的 Pod 和未使用的镜像。&lt;/p&gt;
&lt;!--
Kubernetes allows more configurations for determining if your disk is full.  
The eviction manager within the kubelet has some configuration settings that let you control
the relevant thresholds.
For filesystems, the relevant measurements are `nodefs.available`, `nodefs.inodesfree`, `imagefs.available`, and `imagefs.inodesfree`.
If there is not a dedicated disk for the container runtime then imagefs is ignored.

Users can use the existing defaults:
--&gt;
&lt;p&gt;Kubernetes 提供额外的配置方法来确定磁盘是否已满。kubelet 中的驱逐管理器有一些让你可以控制相关阈值的配置项。
对于文件系统，相关测量值有 &lt;code&gt;nodefs.available&lt;/code&gt;、&lt;code&gt;nodefs.inodesfree&lt;/code&gt;、&lt;code&gt;imagefs.available&lt;/code&gt; 和
&lt;code&gt;imagefs.inodesfree&lt;/code&gt;。如果容器运行时没有专用磁盘，则 imagefs 被忽略。&lt;/p&gt;
&lt;p&gt;用户可以使用现有的默认值：&lt;/p&gt;
&lt;!--
- `memory.available` &lt; 100MiB
- `nodefs.available` &lt; 10%
- `imagefs.available` &lt; 15%
- `nodefs.inodesFree` &lt; 5% (Linux nodes)

Kubernetes allows you to set user defined values in `EvictionHard` and `EvictionSoft` in the kubelet configuration file.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;memory.available&lt;/code&gt; &amp;lt; 100MiB&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nodefs.available&lt;/code&gt; &amp;lt; 10%&lt;/li&gt;
&lt;li&gt;&lt;code&gt;imagefs.available&lt;/code&gt; &amp;lt; 15%&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nodefs.inodesFree&lt;/code&gt; &amp;lt; 5%（Linux 节点）&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Kubernetes 允许你在 kubelet 配置文件中将 &lt;code&gt;EvictionHard&lt;/code&gt; 和 &lt;code&gt;EvictionSoft&lt;/code&gt; 设置为用户定义的值。&lt;/p&gt;
&lt;!--
`EvictionHard`
: defines limits; once these limits are exceeded, pods will be evicted without any grace period.

`EvictionSoft`
: defines limits; once these limits are exceeded, pods will be evicted with a grace period that can be set per signal.
--&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;EvictionHard&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;定义限制；一旦超出这些限制，Pod 将被立即驱逐，没有任何宽限期。&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;EvictionSoft&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;定义限制；一旦超出这些限制，Pod 将在按各信号所设置的宽限期后被驱逐。&lt;/dd&gt;
&lt;/dl&gt;
&lt;!--
If you specify a value for `EvictionHard`, it will replace the defaults.  
This means it is important to set all signals in your configuration.

For example, the following kubelet configuration could be used to configure [eviction signals](/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals-and-thresholds) and grace period options.
--&gt;
&lt;p&gt;如果你为 &lt;code&gt;EvictionHard&lt;/code&gt; 指定了值，所设置的值将取代默认值。
这意味着在你的配置中设置所有信号非常重要。&lt;/p&gt;
&lt;p&gt;例如，以下 kubelet
配置可用于配置&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals-and-thresholds&#34;&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;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;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;address&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;192.168.0.8&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;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;20250&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;serializeImagePulls&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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;evictionHard&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;100Mi&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;nodefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;10%&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;nodefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;5%&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;imagefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;15%&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;imagefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;5%&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;evictionSoft&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;100Mi&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;nodefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;10%&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;nodefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;5%&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;imagefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;15%&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;imagefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;5%&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;evictionSoftGracePeriod&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;1m30s&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;nodefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2m&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;nodefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2m&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;imagefs.available&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2m&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;imagefs.inodesFree&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;2m&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;evictionMaxPodGracePeriod&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;60s&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;!--
### Problems

The Kubernetes project recommends that you either use the default settings for eviction or you set all the fields for eviction.
You can use the default settings or specify your own `evictionHard` settings. If you miss a signal, then Kubernetes will not monitor that resource.
One common misconfiguration administrators or users can hit is mounting a new filesystem to `/var/lib/containers/storage` or `/var/lib/containerd`.
Kubernetes will detect a separate filesystem, so you want to make sure to check that `imagefs.inodesfree` and `imagefs.available` match your needs if you&#39;ve done this.
--&gt;
&lt;h3 id=&#34;problems&#34;&gt;问题  &lt;/h3&gt;
&lt;p&gt;Kubernetes 项目建议你针对 Pod 驱逐要么使用其默认设置，要么设置与之相关的所有字段。
你可以使用默认设置或指定你自己的 &lt;code&gt;evictionHard&lt;/code&gt; 设置。 如果你漏掉一个信号，那么 Kubernetes 将不会监视该资源。
管理员或用户可能会遇到的一个常见误配是将新的文件系统挂载到 &lt;code&gt;/var/lib/containers/storage&lt;/code&gt; 或 &lt;code&gt;/var/lib/containerd&lt;/code&gt;。
Kubernetes 将检测到一个单独的文件系统，因此你要确保 &lt;code&gt;imagefs.inodesfree&lt;/code&gt; 和 &lt;code&gt;imagefs.available&lt;/code&gt; 符合你的需要。&lt;/p&gt;
&lt;!--
Another area of confusion is that ephemeral storage reporting does not change if you define an image
filesystem for your node. The image filesystem (`imagefs`) is used to store container image layers; if a
container writes to its own root filesystem, that local write doesn&#39;t count towards the size of the container image. The place where the container runtime stores those local modifications is runtime-defined, but is often
the image filesystem.
If a container in a pod is writing to a filesystem-backed `emptyDir` volume, then this uses space from the
`nodefs` filesystem.
The kubelet always reports ephemeral storage capacity and allocations based on the filesystem represented
by `nodefs`; this can be confusing when ephemeral writes are actually going to the image filesystem.
--&gt;
&lt;p&gt;另一个令人困惑的地方是，如果你为节点定义了镜像文件系统，则临时存储报告不会发生变化。
镜像文件系统（&lt;code&gt;imagefs&lt;/code&gt;）用于存储容器镜像层；如果容器向自己的根文件系统写入，
那么这种本地写入不会计入容器镜像的大小。容器运行时存储这些本地修改的位置是由运行时定义的，但通常是镜像文件系统。
如果 Pod 中的容器正在向基于文件系统的 &lt;code&gt;emptyDir&lt;/code&gt; 卷写入，所写入的数据将使用 &lt;code&gt;nodefs&lt;/code&gt; 文件系统的空间。
kubelet 始终根据 &lt;code&gt;nodefs&lt;/code&gt; 所表示的文件系统来报告临时存储容量和分配情况；
当临时写入操作实际上是写到镜像文件系统时，这种差别可能会让人困惑。&lt;/p&gt;
&lt;!--
### Future work

To fix the ephemeral storage reporting limitations and provide more configuration options to the container runtime, SIG Node are working on [KEP-4191](http://kep.k8s.io/4191).
In KEP-4191, Kubernetes will detect if the writeable layer is separated from the read-only layer (images).
This would allow us to have all ephemeral storage, including the writeable layer, on the same disk as well as allowing for a separate disk for images.
--&gt;
&lt;h3 id=&#34;future-work&#34;&gt;后续工作  &lt;/h3&gt;
&lt;p&gt;为了解决临时存储报告相关的限制并为容器运行时提供更多配置选项，SIG Node
正在处理 &lt;a href=&#34;http://kep.k8s.io/4191&#34;&gt;KEP-4191&lt;/a&gt;。在 KEP-4191 中，
Kubernetes 将检测可写层是否与只读层（镜像）分离。
这种检测使我们可以将包括可写层在内的所有临时存储放在同一磁盘上，同时也可以为镜像使用单独的磁盘。&lt;/p&gt;
&lt;!--
### Getting involved

If you would like to get involved, you can
join [Kubernetes Node Special-Interest-Group](https://github.com/kubernetes/community/tree/master/sig-node) (SIG).

If you would like to share feedback, you can do so on our
[#sig-node](https://kubernetes.slack.com/archives/C0BP8PW9G) Slack channel.
If you&#39;re not already part of that Slack workspace, you can visit https://slack.k8s.io/ for an invitation.
--&gt;
&lt;h3 id=&#34;getting-involved&#34;&gt;参与其中  &lt;/h3&gt;
&lt;p&gt;如果你想参与其中，可以加入
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node&#34;&gt;Kubernetes Node 特别兴趣小组&lt;/a&gt;（SIG）。&lt;/p&gt;
&lt;p&gt;如果你想分享反馈，可以分享到我们的
&lt;a href=&#34;https://kubernetes.slack.com/archives/C0BP8PW9G&#34;&gt;#sig-node&lt;/a&gt; Slack 频道。
如果你还没有加入该 Slack 工作区，可以访问 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;https://slack.k8s.io/&lt;/a&gt; 获取邀请。&lt;/p&gt;
&lt;!--
Special thanks to all the contributors who provided great reviews, shared valuable insights or suggested the topic idea.
--&gt;
&lt;p&gt;特别感谢所有提供出色评审、分享宝贵见解或建议主题想法的贡献者。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Peter Hunt&lt;/li&gt;
&lt;li&gt;Mrunal Patel&lt;/li&gt;
&lt;li&gt;Ryan Phillips&lt;/li&gt;
&lt;li&gt;Gaurav Singh&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29 中的上下文日志生成：更好的故障排除和增强的日志记录</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/20/contextual-logging-in-kubernetes-1-29/</link>
      <pubDate>Wed, 20 Dec 2023 09:30:00 -0800</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/20/contextual-logging-in-kubernetes-1-29/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Contextual logging in Kubernetes 1.29: Better troubleshooting and enhanced logging&#34;
slug: contextual-logging-in-kubernetes-1-29
date: 2023-12-20T09:30:00-08:00
canonicalUrl: https://www.kubernetes.dev/blog/2023/12/20/contextual-logging/
--&gt;
&lt;!--
**Authors**: [Mengjiao Liu](https://github.com/mengjiao-liu/) (DaoCloud), [Patrick Ohly](https://github.com/pohly) (Intel)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/mengjiao-liu/&#34;&gt;Mengjiao Liu&lt;/a&gt; (DaoCloud), &lt;a href=&#34;https://github.com/pohly&#34;&gt;Patrick Ohly&lt;/a&gt; (Intel)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/mengjiao-liu/&#34;&gt;Mengjiao Liu&lt;/a&gt; (DaoCloud)&lt;/p&gt;
&lt;!--
On behalf of the [Structured Logging Working Group](https://github.com/kubernetes/community/blob/master/wg-structured-logging/README.md) 
and [SIG Instrumentation](https://github.com/kubernetes/community/tree/master/sig-instrumentation#readme), 
we are pleased to announce that the contextual logging feature
introduced in Kubernetes v1.24 has now been successfully migrated to
two components (kube-scheduler and kube-controller-manager)
as well as some directories. This feature aims to provide more useful logs 
for better troubleshooting of Kubernetes and to empower developers to enhance Kubernetes.
--&gt;
&lt;p&gt;代表&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/wg-structed-logging/README.md&#34;&gt;结构化日志工作组&lt;/a&gt;和
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-instrumentation#readme&#34;&gt;SIG Instrumentation&lt;/a&gt;，
我们很高兴地宣布在 Kubernetes v1.24 中引入的上下文日志记录功能现已成功迁移了两个组件（kube-scheduler 和 kube-controller-manager）
以及一些目录。该功能旨在为 Kubernetes 提供更多有用的日志以更好地进行故障排除，并帮助开发人员增强 Kubernetes。&lt;/p&gt;
&lt;!--
## What is contextual logging?

[Contextual logging](https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/3077-contextual-logging)
is based on the [go-logr](https://github.com/go-logr/logr#a-minimal-logging-api-for-go) API. 
The key idea is that libraries are passed a logger instance by their caller
and use that for logging instead of accessing a global logger.
The binary decides the logging implementation, not the libraries.
The go-logr API is designed around structured logging and supports attaching
additional information to a logger.
--&gt;
&lt;h2 id=&#34;what-is-contextual-logging&#34;&gt;上下文日志记录是什么？ &lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/3077-contextual-logging&#34;&gt;上下文日志记录&lt;/a&gt;基于
&lt;a href=&#34;https://github.com/go-logr/logr#a-minimal-logging-api-for-go&#34;&gt;go-logr&lt;/a&gt; API。
关键思想是调用者将一个日志生成器实例传递给库，并使用它进行日志记录而不是访问全局日志生成器。
二进制文件而不是库负责选择日志记录的实现。go-logr API 围绕结构化日志记录而设计，并支持向日志生成器提供额外信息。&lt;/p&gt;
&lt;!--
This enables additional use cases:

- The caller can attach additional information to a logger:
  - [WithName](&lt;https://pkg.go.dev/github.com/go-logr/logr#Logger.WithName&gt;) adds a &#34;logger&#34; key with the names concatenated by a dot as value
  - [WithValues](&lt;https://pkg.go.dev/github.com/go-logr/logr#Logger.WithValues&gt;) adds key/value pairs

  When passing this extended logger into a function, and the function uses it
  instead of the global logger, the additional information is then included 
  in all log entries, without having to modify the code that generates the log entries. 
  This is useful in highly parallel applications where it can become hard to identify 
  all log entries for a certain operation, because the output from different operations gets interleaved.

- When running unit tests, log output can be associated with the current test.
  Then, when a test fails, only the log output of the failed test gets shown by go test.
  That output can also be more verbose by default because it will not get shown for successful tests.
  Tests can be run in parallel without interleaving their output.
--&gt;
&lt;p&gt;这一设计可以支持某些额外的使用场景：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;调用者可以为日志生成器提供额外的信息：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/go-logr/logr#Logger.WithName&#34;&gt;WithName&lt;/a&gt; 添加一个 “logger” 键，
并用句点（.）将名称的各个部分串接起来作为取值&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/go-logr/logr#Logger.WithValues&#34;&gt;WithValues&lt;/a&gt; 添加键/值对&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;当将此经过扩展的日志生成器传递到函数中，并且该函数使用它而不是全局日志生成器时，
所有日志条目中都会包含所给的额外信息，而无需修改生成日志条目的代码。
这一特点在高度并行的应用中非常有用。在这类应用中，很难辨识某操作的所有日志条目，因为不同操作的输出是交错的。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;运行单元测试时，日志输出可以与当前测试相关联。且当测试失败时，go test 仅显示失败测试的日志输出。
默认情况下，该输出也可能更详细，因为它不会在成功的测试中显示。测试可以并行运行，而无需交错输出。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
One of the design decisions for contextual logging was to allow attaching a logger as value to a `context.Context`.
Since the logger encapsulates all aspects of the intended logging for the call,
it is *part* of the context, and not just *using* it. A practical advantage is that many APIs
already have a `ctx` parameter or can add one. This provides additional advantages, like being able to
get rid of `context.TODO()` calls inside the functions.
--&gt;
&lt;p&gt;上下文日志记录的设计决策之一是允许将日志生成器作为值附加到 &lt;code&gt;context.Context&lt;/code&gt; 之上。
由于日志生成器封装了调用所预期的、与日志记录相关的所有元素，
因此它是 context 的&lt;strong&gt;一部分&lt;/strong&gt;，而不仅仅是&lt;strong&gt;使用&lt;/strong&gt;它。这一设计的一个比较实际的优点是，
许多 API 已经有一个 &lt;code&gt;ctx&lt;/code&gt; 参数，或者可以添加一个 &lt;code&gt;ctx&lt;/code&gt; 参数。
进而产生的额外好处还包括比如可以去掉函数内的 &lt;code&gt;context.TODO()&lt;/code&gt; 调用。&lt;/p&gt;
&lt;!--
## How to use it

The contextual logging feature is alpha starting from Kubernetes v1.24,
so it requires the `ContextualLogging` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to be enabled.
If you want to test the feature while it is alpha, you need to enable this feature gate
on the `kube-controller-manager` and the `kube-scheduler`.
--&gt;
&lt;h2 id=&#34;how-to-use-it&#34;&gt;如何使用它 &lt;/h2&gt;
&lt;p&gt;从 Kubernetes v1.24 开始，上下文日志记录功能处于 Alpha 状态，因此它需要启用
&lt;code&gt;ContextualLogging&lt;/code&gt; &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;。
如果你想在该功能处于 Alpha 状态时对其进行测试，则需要在 &lt;code&gt;kube-controller-manager&lt;/code&gt; 和 &lt;code&gt;kube-scheduler&lt;/code&gt; 上启用此特性门控。&lt;/p&gt;
&lt;!--
For the `kube-scheduler`, there is one thing to note, in addition to enabling 
the `ContextualLogging` feature gate, instrumentation also depends on log verbosity.
To avoid slowing down the scheduler with the logging instrumentation for contextual logging added for 1.29,
it is important to choose carefully when to add additional information:
- At `-v3` or lower, only `WithValues(&#34;pod&#34;)` is used once per scheduling cycle.
  This has the intended effect that all log messages for the cycle include the pod information. 
  Once contextual logging is GA, &#34;pod&#34; key/value pairs can be removed from all log calls.
- At `-v4` or higher, richer log entries get produced where `WithValues` is also used for the node (when applicable)
  and `WithName` is used for the current operation and plugin.
--&gt;
&lt;p&gt;对于 &lt;code&gt;kube-scheduler&lt;/code&gt;，有一点需要注意，除了启用 &lt;code&gt;ContextualLogging&lt;/code&gt; 特性门控之外，
插桩行为还取决于日志的详细程度设置。
为了避免因 1.29 添加的上下文日志记录工具而降低调度程序的速度，请务必仔细选择何时添加额外的信息：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在 &lt;code&gt;-v3&lt;/code&gt; 或更低日志级别中，每个调度周期仅使用一次 &lt;code&gt;WithValues(&amp;quot;pod&amp;quot;)&lt;/code&gt;。
这样做可以达到预期效果，即该周期的所有日志消息都包含 Pod 信息。
一旦上下文日志记录特性到达 GA 阶段，就可以从所有日志调用中删除 “pod” 键值对。&lt;/li&gt;
&lt;li&gt;在 &lt;code&gt;-v4&lt;/code&gt; 或更高日志级别中，会生成更丰富的日志条目，其中 &lt;code&gt;WithValues&lt;/code&gt; 也用于节点（如果适用），&lt;code&gt;WithName&lt;/code&gt; 用于当前操作和插件。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Here is an example that demonstrates the effect:
--&gt;
&lt;p&gt;下面的示例展示了这一效果：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I1113 08:43:37.029524   87144 default_binder.go:53] &amp;quot;Attempting to bind pod to node&amp;quot; &lt;strong&gt;logger=&amp;quot;Bind.DefaultBinder&amp;quot;&lt;/strong&gt; &lt;strong&gt;pod&lt;/strong&gt;=&amp;quot;kube-system/coredns-69cbfb9798-ms4pq&amp;quot; &lt;strong&gt;node&lt;/strong&gt;=&amp;quot;127.0.0.1&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
The immediate benefit is that the operation and plugin name are visible in `logger`.
`pod` and `node` are already logged as parameters in individual log calls in `kube-scheduler` code.
Once contextual logging is supported by more packages outside of `kube-scheduler`, 
they will also be visible there (for example, client-go). Once it is GA,
log calls can be simplified to avoid repeating those values.
--&gt;
&lt;p&gt;这一设计的直接好处是在 &lt;code&gt;logger&lt;/code&gt; 中可以看到操作和插件名称。&lt;code&gt;pod&lt;/code&gt; 和 &lt;code&gt;node&lt;/code&gt; 已作为参数记录在
&lt;code&gt;kube-scheduler&lt;/code&gt; 代码中的各个日志调用中。一旦 &lt;code&gt;kube-scheduler&lt;/code&gt; 之外的其他包也支持上下文日志记录，
在这些包（例如，client-go）中也可以看到操作和插件名称。
一旦上下文日志记录特性到达 GA 阶段，就可以简化日志调用以避免重复这些值。&lt;/p&gt;
&lt;!--
In `kube-controller-manager`, `WithName` is used to add the user-visible controller name to log output, 
for example:
--&gt;
&lt;p&gt;在 &lt;code&gt;kube-controller-manager&lt;/code&gt; 中，&lt;code&gt;WithName&lt;/code&gt; 被用来在日志中输出用户可见的控制器名称，例如：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I1113 08:43:29.284360   87141 graph_builder.go:285] &amp;quot;garbage controller monitor not synced: no monitors&amp;quot; &lt;strong&gt;logger=&amp;quot;garbage-collector-controller&amp;quot;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
The `logger=”garbage-collector-controller”` was added by the `kube-controller-manager` core
when instantiating that controller and appears in all of its log entries - at least as long as the code
that it calls supports contextual logging. Further work is needed to convert shared packages like client-go.
--&gt;
&lt;p&gt;&lt;code&gt;logger=”garbage-collector-controller”&lt;/code&gt; 是由 &lt;code&gt;kube-controller-manager&lt;/code&gt;
核心代码在实例化该控制器时添加的，会出现在其所有日志条目中——只要它所调用的代码支持上下文日志记录。
转换像 client-go 这样的共享包还需要额外的工作。&lt;/p&gt;
&lt;!--
## Performance impact

Supporting contextual logging in a package, i.e. accepting a logger from a caller, is cheap. 
No performance impact was observed for the `kube-scheduler`. As noted above, 
adding `WithName` and `WithValues` needs to be done more carefully.
--&gt;
&lt;h2 id=&#34;performance-impact&#34;&gt;性能影响 &lt;/h2&gt;
&lt;p&gt;在包中支持上下文日志记录，即接受来自调用者的记录器，成本很低。
没有观察到 &lt;code&gt;kube-scheduler&lt;/code&gt; 的性能影响。如上所述，添加 &lt;code&gt;WithName&lt;/code&gt; 和 &lt;code&gt;WithValues&lt;/code&gt; 需要更加小心。&lt;/p&gt;
&lt;!--
In Kubernetes 1.29, enabling contextual logging at production verbosity (`-v3` or lower)
caused no measurable slowdown for the `kube-scheduler` and is not expected for the `kube-controller-manager` either.
At debug levels, a 28% slowdown for some test cases is still reasonable given that the resulting logs make debugging easier. 
For details, see the [discussion around promoting the feature to beta](https://github.com/kubernetes/enhancements/pull/4219#issuecomment-1807811995).
--&gt;
&lt;p&gt;在 Kubernetes 1.29 中，以生产环境日志详细程度（&lt;code&gt;-v3&lt;/code&gt; 或更低）启用上下文日志不会导致 &lt;code&gt;kube-scheduler&lt;/code&gt; 速度出现明显的减慢，
并且 &lt;code&gt;kube-controller-manager&lt;/code&gt; 速度也不会出现明显的减慢。在 debug 级别，考虑到生成的日志使调试更容易，某些测试用例减速 28% 仍然是合理的。
详细信息请参阅&lt;a href=&#34;https://github.com/kubernetes/enhancements/pull/4219#issuecomment-1807811995&#34;&gt;有关将该特性升级为 Beta 版的讨论&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Impact on downstream users
Log output is not part of the Kubernetes API and changes regularly in each release,
whether it is because developers work on the code or because of the ongoing conversion
to structured and contextual logging.

If downstream users have dependencies on specific logs, 
they need to be aware of how this change affects them.
--&gt;
&lt;h2 id=&#34;impact-on-downstream-users&#34;&gt;对下游用户的影响 &lt;/h2&gt;
&lt;p&gt;日志输出不是 Kubernetes API 的一部分，并且经常在每个版本中都会出现更改，
无论是因为开发人员修改代码还是因为不断转换为结构化和上下文日志记录。&lt;/p&gt;
&lt;p&gt;如果下游用户对特定日志有依赖性，他们需要了解此更改如何影响他们。&lt;/p&gt;
&lt;!--
## Further reading

- Read the [Contextual Logging in Kubernetes 1.24](https://www.kubernetes.dev/blog/2022/05/25/contextual-logging/) article.
- Read the [KEP-3077: contextual logging](https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/3077-contextual-logging).
--&gt;
&lt;h2 id=&#34;further-reading&#34;&gt;进一步阅读 &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;参阅 &lt;a href=&#34;https://www.kubernetes.dev/blog/2022/05/25/contextual-logging/&#34;&gt;Kubernetes 1.24 中的上下文日志记录&lt;/a&gt; 。&lt;/li&gt;
&lt;li&gt;参阅 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/3077-contextual-logging&#34;&gt;KEP-3077：上下文日志记录&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Get involved

If you&#39;re interested in getting involved, we always welcome new contributors to join us.
Contextual logging provides a fantastic opportunity for you to contribute to Kubernetes development and make a meaningful impact.
By joining [Structured Logging WG](https://github.com/kubernetes/community/tree/master/wg-structured-logging),
you can actively participate in the development of Kubernetes and make your first contribution.
It&#39;s a great way to learn and engage with the community while gaining valuable experience.
--&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-structured-logging&#34;&gt;Structured Logging WG&lt;/a&gt;，
你可以积极参与 Kubernetes 的开发并做出你的第一个贡献。这是学习和参与社区并获得宝贵经验的好方法。&lt;/p&gt;
&lt;!--
We encourage you to explore the repository and familiarize yourself with the ongoing discussions and projects. 
It&#39;s a collaborative environment where you can exchange ideas, ask questions, and work together with other contributors.
--&gt;
&lt;p&gt;我们鼓励你探索存储库并熟悉正在进行的讨论和项目。这是一个协作环境，你可以在这里交流想法、提出问题并与其他贡献者一起工作。&lt;/p&gt;
&lt;!--
If you have any questions or need guidance, don&#39;t hesitate to reach out to us 
and you can do so on our [public Slack channel](https://kubernetes.slack.com/messages/wg-structured-logging). 
If you&#39;re not already part of that Slack workspace, you can visit [https://slack.k8s.io/](https://slack.k8s.io/)
for an invitation.
--&gt;
&lt;p&gt;如果你有任何疑问或需要指导，请随时与我们联系，你可以通过我们的&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-structured-logging&#34;&gt;公共 Slack 频道&lt;/a&gt;联系我们。
如果你尚未加入 Slack 工作区，可以访问 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;https://slack.k8s.io/&lt;/a&gt; 获取邀请。&lt;/p&gt;
&lt;!--
We would like to express our gratitude to all the contributors who provided excellent reviews, 
shared valuable insights, and assisted in the implementation of this feature (in alphabetical order):
--&gt;
&lt;p&gt;我们要向所有提供精彩评论、分享宝贵见解并协助实施此功能的贡献者表示感谢（按字母顺序排列）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Aldo Culquicondor (&lt;a href=&#34;https://github.com/alculquicondor&#34;&gt;alculquicondor&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Andy Goldstein (&lt;a href=&#34;https://github.com/ncdc&#34;&gt;ncdc&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Feruzjon Muyassarov (&lt;a href=&#34;https://github.com/fmuyassarov&#34;&gt;fmuyassarov&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Freddie (&lt;a href=&#34;https://github.com/freddie400&#34;&gt;freddie400&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;JUN YANG (&lt;a href=&#34;https://github.com/yangjunmyfm192085&#34;&gt;yangjunmyfm192085&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Kante Yin (&lt;a href=&#34;https://github.com/kerthcet&#34;&gt;kerthcet&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Kiki (&lt;a href=&#34;https://github.com/carlory&#34;&gt;carlory&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Lucas Severo Alve (&lt;a href=&#34;https://github.com/knelasevero&#34;&gt;knelasevero&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Maciej Szulik (&lt;a href=&#34;https://github.com/soltysh&#34;&gt;soltysh&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Mengjiao Liu (&lt;a href=&#34;https://github.com/mengjiao-liu&#34;&gt;mengjiao-liu&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Naman Lakhwani (&lt;a href=&#34;https://github.com/Namanl2001&#34;&gt;Namanl2001&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Oksana Baranova (&lt;a href=&#34;https://github.com/oxxenix&#34;&gt;oxxenix&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Patrick Ohly (&lt;a href=&#34;https://github.com/pohly&#34;&gt;pohly&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;songxiao-wang87 (&lt;a href=&#34;https://github.com/songxiao-wang87&#34;&gt;songxiao-wang87&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tim Allclai (&lt;a href=&#34;https://github.com/tallclair&#34;&gt;tallclair&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;ZhangYu (&lt;a href=&#34;https://github.com/Octopusjust&#34;&gt;Octopusjust&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ziqi Zhao (&lt;a href=&#34;https://github.com/fatsheep9146&#34;&gt;fatsheep9146&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Zac (&lt;a href=&#34;https://github.com/249043822&#34;&gt;249043822&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29: 解耦污点管理器与节点生命周期控制器</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/19/kubernetes-1-29-taint-eviction-controller/</link>
      <pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/19/kubernetes-1-29-taint-eviction-controller/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.29: Decoupling taint-manager from node-lifecycle-controller&#34;
date: 2023-12-19
slug: kubernetes-1-29-taint-eviction-controller
--&gt;
&lt;!-- 
**Authors:** Yuan Chen (Apple), Andrea Tosatto (Apple) 
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Yuan Chen (Apple), Andrea Tosatto (Apple)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; Allen Zhang&lt;/p&gt;
&lt;!-- 
This blog discusses a new feature in Kubernetes 1.29 to improve the handling of taint-based pod eviction. 
--&gt;
&lt;p&gt;这篇博客讨论在 Kubernetes 1.29 中基于污点的 Pod 驱逐处理的新特性。&lt;/p&gt;
&lt;!-- 
## Background 
--&gt;
&lt;h2 id=&#34;背景&#34;&gt;背景&lt;/h2&gt;
&lt;!-- 
In Kubernetes 1.29, an improvement has been introduced to enhance the taint-based pod eviction handling on nodes.
This blog discusses the changes made to node-lifecycle-controller
to separate its responsibilities and improve overall code maintainability. 
--&gt;
&lt;p&gt;在 Kubernetes 1.29 中引入了一项改进，以加强节点上基于污点的 Pod 驱逐处理。
本文将讨论对节点生命周期控制器（node-lifecycle-controller）所做的更改，以分离职责并提高代码的整体可维护性。&lt;/p&gt;
&lt;!-- 
## Summary of changes 
--&gt;
&lt;h2 id=&#34;变动摘要&#34;&gt;变动摘要&lt;/h2&gt;
&lt;!-- 
node-lifecycle-controller previously combined two independent functions: 
--&gt;
&lt;p&gt;节点生命周期控制器之前组合了两个独立的功能：&lt;/p&gt;
&lt;!-- 
- Adding a pre-defined set of `NoExecute` taints to Node based on Node&#39;s condition.
- Performing pod eviction on `NoExecute` taint. 
--&gt;
&lt;ul&gt;
&lt;li&gt;基于节点的条件为节点新增了一组预定义的污点 &lt;code&gt;NoExecute&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;对有 &lt;code&gt;NoExecute&lt;/code&gt; 污点的 Pod 执行驱逐操作。&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- 
With the Kubernetes 1.29 release, the taint-based eviction implementation has been
moved out of node-lifecycle-controller into a separate and independent component called taint-eviction-controller.
This separation aims to disentangle code, enhance code maintainability,
and facilitate future extensions to either component. 
--&gt;
&lt;p&gt;在 Kubernetes 1.29 版本中，基于污点的驱逐实现已经从节点生命周期控制器中移出，
成为一个名为污点驱逐控制器（taint-eviction-controller）的独立组件。
旨在拆分代码，提高代码的可维护性，并方便未来对这两个组件进行扩展。&lt;/p&gt;
&lt;!-- 
As part of the change, additional metrics were introduced to help you monitor taint-based pod evictions: 
--&gt;
&lt;p&gt;以下新指标可以帮助你监控基于污点的 Pod 驱逐：&lt;/p&gt;
&lt;!-- 
- `pod_deletion_duration_seconds` measures the latency between the time when a taint effect
has been activated for the Pod and its deletion via taint-eviction-controller.
- `pod_deletions_total` reports the total number of Pods deleted by taint-eviction-controller since its start. 
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pod_deletion_duration_seconds&lt;/code&gt; 表示当 Pod 的污点被激活直到这个 Pod 被污点驱逐控制器删除的延迟时间。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pod_deletions_total&lt;/code&gt; 表示自从污点驱逐控制器启动以来驱逐的 Pod 总数。&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- 
## How to use the new feature? 
--&gt;
&lt;h2 id=&#34;如何使用这个新特性&#34;&gt;如何使用这个新特性？&lt;/h2&gt;
&lt;!-- 
A new feature gate, `SeparateTaintEvictionController`, has been added. The feature is enabled by default as Beta in Kubernetes 1.29.
Please refer to the [feature gate document](/docs/reference/command-line-tools-reference/feature-gates/). 
--&gt;
&lt;p&gt;名为 &lt;code&gt;SeparateTaintEvictionController&lt;/code&gt; 的特性门控已被添加。该特性在 Kubernetes 1.29 Beta 版本中默认开启。
详情请参阅&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;。&lt;/p&gt;
&lt;!-- 
When this feature is enabled, users can optionally disable taint-based eviction by setting `--controllers=-taint-eviction-controller`
in kube-controller-manager. 
--&gt;
&lt;p&gt;当这项特性启用时，用户可以通过在 &lt;code&gt;kube-controller-manager&lt;/code&gt; 通过手动设置
&lt;code&gt;--controllers=-taint-eviction-controller&lt;/code&gt; 的方式来禁用基于污点的驱逐功能。&lt;/p&gt;
&lt;!-- 
To disable the new feature and use the old taint-manager within node-lifecylecycle-controller , users can set the feature gate `SeparateTaintEvictionController=false`. 
--&gt;
&lt;p&gt;如果想禁用该特性并在节点生命周期中使用旧版本污点管理器，用户可以通过设置 &lt;code&gt;SeparateTaintEvictionController=false&lt;/code&gt; 来禁用。&lt;/p&gt;
&lt;!-- 
## Use cases 
--&gt;
&lt;h2 id=&#34;使用案例&#34;&gt;使用案例&lt;/h2&gt;
&lt;!-- 
This new feature will allow cluster administrators to extend and enhance the default
taint-eviction-controller and even replace the default taint-eviction-controller with a
custom implementation to meet different needs. An example is to better support
stateful workloads that use PersistentVolume on local disks. 
--&gt;
&lt;p&gt;该特性将允许集群管理员扩展、增强默认的污点驱逐控制器，并且可以使用自定义的实现方式替换默认的污点驱逐控制器以满足不同的需要。
例如：更好地支持在本地磁盘的持久卷中的有状态工作负载。&lt;/p&gt;
&lt;!-- 
## FAQ 
--&gt;
&lt;h2 id=&#34;faq&#34;&gt;FAQ&lt;/h2&gt;
&lt;!-- 
**Does this feature change the existing behavior of taint-based pod evictions?** 
--&gt;
&lt;p&gt;&lt;strong&gt;该特性是否会改变现有的基于污点的 Pod 驱逐行为？&lt;/strong&gt;&lt;/p&gt;
&lt;!-- 
No, the taint-based pod eviction behavior remains unchanged. If the feature gate
`SeparateTaintEvictionController` is turned off, the legacy node-lifecycle-controller with taint-manager will continue to be used. 
--&gt;
&lt;p&gt;不会，基于污点的 Pod 驱逐行为保持不变。如果特性门控 &lt;code&gt;SeparateTaintEvictionController&lt;/code&gt; 被关闭，
将继续使用之前的节点生命周期管理器中的污点管理器。&lt;/p&gt;
&lt;!-- 
**Will enabling/using this feature result in an increase in the time taken by any operations covered by existing SLIs/SLOs?** 
--&gt;
&lt;p&gt;&lt;strong&gt;启用/使用此特性是否会导致现有 SLI/SLO 中任何操作的用时增加？&lt;/strong&gt;&lt;/p&gt;
&lt;!-- 
No. 
--&gt;
&lt;p&gt;不会。&lt;/p&gt;
&lt;!-- 
**Will enabling/using this feature result in an increase in resource usage (CPU, RAM, disk, IO, ...)?** 
--&gt;
&lt;p&gt;&lt;strong&gt;启用/使用此特性是否会导致资源利用量（如 CPU、内存、磁盘、IO 等）的增加？&lt;/strong&gt;&lt;/p&gt;
&lt;!-- 
The increase in resource usage by running a separate `taint-eviction-controller` will be negligible. 
--&gt;
&lt;p&gt;运行单独的 &lt;code&gt;taint-eviction-controller&lt;/code&gt; 所增加的资源利用量可以忽略不计。&lt;/p&gt;
&lt;!-- 
## Learn more 
--&gt;
&lt;h2 id=&#34;了解更多&#34;&gt;了解更多&lt;/h2&gt;
&lt;!-- 
For more details, refer to the [KEP](http://kep.k8s.io/3902). 
--&gt;
&lt;p&gt;更多细节请参考 &lt;a href=&#34;http://kep.k8s.io/3902&#34;&gt;KEP&lt;/a&gt;。&lt;/p&gt;
&lt;!-- 
## Acknowledgments 
--&gt;
&lt;h2 id=&#34;特别鸣谢&#34;&gt;特别鸣谢&lt;/h2&gt;
&lt;!-- 
As with any Kubernetes feature, multiple community members have contributed, from
writing the KEP to implementing the new controller and reviewing the KEP and code. Special thanks to: 
--&gt;
&lt;p&gt;与任何 Kubernetes 特性一样，从撰写 KEP 到实现新控制器再到审核 KEP 和代码，多名社区成员都做出了贡献，特别感谢：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Aldo Culquicondor (@alculquicondor)&lt;/li&gt;
&lt;li&gt;Maciej Szulik (@soltysh)&lt;/li&gt;
&lt;li&gt;Filip Křepinský (@atiratree)&lt;/li&gt;
&lt;li&gt;Han Kang (@logicalhan)&lt;/li&gt;
&lt;li&gt;Wei Huang (@Huang-Wei)&lt;/li&gt;
&lt;li&gt;Sergey Kanzhelevi (@SergeyKanzhelev)&lt;/li&gt;
&lt;li&gt;Ravi Gudimetla (@ravisantoshgudimetla)&lt;/li&gt;
&lt;li&gt;Deep Debroy (@ddebroy)&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29：PodReadyToStartContainers 状况进阶至 Beta</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/19/pod-ready-to-start-containers-condition-now-in-beta/</link>
      <pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/19/pod-ready-to-start-containers-condition-now-in-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.29: PodReadyToStartContainers Condition Moves to Beta&#34;
date: 2023-12-19
slug: pod-ready-to-start-containers-condition-now-in-beta
--&gt;
&lt;!--
**Authors**: Zefeng Chen (independent), Kevin Hannon (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Zefeng Chen (independent), Kevin Hannon (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt;&lt;/p&gt;
&lt;!--
With the recent release of Kubernetes 1.29, the `PodReadyToStartContainers`
[condition](/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions) is 
available by default.
The kubelet manages the value for that condition throughout a Pod&#39;s lifecycle, 
in the status field of a Pod. The kubelet will use the `PodReadyToStartContainers`
condition to accurately surface the initialization state of a Pod,
from the perspective of Pod sandbox creation and network configuration by a container runtime.
--&gt;
&lt;p&gt;随着最近发布的 Kubernetes 1.29，&lt;code&gt;PodReadyToStartContainers&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions&#34;&gt;状况&lt;/a&gt;默认可用。
kubelet 在 Pod 的整个生命周期中管理该状况的值，将其存储在 Pod 的状态字段中。
kubelet 将通过容器运行时从 Pod 沙箱创建和网络配置的角度使用 &lt;code&gt;PodReadyToStartContainers&lt;/code&gt;
状况准确地展示 Pod 的初始化状态，&lt;/p&gt;
&lt;!--
## What&#39;s the motivation for this feature?
--&gt;
&lt;h2 id=&#34;这个特性的动机是什么&#34;&gt;这个特性的动机是什么？&lt;/h2&gt;
&lt;!--
Cluster administrators did not have a clear and easily accessible way to view the completion of Pod&#39;s sandbox creation
and initialization. As of 1.28, the `Initialized` condition in Pods tracks the execution of init containers.
However, it has limitations in accurately reflecting the completion of sandbox creation and readiness to start containers for all Pods in a cluster. 
This distinction is particularly important in multi-tenant clusters where tenants own the Pod specifications, including the set of init containers, 
while cluster administrators manage storage plugins, networking plugins, and container runtime handlers. 
Therefore, there is a need for an improved mechanism to provide cluster administrators with a clear and 
comprehensive view of Pod sandbox creation completion and container readiness.
--&gt;
&lt;p&gt;集群管理员以前没有明确且轻松访问的方式来查看 Pod 沙箱创建和初始化的完成情况。
从 1.28 版本开始，Pod 中的 &lt;code&gt;Initialized&lt;/code&gt; 状况跟踪 Init 容器的执行情况。
然而，它在准确反映沙箱创建完成和容器准备启动的方面存在一些限制，无法适用于集群中的所有 Pod。
在多租户集群中，这种区别尤为重要，租户拥有包括 Init 容器集合在内的 Pod 规约，
而集群管理员管理存储插件、网络插件和容器运行时处理程序。
因此，需要改进这个机制，以便为集群管理员提供清晰和全面的 Pod 沙箱创建完成和容器就绪状态的视图。&lt;/p&gt;
&lt;!--
## What&#39;s the benefit?

1. Improved Visibility: Cluster administrators gain a clearer and more comprehensive view of Pod sandbox
   creation completion and container readiness.
   This enhanced visibility allows them to make better-informed decisions and troubleshoot issues more effectively.
--&gt;
&lt;h2 id=&#34;这个特性有什么好处&#34;&gt;这个特性有什么好处？&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;改进可见性：集群管理员可以更清晰和全面地查看 Pod 沙箱的创建完成和容器的就绪状态。
这种增强的可见性使他们能够做出更明智的决策，并更有效地解决问题。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. Metric Collection and Monitoring: Monitoring services can leverage the fields associated with
   the `PodReadyToStartContainers` condition to report sandbox creation state and latency.
   Metrics can be collected at per-Pod cardinality or aggregated based on various
   properties of the Pod, such as `volumes`, `runtimeClassName`, custom annotations for CNI
   and IPAM plugins or arbitrary labels and annotations, and `storageClassName` of
   PersistentVolumeClaims.
   This enables comprehensive monitoring and analysis of Pod readiness across the cluster.
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;指标收集和监控：监控服务可以利用与 &lt;code&gt;PodReadyToStartContainers&lt;/code&gt; 状况相关的字段来报告沙箱创建状态和延迟。
可以按照每个 Pod 的基数进行指标收集，或者根据 Pod 的各种属性进行聚合，例如
&lt;code&gt;volumes&lt;/code&gt;、&lt;code&gt;runtimeClassName&lt;/code&gt;、CNI 和 IPAM 插件的自定义注解，
以及任意标签和注解，以及 PersistentVolumeClaims 的 &lt;code&gt;storageClassName&lt;/code&gt;。
这样可以全面监控和分析集群中 Pod 的就绪状态。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Enhanced Troubleshooting: With a more accurate representation of Pod sandbox creation and container readiness,
   cluster administrators can quickly identify and address any issues that may arise during the initialization process.
   This leads to improved troubleshooting capabilities and reduced downtime.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;增强故障排查能力：通过更准确地表示 Pod 沙箱的创建和容器的就绪状态，
集群管理员可以快速识别和解决初始化过程中可能出现的任何问题。
这将提高故障排查能力，并减少停机时间。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### What’s next?

Due to feedback and adoption, the Kubernetes team promoted `PodReadyToStartContainersCondition` to Beta in 1.29. 
Your comments will help determine if this condition continues forward to get promoted to GA, 
so please submit additional feedback on this feature!
--&gt;
&lt;h3 id=&#34;后续事项&#34;&gt;后续事项&lt;/h3&gt;
&lt;p&gt;鉴于反馈和采用情况，Kubernetes 团队在 1.29 版本中将 &lt;code&gt;PodReadyToStartContainersCondition&lt;/code&gt;
进阶至 Beta版。你的评论将有助于确定该状况是否继续并晋升至 GA，请针对此特性提交更多反馈！&lt;/p&gt;
&lt;!--
### How can I learn more?

Please check out the
[documentation](/docs/concepts/workloads/pods/pod-lifecycle/) for the
`PodReadyToStartContainersCondition` to learn more about it and how it fits in relation to
other Pod conditions.
--&gt;
&lt;h3 id=&#34;如何了解更多&#34;&gt;如何了解更多？&lt;/h3&gt;
&lt;p&gt;请查看关于 &lt;code&gt;PodReadyToStartContainersCondition&lt;/code&gt;
的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/&#34;&gt;文档&lt;/a&gt;，
以了解其更多信息及其与其他 Pod 状况的关系。&lt;/p&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;h3 id=&#34;如何参与&#34;&gt;如何参与？&lt;/h3&gt;
&lt;p&gt;该特性由 SIG Node 社区推动。请加入我们，与社区建立联系，分享你对这一特性及更多内容的想法和反馈。
我们期待倾听你的建议！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29 新的 Alpha 特性：Service 的负载均衡器 IP 模式</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/18/kubernetes-1-29-feature-loadbalancer-ip-mode-alpha/</link>
      <pubDate>Mon, 18 Dec 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/18/kubernetes-1-29-feature-loadbalancer-ip-mode-alpha/</guid>
      <description>
        
        
        &lt;!-- 
layout: blog
title: &#34;Kubernetes 1.29: New (alpha) Feature, Load Balancer IP Mode for Services&#34;
date: 2023-12-18
slug: kubernetes-1-29-feature-loadbalancer-ip-mode-alpha
--&gt;
&lt;!-- **Author:** [Aohan Yang](https://github.com/RyanAoh) --&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; &lt;a href=&#34;https://github.com/RyanAoh&#34;&gt;Aohan Yang&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Allen Zhang&lt;/p&gt;
&lt;!-- 
This blog introduces a new alpha feature in Kubernetes 1.29. 
It provides a configurable approach to define how Service implementations, 
exemplified in this blog by kube-proxy, 
handle traffic from pods to the Service, within the cluster. 
--&gt;
&lt;p&gt;本文介绍 Kubernetes 1.29 中一个新的 Alpha 特性。
此特性提供了一种可配置的方式用于定义 Service 的实现方式，本文中以
kube-proxy 为例介绍如何处理集群内从 Pod 到 Service 的流量。&lt;/p&gt;
&lt;!-- 
## Background 
--&gt;
&lt;h2 id=&#34;背景&#34;&gt;背景&lt;/h2&gt;
&lt;!-- 
In older Kubernetes releases, the kube-proxy would intercept traffic that was destined for the IP
address associated with a Service of `type: LoadBalancer`. This happened whatever mode you used
for `kube-proxy`.  
--&gt;
&lt;p&gt;在 Kubernetes 早期版本中，kube-proxy 会拦截指向 &lt;code&gt;type: LoadBalancer&lt;/code&gt; Service 关联
IP 地址的流量。这与你为 &lt;code&gt;kube-proxy&lt;/code&gt; 所使用的哪种模式无关。&lt;/p&gt;
&lt;!-- 
The interception implemented the expected behavior (traffic eventually reaching the expected
endpoints behind the Service). The mechanism to make that work depended on the mode for kube-proxy;
on Linux, kube-proxy in iptables mode would redirecting packets directly to the endpoint; in ipvs mode,
kube-proxy would configure the load balancer&#39;s IP address to one interface on the node. 
The motivation for implementing that interception was for two reasons: 
--&gt;
&lt;p&gt;这种拦截实现了预期行为（流量最终会抵达服务后挂载的端点）。这种机制取决于 kube-proxy 的模式，在
Linux 中，运行于 iptables 模式下的 kube-proxy 会重定向数据包到后端端点；在 ipvs 模式下，
kube-proxy 会将负载均衡器的 IP 地址配置到节点的一个网络接口上。采用这种拦截有两个原因：&lt;/p&gt;
&lt;!-- 
1. **Traffic path optimization:** Efficiently redirecting pod traffic - when a container in a pod sends an outbound
   packet that is destined for the load balancer&#39;s IP address - 
   directly to the backend service by bypassing the load balancer. 
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;流量路径优化：&lt;/strong&gt; 高效地重定向 Pod 流量 - 当 Pod 中的容器发送指向负载均衡器 IP 地址的出站包时，
会绕过负载均衡器直接重定向到后端服务。&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- 
2. **Handling load balancer packets:** Some load balancers send packets with the destination IP set to 
the load balancer&#39;s IP address. As a result, these packets need to be routed directly to the correct backend (which 
might not be local to that node), in order to avoid loops. 
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;&lt;strong&gt;处理负载均衡数据包：&lt;/strong&gt; 有些负载均衡器发送的数据包设置目标 IP 为负载均衡器的 IP 地址。
因此，这些数据包需要被直接路由到正确的后端（可能不在该节点本地），以避免回环。&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- 
## Problems 
--&gt;
&lt;h2 id=&#34;问题&#34;&gt;问题&lt;/h2&gt;
&lt;!-- 
However, there are several problems with the aforementioned behavior: 
--&gt;
&lt;p&gt;然而，上述行为存在几个问题：&lt;/p&gt;
&lt;!-- 
1. **[Source IP](https://github.com/kubernetes/kubernetes/issues/79783):** 
    Some cloud providers use the load balancer&#39;s IP as the source IP when 
    transmitting packets to the node. In the ipvs mode of kube-proxy, 
    there is a problem that health checks from the load balancer never return. This occurs because the reply packets 
    would be forward to the local interface `kube-ipvs0`(where the load balancer&#39;s IP is bound to) 
    and be subsequently ignored. 
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/79783&#34;&gt;源 IP（Source IP）&lt;/a&gt;：&lt;/strong&gt;
一些云厂商在传输数据包到节点时使用负载均衡器的 IP 地址作为源 IP。在 kube-proxy 的 ipvs 模式下，
存在负载均衡器健康检查永远不会返回的问题。原因是回复的数据包被转发到本地网络接口 &lt;code&gt;kube-ipvs0&lt;/code&gt;（绑定负载均衡器 IP 的接口）上并被忽略。&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- 
2. **[Feature loss at load balancer level](https://github.com/kubernetes/kubernetes/issues/66607):**
    Certain cloud providers offer features(such as TLS termination, proxy protocol, etc.) at the
    load balancer level.
    Bypassing the load balancer results in the loss of these features when the packet reaches the service
    (leading to protocol errors). 
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/66607&#34;&gt;负载均衡器层功能缺失&lt;/a&gt;：&lt;/strong&gt;
某些云厂商在负载均衡器层提供了部分特性（例如 TLS 终结、协议代理等）。
绕过负载均衡器会导致当数据包抵达后端服务时这些特性不会生效（导致协议错误等）。&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- 
Even with the new alpha behaviour disabled (the default), there is a 
[workaround](https://github.com/kubernetes/kubernetes/issues/66607#issuecomment-474513060) 
that involves setting `.status.loadBalancer.ingress.hostname` for the Service, in order 
to bypass kube-proxy binding. 
But this is just a makeshift solution. 
--&gt;
&lt;p&gt;即使新的 Alpha 特性默认关闭，也有&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/66607#issuecomment-474513060&#34;&gt;临时解决方案&lt;/a&gt;，
即为 Service 设置 &lt;code&gt;.status.loadBalancer.ingress.hostname&lt;/code&gt; 以绕过 kube-proxy 绑定。
但这终究只是临时解决方案。&lt;/p&gt;
&lt;!-- 
## Solution 
--&gt;
&lt;h2 id=&#34;解决方案&#34;&gt;解决方案&lt;/h2&gt;
&lt;!-- 
In summary, providing an option for cloud providers to disable the current behavior would be highly beneficial. 
--&gt;
&lt;p&gt;总之，为云厂商提供选项以禁用当前这种行为大有裨益。&lt;/p&gt;
&lt;!-- 
To address this, Kubernetes v1.29 introduces a new (alpha) `.status.loadBalancer.ingress.ipMode` 
field for a Service.
This field specifies how the load balancer IP behaves and can be specified only when 
the `.status.loadBalancer.ingress.ip` field is also specified. 
--&gt;
&lt;p&gt;Kubernetes 1.29 版本为 Service 引入新的 Alpha 字段 &lt;code&gt;.status.loadBalancer.ingress.ipMode&lt;/code&gt; 以解决上述问题。
该字段指定负载均衡器 IP 的运行方式，并且只有在指定 &lt;code&gt;.status.loadBalancer.ingress.ip&lt;/code&gt; 字段时才能指定。&lt;/p&gt;
&lt;!-- 
Two values are possible for `.status.loadBalancer.ingress.ipMode`: `&#34;VIP&#34;` and `&#34;Proxy&#34;`.
The default value is &#34;VIP&#34;, meaning that traffic delivered to the node 
with the destination set to the load balancer&#39;s IP and port will be redirected to the backend service by kube-proxy.
This preserves the existing behavior of kube-proxy. 
The &#34;Proxy&#34; value is intended to prevent kube-proxy from binding the load balancer&#39;s IP address 
to the node in both ipvs and iptables modes. 
Consequently, traffic is sent directly to the load balancer and then forwarded to the destination node. 
The destination setting for forwarded packets varies depending on how the cloud provider&#39;s load balancer delivers traffic: 
--&gt;
&lt;p&gt;&lt;code&gt;.status.loadBalancer.ingress.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;。
默认值为 &lt;code&gt;VIP&lt;/code&gt;，即目标 IP 设置为负载均衡 IP 和端口并发送到节点的流量会被 kube-proxy 重定向到后端服务。
这种方式保持 kube-proxy 现有行为模式。&lt;code&gt;Proxy&lt;/code&gt; 用于阻止 kube-proxy 在 ipvs 和 iptables 模式下绑定负载均衡 IP 地址到节点。
此时，流量会直达负载均衡器然后被重定向到目标节点。转发数据包的目的值配置取决于云厂商的负载均衡器如何传输流量。&lt;/p&gt;
&lt;!-- 
- If the traffic is delivered to the node then DNATed to the pod, the destination would be set to the node&#39;s IP and node port;
- If the traffic is delivered directly to the pod, the destination would be set to the pod&#39;s IP and port. 
--&gt;
&lt;ul&gt;
&lt;li&gt;如果流量被发送到节点然后通过目标地址转换（&lt;code&gt;DNAT&lt;/code&gt;）的方式到达 Pod，目的地应当设置为节点和 IP 和端口；&lt;/li&gt;
&lt;li&gt;如果流量被直接转发到 Pod，目的地应当被设置为 Pod 的 IP 和端口。&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- 
## Usage 
--&gt;
&lt;h2 id=&#34;用法&#34;&gt;用法&lt;/h2&gt;
&lt;!-- 
Here are the necessary steps to enable this feature: 
--&gt;
&lt;p&gt;开启该特性的必要步骤：&lt;/p&gt;
&lt;!-- 
- Download the [latest Kubernetes project](https://kubernetes.io/releases/download/) (version `v1.29.0` or later).
- Enable the feature gate with the command line flag `--feature-gates=LoadBalancerIPMode=true` 
on kube-proxy, kube-apiserver, and cloud-controller-manager.
- For Services with `type: LoadBalancer`, set `ipMode` to the appropriate value. 
This step is likely handled by your chosen cloud-controller-manager during the `EnsureLoadBalancer` process. 
--&gt;
&lt;ul&gt;
&lt;li&gt;下载 &lt;a href=&#34;https://kubernetes.io/releases/download/&#34;&gt;Kubernetes 最新版本&lt;/a&gt;（&lt;code&gt;v1.29.0&lt;/code&gt; 或更新）。&lt;/li&gt;
&lt;li&gt;通过命令行参数 &lt;code&gt;--feature-gates=LoadBalancerIPMode=true&lt;/code&gt; 在 kube-proxy、kube-apiserver 和
cloud-controller-manager 开启特性门控。&lt;/li&gt;
&lt;li&gt;对于 &lt;code&gt;type: LoadBalancer&lt;/code&gt; 类型的 Service，将 &lt;code&gt;ipMode&lt;/code&gt; 设置为合适的值。
这一步可能由你在 &lt;code&gt;EnsureLoadBalancer&lt;/code&gt; 过程中选择的 cloud-controller-manager 进行处理。&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- 
## More information 
--&gt;
&lt;h2 id=&#34;更多信息&#34;&gt;更多信息&lt;/h2&gt;
&lt;!-- 
- Read [Specifying IPMode of load balancer status](/docs/concepts/services-networking/service/#load-balancer-ip-mode).
- Read [KEP-1860](https://kep.k8s.io/1860) - [Make Kubernetes aware of the LoadBalancer behaviour](https://github.com/kubernetes/enhancements/tree/b103a6b0992439f996be4314caf3bf7b75652366/keps/sig-network/1860-kube-proxy-IP-node-binding#kep-1860-make-kubernetes-aware-of-the-loadbalancer-behaviour) _(sic)_.
 --&gt;
&lt;ul&gt;
&lt;li&gt;阅读&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/services-networking/service/#load-balancer-ip-mode&#34;&gt;指定负载均衡器状态的 IPMode&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;阅读 &lt;a href=&#34;https://kep.k8s.io/1860&#34;&gt;KEP-1860&lt;/a&gt; - &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/b103a6b0992439f996be4314caf3bf7b75652366/keps/sig-network/1860-kube-proxy-IP-node-binding#kep-1860-make-kubernetes-aware-of-the-loadbalancer-behaviour&#34;&gt;让 Kubernetes 感知负载均衡器的行为&lt;/a&gt; &lt;em&gt;(sic)&lt;/em&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- 
## Getting involved 
--&gt;
&lt;h2 id=&#34;联系我们&#34;&gt;联系我们&lt;/h2&gt;
&lt;!-- 
Reach us on [Slack](https://slack.k8s.io/): [#sig-network](https://kubernetes.slack.com/messages/sig-network), 
or through the [mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-network).
 --&gt;
&lt;p&gt;通过 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;Slack&lt;/a&gt; 频道 &lt;a href=&#34;https://kubernetes.slack.com/messages/sig-network&#34;&gt;#sig-network&lt;/a&gt;,
或者通过&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-network&#34;&gt;邮件列表&lt;/a&gt;联系我们。&lt;/p&gt;
&lt;!-- 
## Acknowledgments 
--&gt;
&lt;h2 id=&#34;特别鸣谢&#34;&gt;特别鸣谢&lt;/h2&gt;
&lt;!-- 
Huge thanks to [@Sh4d1](https://github.com/Sh4d1) for the original KEP and initial implementation code. 
I took over midway and completed the work. Similarly, immense gratitude to other contributors 
who have assisted in the design, implementation, and review of this feature (alphabetical order): 
--&gt;
&lt;p&gt;非常感谢 &lt;a href=&#34;https://github.com/Sh4d1&#34;&gt;@Sh4d1&lt;/a&gt; 的原始提案和最初代码实现。
我中途接手并完成了这项工作。同样我们也向其他帮助设计、实现、审查特性代码的贡献者表示感谢（按首字母顺序排列）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/aojea&#34;&gt;@aojea&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/danwinship&#34;&gt;@danwinship&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/sftim&#34;&gt;@sftim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/tengqm&#34;&gt;@tengqm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/thockin&#34;&gt;@thockin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/wojtek-t&#34;&gt;@wojtek-t&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29：修改卷之 VolumeAttributesClass</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/15/kubernetes-1-29-volume-attributes-class/</link>
      <pubDate>Fri, 15 Dec 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/12/15/kubernetes-1-29-volume-attributes-class/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.29: VolumeAttributesClass for Volume Modification&#34;
date: 2023-12-15
slug: kubernetes-1-29-volume-attributes-class
--&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/carlory&#34;&gt;Baofa Fan&lt;/a&gt; (DaoCloud)&lt;/p&gt;
&lt;!--
The v1.29 release of Kubernetes introduced an alpha feature to support modifying a volume
by changing the `volumeAttributesClassName` that was specified for a PersistentVolumeClaim (PVC).
With the feature enabled, Kubernetes can handle updates of volume attributes other than capacity.
Allowing volume attributes to be changed without managing it through different
provider&#39;s APIs directly simplifies the current flow.

You can read about VolumeAttributesClass usage details in the Kubernetes documentation 
or you can read on to learn about why the Kubernetes project is supporting this feature.
--&gt;
&lt;p&gt;Kubernetes v1.29 版本引入了一个 Alpha 功能，支持通过变更 PersistentVolumeClaim（PVC）的
&lt;code&gt;volumeAttributesClassName&lt;/code&gt; 字段来修改卷。启用该功能后，Kubernetes 可以处理除容量以外的卷属性的更新。
允许更改卷属性，而无需通过不同提供商的 API 对其进行管理，这直接简化了当前流程。&lt;/p&gt;
&lt;p&gt;你可以在 Kubernetes 文档中，阅读有关 VolumeAttributesClass 的详细使用信息，或者继续阅读了解
Kubernetes 项目为什么支持此功能。&lt;/p&gt;
&lt;h2 id=&#34;volumeattributesclass&#34;&gt;VolumeAttributesClass&lt;/h2&gt;
&lt;!--
The new `storage.k8s.io/v1alpha1` API group provides two new types:
--&gt;
&lt;p&gt;新的 &lt;code&gt;storage.k8s.io/v1alpha1&lt;/code&gt; API 组提供了两种新类型：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VolumeAttributesClass&lt;/strong&gt;&lt;/p&gt;
&lt;!-- 
Represents a specification of mutable volume attributes defined by the CSI driver.
The class can be specified during dynamic provisioning of PersistentVolumeClaims,
and changed in the PersistentVolumeClaim spec after provisioning. 
--&gt;
&lt;p&gt;表示由 CSI 驱动程序定义的可变卷属性的规约。你可以在 PersistentVolumeClaim 动态制备时指定它，
并且允许在制备完成后在 PersistentVolumeClaim 规约中进行更改。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ModifyVolumeStatus&lt;/strong&gt;&lt;/p&gt;
&lt;!--
Represents the status object of `ControllerModifyVolume` operation.
--&gt;
&lt;p&gt;表示 &lt;code&gt;ControllerModifyVolume&lt;/code&gt; 操作的状态对象。&lt;/p&gt;
&lt;!--
With this alpha feature enabled, the spec of PersistentVolumeClaim defines VolumeAttributesClassName
that is used in the PVC. At volume provisioning, the `CreateVolume` operation will apply the parameters in the
VolumeAttributesClass along with the parameters in the StorageClass.
--&gt;
&lt;p&gt;启用此 Alpha 功能后，PersistentVolumeClaim 的 &lt;code&gt;spec.VolumeAttributesClassName&lt;/code&gt; 字段指明了在 PVC 中使用的 VolumeAttributesClass。
在制备卷时，&lt;code&gt;CreateVolume&lt;/code&gt; 操作将应用 VolumeAttributesClass 中的参数以及 StorageClass 中的参数。&lt;/p&gt;
&lt;!--
When there is a change of volumeAttributesClassName in the PVC spec,
the external-resizer sidecar will get an informer event. Based on the current state of the configuration,
the resizer will trigger a CSI ControllerModifyVolume.
More details can be found in [KEP-3751](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md).
--&gt;
&lt;p&gt;当 PVC 的 &lt;code&gt;spec.VolumeAttributesClassName&lt;/code&gt; 发生变化时，external-resizer sidecar 将会收到一个 informer 事件。
基于当前的配置状态，resizer 将触发 CSI ControllerModifyVolume。更多细节可以在
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/3751-volume-attributes-class/README.md&#34;&gt;KEP-3751&lt;/a&gt; 中找到。&lt;/p&gt;
&lt;!--
## How to use it

If you want to test the feature whilst it&#39;s alpha, you need to enable the relevant feature gate
in the `kube-controller-manager` and the `kube-apiserver`. Use the `--feature-gates` command line argument:
--&gt;
&lt;h2 id=&#34;如何使用它&#34;&gt;如何使用它&lt;/h2&gt;
&lt;p&gt;如果你想在 Alpha 版本中测试该功能，需要在 &lt;code&gt;kube-controller-manager&lt;/code&gt; 和 &lt;code&gt;kube-apiserver&lt;/code&gt; 中启用相关的特性门控。
使用 &lt;code&gt;--feature-gates&lt;/code&gt; 命令行参数：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;--feature-gates=&amp;#34;...,VolumeAttributesClass=true&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;!--
It also requires that the CSI driver has implemented the ModifyVolume API.
--&gt;
&lt;p&gt;它还需要 CSI 驱动程序实现 ModifyVolume API。&lt;/p&gt;
&lt;!-- 
### User flow

If you would like to see the feature in action and verify it works fine in your cluster, here&#39;s what you can try:
--&gt;
&lt;h3 id=&#34;用户流程&#34;&gt;用户流程&lt;/h3&gt;
&lt;p&gt;如果你想看到该功能的运行情况，并验证它在你的集群中是否正常工作，可以尝试以下操作：&lt;/p&gt;
&lt;!-- 
1. Define a StorageClass and VolumeAttributesClass
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定义 StorageClass 和 VolumeAttributesClass&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;StorageClass&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;csi-sc-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;provisioner&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;pd.csi.storage.gke.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;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;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;hyperdisk-balanced&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;volumeBindingMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;WaitForFirstConsumer&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;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;pd.csi.storage.gke.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;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;3000&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;50&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;/li&gt;
&lt;/ol&gt;
&lt;!-- 
2. Define and create the PersistentVolumeClaim
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;定义并创建 PersistentVolumeClaim&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;csi-sc-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;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;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Verify that the PersistentVolumeClaim is now provisioned correctly with:
--&gt; 
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;验证 PersistentVolumeClaim 是否已正确制备：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl get pvc
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
4. Create a new VolumeAttributesClass gold:
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;创建一个新的名为 gold 的 VolumeAttributesClass：&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;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;pd.csi.storage.gke.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;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;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;4000&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;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;60&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;/li&gt;
&lt;/ol&gt;
&lt;!--
5. Update the PVC with the new VolumeAttributesClass and apply:
--&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;
&lt;p&gt;使用新的 VolumeAttributesClass 更新 PVC 并应用：&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;csi-sc-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;volumeAttributesClassName&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;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;/li&gt;
&lt;/ol&gt;
&lt;!--
6. Verify that PersistentVolumeClaims has the updated VolumeAttributesClass parameters with:
--&gt;
&lt;ol start=&#34;6&#34;&gt;
&lt;li&gt;
&lt;p&gt;验证 PersistentVolumeClaims 是否具有更新的 VolumeAttributesClass 参数：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl describe pvc &amp;lt;PVC_NAME&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## Next steps

* See the [VolumeAttributesClass KEP](https://kep.k8s.io/3751) for more information on the design
* You can view or comment on the [project board](https://github.com/orgs/kubernetes-csi/projects/72) for VolumeAttributesClass
* In order to move this feature towards beta, we need feedback from the community,
  so here&#39;s a call to action: add support to the CSI drivers, try out this feature,
  consider how it can help with problems that your users are having…
--&gt;
&lt;h2 id=&#34;后续步骤&#34;&gt;后续步骤&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;有关设计的更多信息，请参阅 &lt;a href=&#34;https://kep.k8s.io/3751&#34;&gt;VolumeAttributesClass KEP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;你可以在&lt;a href=&#34;https://github.com/orgs/kubernetes-csi/projects/72&#34;&gt;项目看板&lt;/a&gt;上查看或评论 VolumeAttributesClass&lt;/li&gt;
&lt;li&gt;为了将此功能推向 Beta 版本，我们需要社区的反馈，因此这里有一个行动倡议：为 CSI 驱动程序添加支持，
尝试此功能，考虑它如何帮助解决你的用户遇到的问题...&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Getting involved

We always welcome new contributors. So, if you would like to get involved, you can join our [Kubernetes Storage Special Interest Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG).
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&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;/p&gt;
&lt;!--
If you would like to share feedback, you can do so on our [public Slack channel](https://app.slack.com/client/T09NY5SBT/C09QZFCE5).
--&gt;
&lt;p&gt;如果你想分享反馈意见，可以在我们的&lt;a href=&#34;https://app.slack.com/client/T09NY5SBT/C09QZFCE5&#34;&gt;公共 Slack 频道&lt;/a&gt; 上留言。&lt;/p&gt;
&lt;!--
Special thanks to all the contributors that provided great reviews, shared valuable insight and helped implement this feature (alphabetical order):
--&gt;
&lt;p&gt;特别感谢所有为此功能提供了很好的评论、分享了宝贵见解并帮助实现此功能的贡献者（按字母顺序）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Baofa Fan (calory)&lt;/li&gt;
&lt;li&gt;Ben Swartzlander (bswartz)&lt;/li&gt;
&lt;li&gt;Connor Catlett (ConnorJC3)&lt;/li&gt;
&lt;li&gt;Hemant Kumar (gnufied)&lt;/li&gt;
&lt;li&gt;Jan Šafránek (jsafrane)&lt;/li&gt;
&lt;li&gt;Joe Betz (jpbetz)&lt;/li&gt;
&lt;li&gt;Jordan Liggitt (liggitt)&lt;/li&gt;
&lt;li&gt;Matthew Cary (mattcary)&lt;/li&gt;
&lt;li&gt;Michelle Au (msau42)&lt;/li&gt;
&lt;li&gt;Xing Yang (xing-yang)&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>聚焦 SIG Testing</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/24/sig-testing-spotlight-2023/</link>
      <pubDate>Fri, 24 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/24/sig-testing-spotlight-2023/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Testing&#34;
slug: sig-testing-spotlight-2023
date: 2023-11-24
canonicalUrl: https://www.kubernetes.dev/blog/2023/11/24/sig-testing-spotlight-2023/
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Sandipan Panda&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; &lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt;&lt;/p&gt;
&lt;!--
Welcome to another edition of the _SIG spotlight_ blog series, where we
highlight the incredible work being done by various Special Interest
Groups (SIGs) within the Kubernetes project. In this edition, we turn
our attention to [SIG Testing](https://github.com/kubernetes/community/tree/master/sig-testing#readme),
a group interested in effective testing of Kubernetes and automating
away project toil. SIG Testing focus on creating and running tools and
infrastructure that make it easier for the community to write and run
tests, and to contribute, analyze and act upon test results.
--&gt;
&lt;p&gt;欢迎阅读又一期的 “SIG 聚光灯” 系列博客，这些博客重点介绍 Kubernetes
项目中各个特别兴趣小组（SIG）所从事的令人赞叹的工作。这篇博客将聚焦
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-testing#readme&#34;&gt;SIG Testing&lt;/a&gt;，
这是一个致力于有效测试 Kubernetes，让此项目的繁琐工作实现自动化的兴趣小组。
SIG Testing 专注于创建和运行工具和基础设施，使社区更容易编写和运行测试，并对测试结果做贡献、分析和处理。&lt;/p&gt;
&lt;!--
To gain some insights into SIG Testing, [Sandipan
Panda](https://github.com/sandipanpanda) spoke with [Michelle Shepardson](https://github.com/michelle192837),
a senior software engineer at Google and a chair of SIG Testing, and
[Patrick Ohly](https://github.com/pohly), a software engineer and architect at
Intel and a SIG Testing Tech Lead.
--&gt;
&lt;p&gt;为了深入了解 SIG Testing 的情况，
&lt;a href=&#34;https://github.com/sandipanpanda&#34;&gt;Sandipan Panda&lt;/a&gt;
采访了 Google 高级软件工程师兼 SIG Testing 主席
&lt;a href=&#34;https://github.com/michelle192837&#34;&gt;Michelle Shepardson&lt;/a&gt;
以及英特尔软件工程师、架构师兼 SIG Testing 技术负责人
&lt;a href=&#34;https://github.com/pohly&#34;&gt;Patrick Ohly&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Meet the contributors

**Sandipan:** Could you tell us a bit about yourself, your role, and
how you got involved in the Kubernetes project and SIG Testing?
--&gt;
&lt;h2 id=&#34;meet-the-contributors&#34;&gt;会见贡献者  &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 你能简单介绍一下自己吗，谈谈你的职责角色以及你是如何参与
Kubernetes 项目和 SIG Testing 的？&lt;/p&gt;
&lt;!--
**Michelle:** Hi! I&#39;m Michelle, a senior software engineer at
Google. I first got involved in Kubernetes through working on tooling
for SIG Testing, like the external instance of TestGrid. I&#39;m part of
oncall for TestGrid and Prow, and am now a chair for the SIG.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 嗨！我是 Michelle，是 Google 高级软件工程师。
我最初是为 SIG Testing 开发工具（如 TestGrid 的外部实例）而参与到 Kubernetes 项目的。
我是 TestGrid 和 Prow 的轮值人员，现在也是这个 SIG 的主席。&lt;/p&gt;
&lt;!--
**Patrick:** Hello! I work as a software engineer and architect in a
team at Intel which focuses on open source Cloud Native projects. When
I ramped up on Kubernetes to develop a storage driver, my very first
question was &#34;how do I test it in a cluster and how do I log
information?&#34; That interest led to various enhancement proposals until
I had (re)written enough code that also took over official roles as
SIG Testing Tech Lead (for the [E2E framework](https://github.com/kubernetes-sigs/e2e-framework)) and
structured logging WG lead.
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 你好！我在英特尔的一个团队中担任软件工程师和架构师，专注于开源云原生项目。
当我开始学习 Kubernetes 开发存储驱动时，我最初的问题是“如何在集群中进行测试以及如何记录信息？”
这个兴趣点引发了各种增强提案，直到我（重新）编写了足够多的代码，也正式担任了 SIG Testing 技术负责人
（负责 &lt;a href=&#34;https://github.com/kubernetes-sigs/e2e-framework&#34;&gt;E2E 框架&lt;/a&gt;）兼结构化日志工作组负责人。&lt;/p&gt;
&lt;!--
## Testing practices and tools

**Sandipan:** Testing is a field in which multiple approaches and
tools exist; how did you arrive at the existing practices?
--&gt;
&lt;h2 id=&#34;testing-practices-and-tools&#34;&gt;测试实践和工具   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 测试是一个存在多种方法和工具的领域，你们是如何形成现有实践方式的？&lt;/p&gt;
&lt;!--
**Patrick:** I can’t speak about the early days because I wasn’t
around yet 😆, but looking back at some of the commit history it’s
pretty obvious that developers just took what was available and
started using it. For E2E testing, that was
[Ginkgo+Gomega](https://github.com/onsi/ginkgo). Some hacks were
necessary, for example around cleanup after a test run and for
categorising tests. Eventually this led to Ginkgo v2 and [revised best
practices for E2E testing](https://www.kubernetes.dev/blog/2023/04/12/e2e-testing-best-practices-reloaded/).
Regarding unit testing opinions are pretty diverse: some maintainers
prefer to use just the Go standard library with hand-written
checks. Others use helper packages like stretchr/testify. That
diversity is okay because unit tests are self-contained - contributors
just have to be flexible when working on many different areas.
Integration testing falls somewhere in the middle. It’s based on Go
unit tests, but needs complex helper packages to bring up an apiserver
and other components, then runs tests that are more like E2E tests.
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 我没法谈论早期情况，因为那时我还未参与其中 😆，但回顾一些提交历史可以明显看出，
当时开发人员只是看看有什么可用的工具并开始使用这些工具。对于 E2E 测试来说，使用的是
&lt;a href=&#34;https://github.com/onsi/ginkgo&#34;&gt;Ginkgo + Gomega&lt;/a&gt;。集成一些黑科技是必要的，
例如在测试运行后进行清理和对测试进行分类。最终形成了 Ginkgo v2
和&lt;a href=&#34;https://www.kubernetes.dev/blog/2023/04/12/e2e-testing-best-practices-reloaded/&#34;&gt;重新修订的 E2E 测试最佳实践&lt;/a&gt;。
关于单元测试，意见非常多样化：一些维护者倾向于只使用 Go 标准库和手动检查。
而其他人使用 stretchr/testify 这类辅助工具包。这种多样性是可以接受的，因为单元测试是自包含的：
贡献者只需在处理许多不同领域时保持灵活。集成测试介于二者之间，它基于 Go 单元测试，
但需要复杂的辅助工具包来启动 API 服务器和其他组件，然后运行更像是 E2E 测试的测试。&lt;/p&gt;
&lt;!--
## Subprojects owned by SIG Testing

**Sandipan:** SIG Testing is pretty diverse. Can you give a brief
overview of the various subprojects owned by SIG Testing?
--&gt;
&lt;h2 id=&#34;subprojects-owned-by-sig-testing&#34;&gt;SIG Testing 拥有的子项目   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; SIG Testing 非常多样化。你能简要介绍一下 SIG Testing 拥有的各个子项目吗？&lt;/p&gt;
&lt;!--
**Michelle:** Broadly, we have subprojects related to testing
frameworks, and infrastructure, though they definitely overlap.  So
for the former, there&#39;s
[e2e-framework](https://pkg.go.dev/sigs.k8s.io/e2e-framework) (used
externally),
[test/e2e/framework](https://pkg.go.dev/k8s.io/kubernetes/test/e2e/framework)
(used for Kubernetes itself) and kubetest2 for end-to-end testing,
as well as boskos (resource rental for e2e tests),
[KIND](https://kind.sigs.k8s.io/) (Kubernetes-in-Docker, for local
testing and development), and the cloud provider for KIND.  For the
latter, there&#39;s [Prow](https://docs.prow.k8s.io/) (K8s-based CI/CD and
chatops), and a litany of other tools and utilities for triage,
analysis, coverage, Prow/TestGrid config generation, and more in the
test-infra repo.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 广义上来说，我们拥有与测试框架相关的子项目和基础设施，尽管它们肯定存在重叠。
我们的子项目包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://pkg.go.dev/sigs.k8s.io/e2e-framework&#34;&gt;e2e-framework&lt;/a&gt;（外部使用）&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://pkg.go.dev/k8s.io/kubernetes/test/e2e/framework&#34;&gt;test/e2e/framework&lt;/a&gt;
（用于 Kubernetes 本身）&lt;/li&gt;
&lt;li&gt;kubetest2（用于端到端测试）&lt;/li&gt;
&lt;li&gt;boskos（用于 e2e 测试的资源租赁）&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kind.sigs.k8s.io/&#34;&gt;KIND&lt;/a&gt;（在 Docker 中运行 Kubernetes，用于本地测试和开发）&lt;/li&gt;
&lt;li&gt;以及 KIND 的云驱动。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;我们的基础设施包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.prow.k8s.io/&#34;&gt;Prow&lt;/a&gt;（基于 K8s 的 CI/CD 和 chatops）&lt;/li&gt;
&lt;li&gt;test-infra 仓库中用于分类、分析、覆盖率、Prow/TestGrid 配置生成等的其他工具和实用程序。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
*If you are willing to learn more and get involved with any of the SIG
Testing subprojects, check out the [SIG Testing README](https://github.com/kubernetes/community/tree/master/sig-testing#subprojects).*
--&gt;
&lt;p&gt;&lt;strong&gt;如果你有兴趣了解更多并参与到 SIG Testing 的任何子项目中，查阅
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-testing#subprojects&#34;&gt;SIG Testing 的 README&lt;/a&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;!--
## Key challenges and accomplishments

**Sandipan:** What are some of the key challenges you face?
--&gt;
&lt;h2 id=&#34;key-challenges-and-accomplishments&#34;&gt;主要挑战和成就   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 你们面临的一些主要挑战是什么？&lt;/p&gt;
&lt;!--
**Michelle:** Kubernetes is a gigantic project in every aspect, from
contributors to code to users and more. Testing and infrastructure
have to meet that scale, keeping up with every change from every repo
under Kubernetes while facilitating developing, improving, and
releasing the project as much as possible, though of course, we&#39;re not
the only SIG involved in that.  I think another other challenge is
staffing subprojects. SIG Testing has a number of subprojects that
have existed for years, but many of the original maintainers for them
have moved on to other areas or no longer have the time to maintain
them. We need to grow long-term expertise and owners in those
subprojects.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; Kubernetes 从贡献者到代码再到用户等各方面看都是一个庞大的项目。
测试和基础设施必须满足这种规模，跟上 Kubernetes 每个仓库的所有变化，
同时尽可能地促进开发、改进和发布项目，尽管当然我们并不是唯一参与其中的 SIG。
我认为另一个挑战是子项目的人员配置。SIG Testing 有一些已经存在多年的子项目，
但其中许多最初的维护者已经转到其他领域或者没有时间继续维护它们。
我们需要在这些子项目中培养长期的专业知识和 Owner。&lt;/p&gt;
&lt;!--
**Patrick:** As Michelle said, the sheer size can be a challenge. It’s
not just the infrastructure, also our processes must scale with the
number of contributors. It’s good to document best practices, but not
good enough: we have many new contributors, which is good, but having
reviewers explain best practices doesn’t scale - assuming that the
reviewers even know about them! It also doesn’t help that existing
code cannot get updated immediately because there is so much of it, in
particular for E2E testing. The initiative to [apply stricter linting to new or modified code](https://groups.google.com/a/kubernetes.io/g/dev/c/myGiml72IbM/m/QdO5bgQiAQAJ)
while accepting that existing code doesn’t pass those same linter
checks helps a bit.
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 正如 Michelle 所说，规模本身可能就是一个挑战。
不仅基础设施要与之匹配，我们的流程也必须与贡献者数量相匹配。
记录最佳实践是好的，但还不够好：我们有许多新的贡献者，这是好事，
但是让 Reviewer 靠人工解释最佳实践并不可行，这前提是 Reviewer 了解这些最佳实践！
如果现有代码不能被立即更新也无济于事，因为代码实在太多了，特别是对于 E2E 测试来说更是如此。
在接受现有代码无法通过同样的 linter 检查的同时，
&lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/dev/c/myGiml72IbM/m/QdO5bgQiAQAJ&#34;&gt;为新代码或代码修改应用更严格的 lint 检查&lt;/a&gt;对于改善情况会有所帮助。&lt;/p&gt;
&lt;!--
**Sandipan:** Any SIG accomplishments that you are proud of and would
like to highlight?
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 有没有一些 SIG 成就使你感到自豪，想要重点说一下？&lt;/p&gt;
&lt;!--
**Patrick:** I am biased because I have been driving this, but I think
that the [E2E framework](https://github.com/kubernetes-sigs/e2e-framework) and linting are now in a much better shape than
they used to be. We may soon be able to run integration tests with
race detection enabled, which is important because we currently only
have that for unit tests and those tend to be less complex.
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 我有一些拙见，因为我一直在推动这个项目，但我认为现在
&lt;a href=&#34;https://github.com/kubernetes-sigs/e2e-framework&#34;&gt;E2E 框架&lt;/a&gt;和 lint 机制比以前好得多。
我们可能很快就能在启用竞争检测的情况下运行集成测试，这很重要，
因为目前我们只能对单元测试进行竞争检测，而那些往往不太复杂。&lt;/p&gt;
&lt;!--
**Sandipan:** Testing is always important, but is there anything
specific to your work in terms of the Kubernetes release process?
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 测试始终很重要，但在 Kubernetes 发布过程中，你的工作是否有任何特殊之处？&lt;/p&gt;
&lt;!--
**Patrick:** [test flakes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/flaky-tests.md)…
if we have too many of those, development velocity goes down because
PRs cannot be merged without clean test runs and those become less
likely. Developers also lose trust in testing and just &#34;retest&#34; until
they have a clean run, without checking whether failures might indeed
be related to a regression in their current change.
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; &lt;a href=&#34;https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/flaky-tests.md&#34;&gt;测试不稳定&lt;/a&gt;……
如果我们有太多这样的不稳定测试，开发速度就会下降，因为我们无法在没有干净测试运行环境的情况下合并 PR，
并且这些环境会越来越少。开发者也会失去对测试的信任，只是“重新测试”直到有了一个干净的运行环境为止，
而不会检查失败是否确实与当前更改中的回归有关。&lt;/p&gt;
&lt;!--
## The people and the scope

**Sandipan:** What are some of your favourite things about this SIG?
--&gt;
&lt;h2 id=&#34;the-people-and-the-scope&#34;&gt;人员和范围   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 这个 SIG 中有哪些让你热爱的？&lt;/p&gt;
&lt;!--
**Michelle:** The people, of course 🙂. Aside from that, I like the
broad scope SIG Testing has. I feel like even small changes can make a
big difference for fellow contributors, and even if my interests
change over time, I&#39;ll never run out of projects to work on.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 当然是人 🙂。除此之外，我喜欢 SIG Testing 的宽广范围。
我觉得即使是小的改动也可以对其他贡献者产生重大影响，即使随着时间的推移我的兴趣发生变化，
我也永远不会缺少项目可供我参与。&lt;/p&gt;
&lt;!--
**Patrick:** I can work on things that make my life and the life of my
fellow developers better, like the tooling that we have to use every
day while working on some new feature elsewhere.

**Sandipan:** Are there any funny / cool / TIL anecdotes that you
could tell us?
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 我的工作是为了让我和其他开发人员的工作变得更好，
比如建设在其他地方开发新特性时每天必须使用的工具。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 你们有没有任何好玩/酷炫/日常趣事可以告诉我们？&lt;/p&gt;
&lt;!--
**Patrick:** I started working on E2E framework enhancements five
years ago, then was less active there for a while. When I came back
and wanted to test some new enhancement, I asked about how to write
unit tests for the new code and was pointed to some existing tests
which looked vaguely familiar, as if I had *seen* them before. I
looked at the commit history and found that I had *written* them! I’ll
let you decide whether that says something about my failing long-term
memory or simply is normal… Anyway, folks, remember to write good
commit messages and comments; someone will need them at some point -
it might even be yourself!
--&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 五年前，我开始致力于 E2E 框架的增强，然后在一段时间内参与活动较少。
当我回来并想要测试一些新的增强功能时，我询问如何为新代码编写单元测试，
并被指向了一些看起来有些熟悉的、好像以前&lt;strong&gt;见过&lt;/strong&gt;的现有测试。
我查看了提交历史，发现这些测试是我自己&lt;strong&gt;编写的&lt;/strong&gt;！
你可以决定这是否说明了我的长期记忆力衰退还是这很正常...
无论如何，伙计们，要谨记让每个 Commit 的消息和注释明确、友好；
某一刻会有人需要看这些消息和注释 - 甚至可能就是你自己！&lt;/p&gt;
&lt;!--
## Looking ahead

**Sandipan:** What areas and/or subprojects does your SIG need help with?
--&gt;
&lt;h2 id=&#34;looking-ahead&#34;&gt;展望未来   &lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 在哪些领域和/或子项目上，你们的 SIG 需要帮助？&lt;/p&gt;
&lt;!--
**Michelle:** Some subprojects aren&#39;t staffed at the moment and could
use folks willing to learn more about
them. [boskos](https://github.com/kubernetes-sigs/boskos#boskos) and
[kubetest2](https://github.com/kubernetes-sigs/kubetest2#kubetest2)
especially stand out to me, since both are important for testing but
lack dedicated owners.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 目前有一些子项目没有人员配置，需要有意愿了解更多的人参与进来。
&lt;a href=&#34;https://github.com/kubernetes-sigs/boskos#boskos&#34;&gt;boskos&lt;/a&gt; 和
&lt;a href=&#34;https://github.com/kubernetes-sigs/kubetest2#kubetest2&#34;&gt;kubetest2&lt;/a&gt; 对我来说尤其突出，
因为它们对于测试非常重要，但却缺乏专门的负责人。&lt;/p&gt;
&lt;!--
**Sandipan:** Are there any useful skills that new contributors to SIG
Testing can bring to the table? What are some things that people can
do to help this SIG if they come from a background that isn’t directly
linked to programming?
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; 新的 SIG Testing 贡献者可以带来哪些有用的技能？
如果他们的背景与编程没有直接关联，有哪些方面可以帮助到这个 SIG？&lt;/p&gt;
&lt;!--
**Michelle:** I think user empathy, writing clear feedback, and
recognizing patterns are really useful. Someone who uses the test
framework or tooling and can outline pain points with clear examples,
or who can recognize a wider issue in the project and pull data to
inform solutions for it.
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 我认为具备用户共情、清晰反馈和识别模式的能力非常有用。
有人使用测试框架或工具，并能用清晰的示例概述痛点，或者能够识别项目中的更广泛的问题并提供数据来支持解决方案。&lt;/p&gt;
&lt;!--
**Sandipan:** What’s next for SIG Testing?

**Patrick:** Stricter linting will soon become mandatory for new
code. There are several E2E framework sub-packages that could be
modernised, if someone wants to take on that work. I also see an
opportunity to unify some of our helper code for E2E and integration
testing, but that needs more thought and discussion.
--&gt;
&lt;p&gt;&lt;strong&gt;Sandipan:&lt;/strong&gt; SIG Testing 的下一步是什么？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Patrick:&lt;/strong&gt; 对于新代码，更严格的 lint 检查很快将成为强制要求。
如果有人愿意承担这项工作，我们可以对一些 E2E 框架的子工具包进行现代化改造。
我还看到一个机会，可以统一一些 E2E 和集成测试的辅助代码，但这需要更多的思考和讨论。&lt;/p&gt;
&lt;!--
**Michelle:** I&#39;m looking forward to making some usability
improvements for some of our tools and infra, and to supporting more
long-term contributions and growth of contributors into long-term
roles within the SIG. If you&#39;re interested, hit us up!
--&gt;
&lt;p&gt;&lt;strong&gt;Michelle:&lt;/strong&gt; 我期待为我们的工具和基础设施进行一些可用性改进，
并支持更多长期贡献者的贡献和成长，使他们在 SIG 中担任长期角色。如果你有兴趣，请联系我们！&lt;/p&gt;
&lt;!--
Looking ahead, SIG Testing has exciting plans in store. You can get in
touch with the folks at SIG Testing in their [Slack channel](https://kubernetes.slack.com/messages/sig-testing) or attend
one of their regular [bi-weekly meetings on Tuesdays](https://github.com/kubernetes/community/tree/master/sig-testing#meetings). If
you are interested in making it easier for the community to run tests
and contribute test results, to ensure Kubernetes is stable across a
variety of cluster configurations and cloud providers, join the SIG
Testing community today!
--&gt;
&lt;p&gt;展望未来，SIG Testing 有令人兴奋的计划。你可以通过他们的
&lt;a href=&#34;https://kubernetes.slack.com/messages/sig-testing&#34;&gt;Slack 频道&lt;/a&gt;与 SIG Testing 的人员取得联系，
或参加他们定期举行的&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-testing#meetings&#34;&gt;每两周的周二会议&lt;/a&gt;。
如果你有兴趣为社区更轻松地运行测试并贡献测试结果，确保 Kubernetes
在各种集群配置和云驱动中保持稳定，请立即加入 SIG Testing 社区！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.29 中的移除、弃用和主要变更</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/16/kubernetes-1-29-upcoming-changes/</link>
      <pubDate>Thu, 16 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/16/kubernetes-1-29-upcoming-changes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes Removals, Deprecations, and Major Changes in Kubernetes 1.29&#39;
date: 2023-11-16
slug: kubernetes-1-29-upcoming-changes
--&gt;
&lt;!--
**Authors:** Carol Valencia, Kristin Martin, Abigail McCarthy, James Quigley, Hosam Kamel
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Carol Valencia, Kristin Martin, Abigail McCarthy, James Quigley, Hosam Kamel&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者:&lt;/strong&gt; &lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt; (DaoCloud)&lt;/p&gt;
&lt;!--
As with every release, Kubernetes v1.29 will introduce feature deprecations and removals. Our continued ability to produce high-quality releases is a testament to our robust development cycle and healthy community. The following are some of the deprecations and removals coming in the Kubernetes 1.29 release.
--&gt;
&lt;p&gt;和其他每次发布一样，Kubernetes v1.29 将弃用和移除一些特性。
一贯以来生成高质量发布版本的能力是开发周期稳健和社区健康的证明。
下文列举即将发布的 Kubernetes 1.29 中的一些弃用和移除事项。&lt;/p&gt;
&lt;!--
## The Kubernetes API removal and deprecation process

The Kubernetes project has a well-documented 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 is one that 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 项目对特性有一个文档完备的弃用策略。此策略规定，只有当同一 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 deprecation.
* Alpha or experimental API versions may be removed in any release without prior deprecation notice.
--&gt;
&lt;ul&gt;
&lt;li&gt;正式发布（GA）或稳定的 API 版本可能被标记为已弃用，但只有在 Kubernetes 主版本变化时才会被移除。&lt;/li&gt;
&lt;li&gt;测试版（Beta）或预发布 API 版本在弃用后必须在后续 3 个版本中继续支持。&lt;/li&gt;
&lt;li&gt;Alpha 或实验性 API 版本可以在任何版本中被移除，不另行通知。&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 documentation.
--&gt;
&lt;p&gt;无论一个 API 是因为某特性从 Beta 进阶至稳定阶段而被移除，还是因为该 API 根本没有成功，
所有移除均遵从上述弃用策略。无论何时移除一个 API，文档中都会列出迁移选项。&lt;/p&gt;
&lt;!--
## A note about the k8s.gcr.io redirect to registry.k8s.io

To host its container images, the Kubernetes project uses a community-owned image registry called registry.k8s.io. Starting last March traffic to the old k8s.gcr.io registry began being redirected to registry.k8s.io. The deprecated k8s.gcr.io registry will eventually be phased out. For more details on this change or to see if you are impacted, please read [k8s.gcr.io Redirect to registry.k8s.io - What You Need to Know](/blog/2023/03/10/image-registry-redirect/).
--&gt;
&lt;h2 id=&#34;k8s-gcr-io-重定向到-registry-k8s-io-相关说明&#34;&gt;k8s.gcr.io 重定向到 registry.k8s.io 相关说明&lt;/h2&gt;
&lt;p&gt;Kubernetes 项目为了托管其容器镜像，使用社区自治的一个名为 registry.k8s.io 的镜像仓库。
从最近的 3 月份起，所有流向 k8s.gcr.io 旧仓库的请求开始被重定向到 registry.k8s.io。
已弃用的 k8s.gcr.io 仓库最终将被淘汰。有关这一变更的细节或若想查看你是否受到影响，参阅
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/03/10/image-registry-redirect/&#34;&gt;k8s.gcr.io 重定向到 registry.k8s.io - 用户须知&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## A note about the Kubernetes community-owned package repositories

Earlier in 2023, the Kubernetes project [introduced](/blog/2023/08/15/pkgs-k8s-io-introduction/) `pkgs.k8s.io`, community-owned software repositories for Debian and RPM packages. The community-owned repositories replaced the legacy Google-owned repositories (`apt.kubernetes.io` and `yum.kubernetes.io`).
On September 13, 2023, those legacy repositories were formally deprecated and their contents frozen.
--&gt;
&lt;h2 id=&#34;kubernetes-社区自治软件包仓库相关说明&#34;&gt;Kubernetes 社区自治软件包仓库相关说明&lt;/h2&gt;
&lt;p&gt;在 2023 年年初，Kubernetes 项目&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/15/pkgs-k8s-io-introduction/&#34;&gt;引入了&lt;/a&gt; &lt;code&gt;pkgs.k8s.io&lt;/code&gt;,
这是 Debian 和 RPM 软件包所用的社区自治软件包仓库。这些社区自治的软件包仓库取代了先前由 Google 管理的仓库
（&lt;code&gt;apt.kubernetes.io&lt;/code&gt; 和 &lt;code&gt;yum.kubernetes.io&lt;/code&gt;）。在 2023 年 9 月 13 日，这些老旧的仓库被正式弃用，其内容被冻结。&lt;/p&gt;
&lt;!--
For more information on this change or to see if you are impacted, please read the [deprecation announcement](/blog/2023/08/31/legacy-package-repository-deprecation/).
--&gt;
&lt;p&gt;有关这一变更的细节或你若想查看是否受到影响，
请参阅&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/&#34;&gt;弃用公告&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Deprecations and removals for Kubernetes v1.29

See the official list of [API removals](/docs/reference/using-api/deprecation-guide/#v1-29) for a full list of planned deprecations for Kubernetes v1.29.
--&gt;
&lt;h2 id=&#34;kubernetes-v1-29-的弃用和移除说明&#34;&gt;Kubernetes v1.29 的弃用和移除说明&lt;/h2&gt;
&lt;p&gt;有关 Kubernetes v1.29 计划弃用的完整列表，
参见官方 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/#v1-29&#34;&gt;API 移除&lt;/a&gt;列表。&lt;/p&gt;
&lt;!--
### Removal of in-tree integrations with cloud providers ([KEP-2395](https://kep.k8s.io/2395))

The [feature gates](/docs/reference/command-line-tools-reference/feature-gates/) `DisableCloudProviders` and `DisableKubeletCloudCredentialProviders` will both be set to `true` by default for Kubernetes v1.29. This change will require that users who are currently using in-tree cloud provider integrations (Azure, GCE, or vSphere) enable external cloud controller managers, or opt in to the legacy integration by setting the associated feature gates to `false`.
--&gt;
&lt;h3 id=&#34;移除与云驱动的内部集成-kep-2395-https-kep-k8s-io-2395&#34;&gt;移除与云驱动的内部集成（&lt;a href=&#34;https://kep.k8s.io/2395&#34;&gt;KEP-2395&lt;/a&gt;）&lt;/h3&gt;
&lt;p&gt;对于 Kubernetes v1.29，默认特性门控 &lt;code&gt;DisableCloudProviders&lt;/code&gt; 和 &lt;code&gt;DisableKubeletCloudCredentialProviders&lt;/code&gt;
都将被设置为 &lt;code&gt;true&lt;/code&gt;。这个变更将要求当前正在使用内部云驱动集成（Azure、GCE 或 vSphere）的用户启用外部云控制器管理器，
或者将关联的特性门控设置为 &lt;code&gt;false&lt;/code&gt; 以选择传统的集成方式。&lt;/p&gt;
&lt;!--
Enabling external cloud controller managers means you must run a suitable cloud controller manager within your cluster&#39;s control plane; it also requires setting the command line argument `--cloud-provider=external` for the kubelet (on every relevant node), and across the control plane (kube-apiserver and kube-controller-manager).
--&gt;
&lt;p&gt;启用外部云控制器管理器意味着你必须在集群的控制平面中运行一个合适的云控制器管理器；
同时还需要为 kubelet（在每个相关节点上）及整个控制平面（kube-apiserver 和 kube-controller-manager）
设置命令行参数 &lt;code&gt;--cloud-provider=external&lt;/code&gt;。&lt;/p&gt;
&lt;!--
For more information about how to enable and run external cloud controller managers, read [Cloud Controller Manager Administration](/docs/tasks/administer-cluster/running-cloud-controller/) and [Migrate Replicated Control Plane To Use Cloud Controller Manager](/docs/tasks/administer-cluster/controller-manager-leader-migration/).

For general information about cloud controller managers, please see
[Cloud Controller Manager](/docs/concepts/architecture/cloud-controller/) in the Kubernetes documentation.
--&gt;
&lt;p&gt;有关如何启用和运行外部云控制器管理器的细节，
参阅&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/running-cloud-controller/&#34;&gt;管理云控制器管理器&lt;/a&gt;和
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/controller-manager-leader-migration/&#34;&gt;迁移多副本的控制面以使用云控制器管理器&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;有关云控制器管理器的常规信息，请参阅 Kubernetes
文档中的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cloud-controller/&#34;&gt;云控制器管理器&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Removal of the `v1beta2` flow control API group

The _flowcontrol.apiserver.k8s.io/v1beta2_ API version of FlowSchema and PriorityLevelConfiguration will [no longer be served](/docs/reference/using-api/deprecation-guide/#v1-29) in Kubernetes v1.29. 

To prepare for this, you can edit your existing manifests and rewrite client software to use the `flowcontrol.apiserver.k8s.io/v1beta3` API version, available since v1.26. All existing persisted objects are accessible via the new API. Notable changes in `flowcontrol.apiserver.k8s.io/v1beta3` include
that the PriorityLevelConfiguration `spec.limited.assuredConcurrencyShares` field was renamed to `spec.limited.nominalConcurrencyShares`.
--&gt;
&lt;h3 id=&#34;移除-v1beta2-流量控制-api-组&#34;&gt;移除 &lt;code&gt;v1beta2&lt;/code&gt; 流量控制 API 组&lt;/h3&gt;
&lt;p&gt;在 Kubernetes v1.29 中，将&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-guide/#v1-29&#34;&gt;不再提供&lt;/a&gt;
FlowSchema 和 PriorityLevelConfiguration 的 &lt;strong&gt;flowcontrol.apiserver.k8s.io/v1beta2&lt;/strong&gt; API 版本。&lt;/p&gt;
&lt;p&gt;为了做好准备，你可以编辑现有的清单（Manifest）并重写客户端软件，以使用自 v1.26 起可用的
&lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; API 版本。所有现有的持久化对象都可以通过新的 API 访问。
&lt;code&gt;flowcontrol.apiserver.k8s.io/v1beta3&lt;/code&gt; 中的显著变化包括将 PriorityLevelConfiguration 的
&lt;code&gt;spec.limited.assuredConcurrencyShares&lt;/code&gt; 字段更名为 &lt;code&gt;spec.limited.nominalConcurrencyShares&lt;/code&gt;。&lt;/p&gt;
&lt;!--
### Deprecation of the `status.nodeInfo.kubeProxyVersion` field for Node

The `.status.kubeProxyVersion` field for Node objects will be [marked as deprecated](https://github.com/kubernetes/enhancements/issues/4004) in v1.29 in preparation for its removal in a future release. This field is not accurate and is set by kubelet, which does not actually know the kube-proxy version, or even if kube-proxy is running.
--&gt;
&lt;h3 id=&#34;弃用针对-node-的-status-nodeinfo-kubeproxyversion-字段&#34;&gt;弃用针对 Node 的 &lt;code&gt;status.nodeInfo.kubeProxyVersion&lt;/code&gt; 字段&lt;/h3&gt;
&lt;p&gt;在 v1.29 中，针对 Node 对象的 &lt;code&gt;.status.kubeProxyVersion&lt;/code&gt; 字段将被
&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4004&#34;&gt;标记为弃用&lt;/a&gt;，
准备在未来某个发行版本中移除。这是因为此字段并不准确，它由 kubelet 设置，
而 kubelet 实际上并不知道 kube-proxy 版本，甚至不知道 kube-proxy 是否在运行。&lt;/p&gt;
&lt;!--
## Want to know more?

Deprecations are announced in the Kubernetes release notes. You can see the announcements of pending deprecations in the release notes for:
--&gt;
&lt;h2 id=&#34;了解更多&#34;&gt;了解更多&lt;/h2&gt;
&lt;p&gt;弃用信息是在 Kubernetes 发布说明（Release Notes）中公布的。你可以在以下版本的发布说明中看到待弃用的公告：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.25.md#deprecation&#34;&gt;Kubernetes v1.25&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.26.md#deprecation&#34;&gt;Kubernetes v1.26&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.27.md#deprecation&#34;&gt;Kubernetes v1.27&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.28.md#deprecation&#34;&gt;Kubernetes v1.28&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
We will formally announce the deprecations that come with [Kubernetes v1.29](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.29.md#deprecation) as part of the CHANGELOG for that release.

For information on the deprecation and removal process, refer to the official Kubernetes [deprecation policy](/docs/reference/using-api/deprecation-policy/#deprecating-parts-of-the-api) document.
--&gt;
&lt;p&gt;我们将在
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.29.md#deprecation&#34;&gt;Kubernetes v1.29&lt;/a&gt;
的 CHANGELOG 中正式宣布与该版本相关的弃用信息。&lt;/p&gt;
&lt;p&gt;有关弃用和移除流程的细节，参阅 Kubernetes
官方&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/deprecation-policy/#deprecating-parts-of-the-api&#34;&gt;弃用策略&lt;/a&gt;文档。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>介绍 SIG etcd</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/07/introducing-sig-etcd/</link>
      <pubDate>Tue, 07 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/11/07/introducing-sig-etcd/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Introducing SIG etcd&#34;
slug: introducing-sig-etcd
date: 2023-11-07
canonicalUrl: https://etcd.io/blog/2023/introducing-sig-etcd/
--&gt;
&lt;!--
**Authors**:  Han Kang (Google), Marek Siarkowicz (Google), Frederico Muñoz (SAS Institute)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Han Kang (Google), Marek Siarkowicz (Google), Frederico Muñoz (SAS Institute)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
Special Interest Groups (SIGs) are a fundamental part of the Kubernetes project,
with a substantial share of the community activity happening within them.
When the need arises, [new SIGs can be created](https://github.com/kubernetes/community/blob/master/sig-wg-lifecycle.md),
and that was precisely what happened recently.
--&gt;
&lt;p&gt;特殊兴趣小组（SIG）是 Kubernetes 项目的基本组成部分，很大一部分的 Kubernetes 社区活动都在其中进行。
当有需要时，可以创建&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-wg-lifecycle.md&#34;&gt;新的 SIG&lt;/a&gt;，
而这正是最近发生的事情。&lt;/p&gt;
&lt;!--
[SIG etcd](https://github.com/kubernetes/community/blob/master/sig-etcd/README.md)
is the most recent addition to the list of Kubernetes SIGs.
In this article we will get to know it a bit better, understand its origins, scope, and plans.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-etcd/README.md&#34;&gt;SIG etcd&lt;/a&gt;
是 Kubernetes SIG 列表中的最新成员。在这篇文章中，我们将更好地认识它，了解它的起源、职责和计划。&lt;/p&gt;
&lt;!--
## The critical role of etcd

If we look inside the control plane of a Kubernetes cluster, we will find
[etcd](https://kubernetes.io/docs/concepts/overview/components/#etcd),
a consistent and highly-available key value store used as Kubernetes&#39; backing
store for all cluster data -- this description alone highlights the critical role that etcd plays,
and the importance of it within the Kubernetes ecosystem.
--&gt;
&lt;h2 id=&#34;etcd-的关键作用&#34;&gt;etcd 的关键作用&lt;/h2&gt;
&lt;p&gt;如果我们查看 Kubernetes 集群的控制平面内部，我们会发现
&lt;a href=&#34;https://kubernetes.io/zh-cn/docs/concepts/overview/components/#etcd&#34;&gt;etcd&lt;/a&gt;，
一个一致且高可用的键值存储，用作 Kubernetes 所有集群数据的后台数据库 -- 仅此描述就突出了
etcd 所扮演的关键角色，以及它在 Kubernetes 生态系统中的重要性。&lt;/p&gt;
&lt;!--
This critical role makes the health of the etcd project and community an important consideration,
and [concerns about the state of the project](https://groups.google.com/a/kubernetes.io/g/steering/c/e-O-tVSCJOk/m/N9IkiWLEAgAJ)
in early 2022 did not go unnoticed. The changes in the maintainer team, amongst other factors,
contributed to a situation that needed to be addressed.
--&gt;
&lt;p&gt;由于 etcd 在生态中的关键作用，其项目和社区的健康成为了一个重要的考虑因素，
并且人们 2022 年初&lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/steering/c/e-O-tVSCJOk/m/N9IkiWLEAgAJ&#34;&gt;对项目状态的担忧&lt;/a&gt;
并没有被忽视。维护团队的变化以及其他因素导致了一些情况需要被解决。&lt;/p&gt;
&lt;!--
## Why a special interest group

With the critical role of etcd in mind, it was proposed that the way forward would
be to create a new special interest group. If etcd was already at the heart of Kubernetes,
creating a dedicated SIG not only recognises that role, it would make etcd a first-class citizen of the Kubernetes community.
--&gt;
&lt;h2 id=&#34;为什么要设立特殊兴趣小组&#34;&gt;为什么要设立特殊兴趣小组&lt;/h2&gt;
&lt;p&gt;考虑到 etcd 的关键作用，有人提出未来的方向是创建一个新的特殊兴趣小组。
如果 etcd 已经成为 Kubernetes 的核心，创建专门的 SIG 不仅是对这一角色的认可，
还会使 etcd 成为 Kubernetes 社区的一等公民。&lt;/p&gt;
&lt;!--
Establishing SIG etcd creates a dedicated space to make explicit the contract
between etcd and Kubernetes api machinery and to prevent, on the etcd level,
changes which violate this contract. Additionally, etcd will be able to adop
the processes that Kubernetes offers its SIGs ([KEPs](https://www.kubernetes.dev/resources/keps/),
[PRR](https://github.com/kubernetes/community/blob/master/sig-architecture/production-readiness.md),
[phased feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/),
amongst others) in order to improve the consistency and reliability of the codebase. Being able to use these processes will be a substantial benefit to the etcd community.
--&gt;
&lt;p&gt;SIG etcd 的成立为明确 etcd 和 Kubernetes API 机制之间的契约关系创造了一个专门的空间，
并防止在 etcd 级别上发生违反此契约的更改。此外，etcd 将能够采用 Kubernetes 提供的 SIG
流程（&lt;a href=&#34;https://www.kubernetes.dev/resources/keps/&#34;&gt;KEP&lt;/a&gt;、
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-architecture/production-readiness.md&#34;&gt;PRR&lt;/a&gt;、
&lt;a href=&#34;https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;分阶段特性门控&lt;/a&gt;以及其他流程）
以提高代码库的一致性和可靠性，这将为 etcd 社区带来巨大的好处。&lt;/p&gt;
&lt;!--
As a SIG, etcd will also be able to draw contributor support from Kubernetes proper:
active contributions to etcd from Kubernetes maintainers would decrease the likelihood
of breaking Kubernetes changes, through the increased number of potential reviewers
and the integration with existing testing framework. This will not only benefit Kubernetes,
which will be able to better participate and shape the direction of etcd in terms of the critical role it plays,
but also etcd as a whole.
--&gt;
&lt;p&gt;作为 SIG，etcd 还能够从 Kubernetes 获得贡献者的支持：Kubernetes 维护者对 etcd
的积极贡献将通过增加潜在审核者数量以及与现有测试框架的集成来降低破坏 Kubernetes 更改的可能性。
这不仅有利于 Kubernetes，由于它能够更好地参与并塑造 etcd 所发挥的关键作用，从而也将有利于整个 etcd。&lt;/p&gt;
&lt;!--
## About SIG etcd

The recently created SIG is already working towards its goals, defined in its
[Charter](https://github.com/kubernetes/community/blob/master/sig-etcd/charter.md)
and [Vision](https://github.com/kubernetes/community/blob/master/sig-etcd/vision.md).
The purpose is clear: to ensure etcd is a reliable, simple, and scalable production-ready
store for building cloud-native distributed systems and managing cloud-native infrastructure
via orchestrators like Kubernetes.
--&gt;
&lt;h2 id=&#34;关于-sig-etcd&#34;&gt;关于 SIG etcd&lt;/h2&gt;
&lt;p&gt;最近创建的 SIG 已经在努力实现其&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-etcd/charter.md&#34;&gt;章程&lt;/a&gt;
和&lt;a href=&#34;https:///github.com/kubernetes/community/blob/master/sig-etcd/vision.md&#34;&gt;愿景&lt;/a&gt;中定义的目标。
其目的很明确：确保 etcd 是一个可靠、简单且可扩展的生产就绪存储，用于构建云原生分布式系统并通过 Kubernetes 等编排器管理云原生基础设施。&lt;/p&gt;
&lt;!--
The scope of SIG etcd is not exclusively about etcd as a Kubernetes component,
it also covers etcd as a standard solution. Our goal is to make etcd the most
reliable key-value storage to be used anywhere, unconstrained by any Kubernetes-specific
limits and scaling to meet the requirements of many diverse use-cases.
--&gt;
&lt;p&gt;SIG etcd 的范围不仅仅涉及将 etcd 作为 Kubernetes 组件，还涵盖将 etcd 作为标准解决方案。
我们的目标是使 etcd 成为可在任何地方使用的最可靠的键值存储，不受任何 kubernetes 特定限制的约束，并且可以扩展以满足许多不同用例的需求。&lt;/p&gt;
&lt;!--
We are confident that the creation of SIG etcd constitutes an important milestone
in the lifecycle of the project, simultaneously improving etcd itself,
and also the integration of etcd with Kubernetes. We invite everyone interested in etcd to
[visit our page](https://github.com/kubernetes/community/blob/master/sig-etcd/README.md),
[join us at our Slack channel](https://kubernetes.slack.com/messages/etcd),
and get involved in this new stage of etcd&#39;s life.
--&gt;
&lt;p&gt;我们相信，SIG etcd 的创建将成为项目生命周期中的一个重要里程碑，同时改进 etcd 本身以及
etcd 与 Kubernetes 的集成。我们欢迎所有对 etcd
感兴趣的人&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-etcd/README.md&#34;&gt;访问我们的页面&lt;/a&gt;、
&lt;a href=&#34;https://kubernetes.slack.com/messages/etcd&#34;&gt;加入我们的 Slack 频道&lt;/a&gt;，并参与 etcd 生命的新阶段。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Gateway API v1.0：正式发布（GA）</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/31/gateway-api-ga/</link>
      <pubDate>Tue, 31 Oct 2023 10:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/31/gateway-api-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Gateway API v1.0: GA Release&#34;
date: 2023-10-31T10:00:00-08:00
slug: gateway-api-ga
--&gt;
&lt;!--
**Authors:** Shane Utt (Kong), Nick Young (Isovalent), Rob Scott (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Shane Utt (Kong), Nick Young (Isovalent), Rob Scott (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
On behalf of Kubernetes SIG Network, we are pleased to announce the v1.0 release of [Gateway
API](https://gateway-api.sigs.k8s.io/)! This release marks a huge milestone for
this project. Several key APIs are graduating to GA (generally available), while
other significant features have been added to the Experimental channel.
--&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.0 版本发布！此版本是该项目的一个重要里程碑。几个关键的 API 正在逐步进入 GA（正式发布）阶段，
同时其他重要特性已添加到实验（Experimental）通道中。&lt;/p&gt;
&lt;!--
## What&#39;s new

### Graduation to v1
This release includes the graduation of
[Gateway](https://gateway-api.sigs.k8s.io/api-types/gateway/),
[GatewayClass](https://gateway-api.sigs.k8s.io/api-types/gatewayclass/), and
[HTTPRoute](https://gateway-api.sigs.k8s.io/api-types/httproute/) to v1, which
means they are now generally available (GA). This API version denotes a high
level of confidence in the API surface and provides guarantees of backwards
compatibility. Note that although, the version of these APIs included in the
Standard channel are now considered stable, that does not mean that they are
complete. These APIs will continue to receive new features via the Experimental
channel as they meet graduation criteria. 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;h2 id=&#34;新增内容&#34;&gt;新增内容&lt;/h2&gt;
&lt;h3 id=&#34;升级到-v1&#34;&gt;升级到 v1&lt;/h3&gt;
&lt;p&gt;此版本将 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/api-types/gateway/&#34;&gt;Gateway&lt;/a&gt;、
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/api-types/gatewayclass/&#34;&gt;GatewayClass&lt;/a&gt; 和
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/api-types/httproute/&#34;&gt;HTTPRoute&lt;/a&gt; 升级到 v1 版本，
这意味着它们现在是正式发布（GA）的版本。这个 API 版本表明我们对 API 的可感知方面具有较强的信心，并提供向后兼容的保证。
需要注意的是，虽然标准（Standard）通道中所包含的这个版本的 API 集合现在被认为是稳定的，但这并不意味着它们是完整的。
即便这些 API 已满足毕业标准，仍将继续通过实验（Experimental）通道接收新特性。要了解相关工作的组织方式的进一步信息，请参阅
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/versioning/&#34;&gt;Gateway API 版本控制策略&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Logo
Gateway API now has a logo! This logo was designed through a collaborative
process, and is intended to represent the idea that this is a set of Kubernetes
APIs for routing traffic both north-south and east-west:
--&gt;
&lt;p&gt;Gateway API 现在有了自己的 Logo！这个 Logo 是通过协作方式设计的，
旨在表达这是一组用于路由南北向和东西向流量的 Kubernetes API：&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;Gateway API Logo&#34; src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/31/gateway-api-ga/gateway-api-logo.png&#34; title=&#34;Gateway API Logo&#34;&gt;&lt;/p&gt;
&lt;!--
### CEL Validation
Historically, Gateway API has bundled a validating webhook as part of installing
the API. Starting in v1.0, webhook installation is optional and only recommended
for Kubernetes 1.24. Gateway API now includes
[CEL](/docs/reference/using-api/cel/) validation rules as
part of the
[CRDs](/docs/concepts/extend-kubernetes/api-extension/custom-resources/).
This new form of validation is supported in Kubernetes 1.25+, and thus the
validating webhook is no longer required in most installations.
--&gt;
&lt;h3 id=&#34;cel-验证&#34;&gt;CEL 验证&lt;/h3&gt;
&lt;p&gt;过去，Gateway API 在安装 API 时绑定了一个验证性质（Validation）的 Webhook。
从 v1.0 开始，Webhook 的安装是可选的，仅建议在 Kubernetes 1.24 版本上使用。
Gateway API 现在将 &lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/cel/&#34;&gt;CEL&lt;/a&gt; 验证规则包含在
&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources/&#34;&gt;CRD&lt;/a&gt;
中。Kubernetes 1.25 及以上版本支持这种新形式的验证，因此大多数安装中不再需要验证性质的 Webhook。&lt;/p&gt;
&lt;!--
### Standard channel
This release was primarily focused on ensuring that the existing beta APIs were
well defined and sufficiently stable to graduate to GA. That led to a variety of
spec clarifications, as well as some improvements to status to improve the
overall UX when interacting with Gateway API.
--&gt;
&lt;h3 id=&#34;标准-standard-通道&#34;&gt;标准（Standard）通道&lt;/h3&gt;
&lt;p&gt;此发行版本主要侧重于确保现有 Beta 级别 API 定义良好且足够稳定，可以升级为 GA。
其背后意味着为了提高与 Gateway API 交互时的整体用户体验而作的各种规范的澄清以及一些改进。&lt;/p&gt;
&lt;!--
### Experimental channel
Most of the changes included in this release were limited to the experimental
channel. These include HTTPRoute timeouts, TLS config from Gateways to backends,
WebSocket support, Gateway infrastructure labels, and more. Stay tuned for a
follow up blog post that will cover each of these new features in detail.
--&gt;
&lt;h2 id=&#34;实验-experimental-通道&#34;&gt;实验（Experimental）通道&lt;/h2&gt;
&lt;p&gt;此发行版本中包含的大部分更改都限于实验通道。这些更改包括 HTTPRoute
超时、用于 Gateway 访问后端的 TLS 配置、WebSocket 支持、Gateway 基础设施的标签等等。
请继续关注后续博客，我们将详细介绍这些新特性。&lt;/p&gt;
&lt;!--
### Everything else
For a full list of the changes included in this release, please refer to the
[v1.0.0 release
notes](https://github.com/kubernetes-sigs/gateway-api/releases/tag/v1.0.0).
--&gt;
&lt;h2 id=&#34;其他内容&#34;&gt;其他内容&lt;/h2&gt;
&lt;p&gt;有关此版本中包含的所有更改的完整列表，请参阅
&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/releases/tag/v1.0.0&#34;&gt;v1.0.0 版本说明&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## How we got here

The idea of Gateway API was initially [proposed](https://youtu.be/Ne9UJL6irXY?si=wgtC9w8PMB5ZHil2)
4 years ago at KubeCon San Diego as the next generation
of Ingress API. Since then, an incredible community has formed to develop what
has likely become the most collaborative API in Kubernetes history. Over 170
people have contributed to this API so far, and that number continues to grow.
--&gt;
&lt;h2 id=&#34;发展历程&#34;&gt;发展历程&lt;/h2&gt;
&lt;p&gt;Gateway API 的想法最初是在 4 年前的 KubeCon 圣地亚哥&lt;a href=&#34;https://youtu.be/Ne9UJL6irXY?si=wgtC9w8PMB5ZHil2&#34;&gt;提出&lt;/a&gt;的，
下一代 Ingress API。那次会议之后，诞生了一个令人难以置信的社区，致力于开发一种可能是 Kubernetes
历史上协作关系最密切的 API。
迄今为止，已有超过 170 人为此 API 做出了贡献，而且这个数字还在不断增长。&lt;/p&gt;
&lt;!--
A special thank you to the 20+ [community members who agreed to take on an
official role in the
project](https://github.com/kubernetes-sigs/gateway-api/blob/main/OWNERS_ALIASES),
providing some time for reviews and sharing the load of maintaining the project!

We especially want to highlight the emeritus maintainers that played a pivotal
role in the early development of this project:
--&gt;
&lt;p&gt;特别感谢 20 多位&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/blob/main/OWNERS_ALIASES&#34;&gt;愿意在项目中担任正式角色&lt;/a&gt;的社区成员，
他们付出了时间进行评审并分担项目维护的负担！&lt;/p&gt;
&lt;p&gt;我们特别要强调那些在项目早期发展中起到关键作用的荣誉维护者：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bowei&#34;&gt;Bowei Du&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/danehans&#34;&gt;Daneyon Hansen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/hbagdi&#34;&gt;Harry Bagdi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Try it out

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
one of the 5 most recent minor versions of Kubernetes (1.24+), you&#39;ll be able to
get up and running with the latest version of Gateway API.

To try out the API, follow our [Getting Started
guide](https://gateway-api.sigs.k8s.io/guides/).
--&gt;
&lt;h2 id=&#34;尝试一下&#34;&gt;尝试一下&lt;/h2&gt;
&lt;p&gt;与其他 Kubernetes API 不同，你无需升级到最新版本的 Kubernetes 即可获取最新版本的
Gateway API。只要运行的是 Kubernetes 最新的 5 个次要版本之一（1.24+），
就可以使用最新版本的 Gateway API。&lt;/p&gt;
&lt;p&gt;要尝试此 API，请参照我们的&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/&#34;&gt;入门指南&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## What&#39;s next

This release is just the beginning of a much larger journey for Gateway API, and
there are still plenty of new features and new ideas in flight for future
releases of the API.
--&gt;
&lt;h2 id=&#34;下一步&#34;&gt;下一步&lt;/h2&gt;
&lt;p&gt;此版本只是 Gateway API 更广泛前景的开始，将来的 API 版本中还有很多新特性和新想法。&lt;/p&gt;
&lt;!--
One of our key goals going forward is to work to stabilize and graduate other
experimental features of the API. These include [support for service
mesh](https://gateway-api.sigs.k8s.io/concepts/gamma/), additional route types
([GRPCRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.GRPCRoute),
[TCPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.TCPRoute),
[TLSRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.TLSRoute),
[UDPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.UDPRoute)),
and a variety of experimental features.
--&gt;
&lt;p&gt;我们未来的一个关键目标是努力稳定和升级 API 的其他实验级特性。
这些特性包括支持&lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/gamma/&#34;&gt;服务网格&lt;/a&gt;、
额外的路由类型（&lt;a href=&#34;https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.GRPCRoute&#34;&gt;GRPCRoute&lt;/a&gt;、
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.TCPRoute&#34;&gt;TCPRoute&lt;/a&gt;、
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.TLSRoute&#34;&gt;TLSRoute&lt;/a&gt;、
&lt;a href=&#34;https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.UDPRoute&#34;&gt;UDPRoute&lt;/a&gt;）以及各种实验级特性。&lt;/p&gt;
&lt;!--
We&#39;ve also been working towards moving
[ReferenceGrant](https://gateway-api.sigs.k8s.io/api-types/referencegrant/) into
a built-in Kubernetes API that can be used for more than just Gateway API.
Within Gateway API, we&#39;ve used this resource to safely enable cross-namespace
references, and that concept is now being adopted by other SIGs. The new version
of this API will be owned by SIG Auth and will likely include at least some
modifications as it migrates to a built-in Kubernetes API.
--&gt;
&lt;p&gt;我们还致力于将 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/api-types/referencegrant/&#34;&gt;ReferenceGrant&lt;/a&gt;
移入内置的 Kubernetes API 中，使其不仅仅可用于网关 API。在 Gateway API 中，我们使用这个资源来安全地实现跨命名空间引用，
而这个概念现在被其他 SIG 采纳。这个 API 的新版本将归 SIG Auth 所有，在移到内置的
Kubernetes API 时可能至少包含一些修改。&lt;/p&gt;
&lt;!--
### Gateway API at KubeCon + CloudNativeCon

At [KubeCon North America
(Chicago)](https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/)
and the adjacent [Contributor
Summit](https://www.kubernetes.dev/events/2023/kcsna/) there are several talks
related to Gateway API that will go into more detail on these topics. If you&#39;re
attending either of these events this year, considering adding these to your
schedule.
--&gt;
&lt;h3 id=&#34;gateway-api-现身于-kubecon-cloudnativecon&#34;&gt;Gateway API 现身于 KubeCon + CloudNativeCon&lt;/h3&gt;
&lt;p&gt;在 &lt;a href=&#34;https://events.linuxfoundation.org/kubecon-cloudnativecon-north-america/&#34;&gt;KubeCon 北美（芝加哥）&lt;/a&gt;
和同场的&lt;a href=&#34;https://www.kubernetes.dev/events/2023/kcsna/&#34;&gt;贡献者峰会&lt;/a&gt;上，
有几个与 Gateway API 相关的演讲将详细介绍这些主题。如果你今年要参加其中的一场活动，
请考虑将它们添加到你的日程安排中。&lt;/p&gt;
&lt;!--
**Contributor Summit:**

- [Lessons Learned Building a GA API with CRDs](https://sched.co/1Sp9u)
- [Conformance Profiles: Building a generic conformance test reporting framework](https://sched.co/1Sp9l)
- [Gateway API: Beyond GA](https://sched.co/1SpA9)
--&gt;
&lt;p&gt;&lt;strong&gt;贡献者峰会：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://sched.co/1Sp9u&#34;&gt;使用 CRD 构建 GA API 的经验教训&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://sched.co/1Sp9l&#34;&gt;合规性配置文件：构建通用合规性测试报告框架&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://sched.co/1SpA9&#34;&gt;Gateway API：GA 以后&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**KubeCon Main Event:**

- [Gateway API: The Most Collaborative API in Kubernetes History Is GA](https://sched.co/1R2qM)
--&gt;
&lt;p&gt;&lt;strong&gt;KubeCon 主要活动：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://sched.co/1R2qM&#34;&gt;Gateway API：Kubernetes 历史上协作性最强的 API 已经正式发布&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**KubeCon Office Hours:**

Gateway API maintainers will be holding office hours sessions at KubeCon if
you&#39;d like to discuss or brainstorm any related topics. To get the latest
updates on these sessions, join the `#sig-network-gateway-api` channel on
[Kubernetes Slack](https://slack.kubernetes.io/).
--&gt;
&lt;p&gt;&lt;strong&gt;KubeCon 办公时间：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;如果你想就相关主题发起讨论或参与头脑风暴，请参加 Gateway API 维护人员在 KubeCon 上举行办公时间会议。
要获取有关这些会议的最新更新，请加入 &lt;a href=&#34;https://slack.kubernetes.io/&#34;&gt;Kubernetes Slack&lt;/a&gt;
上的 &lt;code&gt;#sig-network-gateway-api&lt;/code&gt; 频道。&lt;/p&gt;
&lt;!--
## Get involved

We&#39;ve only barely scratched the surface of what&#39;s in flight with Gateway API.
There are lots of opportunities to get involved and help define the future of
Kubernetes routing APIs for both Ingress and Mesh.
--&gt;
&lt;h2 id=&#34;参与其中&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&gt;我们只是初步介绍了 Gateway API 正在进行的工作。
有很多机会参与并帮助定义 Ingress 和 Mesh 的 Kubernetes 路由 API 的未来。&lt;/p&gt;
&lt;!--
If this is interesting to you, please [join us in the
community](https://gateway-api.sigs.k8s.io/contributing/) and help us build the
future of Gateway API together!
--&gt;
&lt;p&gt;如果你对此感兴趣，请&lt;a href=&#34;https://gateway-api.sigs.k8s.io/contributing/&#34;&gt;加入我们的社区&lt;/a&gt;并帮助我们共同构建
Gateway API 的未来！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 中 PersistentVolume 的最后阶段转换时间</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/23/persistent-volume-last-phase-transition-time/</link>
      <pubDate>Mon, 23 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/23/persistent-volume-last-phase-transition-time/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: PersistentVolume Last Phase Transition Time in Kubernetes
date: 2023-10-23
slug: persistent-volume-last-phase-transition-time
--&gt;
&lt;!--
**Author:** Roman Bednář (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Roman Bednář (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
In the recent Kubernetes v1.28 release, we (SIG Storage) introduced a new alpha feature that aims to improve PersistentVolume (PV)
storage management and help cluster administrators gain better insights into the lifecycle of PVs.
With the addition of the `lastPhaseTransitionTime` field into the status of a PV,
cluster administrators are now able to track the last time a PV transitioned to a different
[phase](/docs/concepts/storage/persistent-volumes/#phase), allowing for more efficient
and informed resource management.
--&gt;
&lt;p&gt;在最近的 Kubernetes v1.28 版本中，我们（SIG Storage）引入了一项新的 Alpha 级别特性，
旨在改进 PersistentVolume（PV）存储管理并帮助集群管理员更好地了解 PV 的生命周期。
通过将 &lt;code&gt;lastPhaseTransitionTime&lt;/code&gt; 字段添加到 PV 的状态中，集群管理员现在可以跟踪
PV 上次转换到不同&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#phase&#34;&gt;阶段&lt;/a&gt;的时间，
从而实现更高效、更明智的资源管理。&lt;/p&gt;
&lt;!--
## Why do we need new PV field? {#why-new-field}

PersistentVolumes in Kubernetes play a crucial role in providing storage resources to workloads running in the cluster.
However, managing these PVs effectively can be challenging, especially when it comes
to determining the last time a PV transitioned between different phases, such as
`Pending`, `Bound` or `Released`.
Administrators often need to know when a PV was last used or transitioned to certain
phases; for instance, to implement retention policies, perform cleanup, or monitor storage health.
--&gt;
&lt;h2 id=&#34;why-new-field&#34;&gt;我们为什么需要新的 PV 字段？ &lt;/h2&gt;
&lt;p&gt;Kubernetes 中的 PersistentVolume 在为集群中运行的工作负载提供存储资源方面发挥着至关重要的作用。
然而，有效管理这些 PV 可能具有挑战性，特别是在确定 PV 在不同阶段（&lt;code&gt;Pending&lt;/code&gt;、&lt;code&gt;Bound&lt;/code&gt; 或 &lt;code&gt;Released&lt;/code&gt;）之间转换的最后时间时。
管理员通常需要知道 PV 上次使用或转换到某些阶段的时间；例如，实施保留策略、执行清理或监控存储运行状况时。&lt;/p&gt;
&lt;!--
In the past, Kubernetes users have faced data loss issues when using the `Delete` retain policy and had to resort to the safer `Retain` policy.
When we planned the work to introduce the new `lastPhaseTransitionTime` field, we
wanted to provide a more generic solution that can be used for various use cases,
including manual cleanup based on the time a volume was last used or producing alerts based on phase transition times.
--&gt;
&lt;p&gt;过去，Kubernetes 用户在使用 &lt;code&gt;Delete&lt;/code&gt; 保留策略时面临数据丢失问题，不得不使用更安全的 &lt;code&gt;Retain&lt;/code&gt; 策略。
当我们计划引入新的 &lt;code&gt;lastPhaseTransitionTime&lt;/code&gt; 字段时，我们希望提供一个更通用的解决方案，
可用于各种用例，包括根据卷上次使用时间进行手动清理或根据状态转变时间生成警报。&lt;/p&gt;
&lt;!--
## How lastPhaseTransitionTime helps

Provided you&#39;ve enabled the feature gate (see [How to use it](#how-to-use-it), the new `.status.lastPhaseTransitionTime` field of a PersistentVolume (PV)
is updated every time that PV transitions from one phase to another.
--&gt;
&lt;h2 id=&#34;lastphasetransitiontime-如何提供帮助&#34;&gt;lastPhaseTransitionTime 如何提供帮助&lt;/h2&gt;
&lt;p&gt;如果你已启用特性门控（请参阅&lt;a href=&#34;#how-to-use-it&#34;&gt;如何使用它&lt;/a&gt;），则每次 PV 从一个阶段转换到另一阶段时，
PersistentVolume（PV）的新字段 &lt;code&gt;.status.lastPhaseTransitionTime&lt;/code&gt; 都会被更新。&lt;/p&gt;
&lt;!--
Whether it&#39;s transitioning from `Pending` to `Bound`, `Bound` to `Released`, or any other phase transition, the `lastPhaseTransitionTime` will be recorded.
For newly created PVs the phase will be set to `Pending` and the `lastPhaseTransitionTime` will be recorded as well.
--&gt;
&lt;p&gt;无论是从 &lt;code&gt;Pending&lt;/code&gt; 转换到 &lt;code&gt;Bound&lt;/code&gt;、&lt;code&gt;Bound&lt;/code&gt; 到 &lt;code&gt;Released&lt;/code&gt;，还是任何其他阶段转换，都会记录 &lt;code&gt;lastPhaseTransitionTime&lt;/code&gt;。
对于新创建的 PV，将被声明为处于 &lt;code&gt;Pending&lt;/code&gt; 阶段，并且 &lt;code&gt;lastPhaseTransitionTime&lt;/code&gt; 也将被记录。&lt;/p&gt;
&lt;!--
This feature allows cluster administrators to:
--&gt;
&lt;p&gt;此功能允许集群管理员：&lt;/p&gt;
&lt;!--
1. Implement Retention Policies

   With the `lastPhaseTransitionTime`, administrators can now track when a PV was last used or transitioned to the `Released` phase.
   This information can be crucial for implementing retention policies to clean up resources that have been in the `Released` phase for a specific duration.
   For example, it is now trivial to write a script or a policy that deletes all PVs that have been in the `Released` phase for a week.
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;实施保留政策&lt;/p&gt;
&lt;p&gt;通过 &lt;code&gt;lastPhaseTransitionTime&lt;/code&gt;，管理员可以跟踪 PV 上次使用或转换到 &lt;code&gt;Released&lt;/code&gt; 阶段的时间。
此信息对于实施保留策略以清理在特定时间内处于 &lt;code&gt;Released&lt;/code&gt; 阶段的资源至关重要。
例如，现在编写一个脚本或一个策略来删除一周内处于 &lt;code&gt;Released&lt;/code&gt; 阶段的所有 PV 是很简单的。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. Monitor Storage Health

   By analyzing the phase transition times of PVs, administrators can monitor storage health more effectively.
   For example, they can identify PVs that have been in the `Pending` phase for an unusually long time, which may indicate underlying issues with the storage provisioner.
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;监控存储运行状况&lt;/p&gt;
&lt;p&gt;通过分析 PV 的相变时间，管理员可以更有效地监控存储运行状况。
例如，他们可以识别处于 &lt;code&gt;Pending&lt;/code&gt; 阶段时间异常长的 PV，这可能表明存储配置程序存在潜在问题。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## How to use it

The `lastPhaseTransitionTime` field is alpha starting from Kubernetes v1.28, so it requires
the `PersistentVolumeLastPhaseTransitionTime` feature gate to be enabled.
--&gt;
&lt;h2 id=&#34;如何使用它&#34;&gt;如何使用它&lt;/h2&gt;
&lt;p&gt;从 Kubernetes v1.28 开始，&lt;code&gt;lastPhaseTransitionTime&lt;/code&gt; 为 Alpha 特性字段，因此需要启用
&lt;code&gt;PersistentVolumeLastPhaseTransitionTime&lt;/code&gt; 特性门控。&lt;/p&gt;
&lt;!--
If you want to test the feature whilst it&#39;s alpha, you need to enable this feature gate on the `kube-controller-manager` and the `kube-apiserver`.

Use the `--feature-gates` command line argument:
--&gt;
&lt;p&gt;如果你想在该特性处于 Alpha 阶段时对其进行测试，则需要在 &lt;code&gt;kube-controller-manager&lt;/code&gt;
和 &lt;code&gt;kube-apiserver&lt;/code&gt; 上启用此特性门控。&lt;/p&gt;
&lt;p&gt;使用 &lt;code&gt;--feature-gates&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;--feature-gates&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;...,PersistentVolumeLastPhaseTransitionTime=true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Keep in mind that the feature enablement does not have immediate effect; the new field will be populated whenever a PV is updated and transitions between phases.
Administrators can then access the new field through the PV status, which can be retrieved using standard Kubernetes API calls or through Kubernetes client libraries.
--&gt;
&lt;p&gt;请记住，该特性启用后不会立即生效；而是在 PV 更新以及阶段之间转换时，填充新字段。
然后，管理员可以通过查看 PV 状态访问新字段，此状态可以使用标准 Kubernetes API
调用或通过 Kubernetes 客户端库进行检索。&lt;/p&gt;
&lt;!--
Here is an example of how to retrieve the `lastPhaseTransitionTime` for a specific PV using the `kubectl` command-line tool:
--&gt;
&lt;p&gt;以下示例展示了如何使用 &lt;code&gt;kubectl&lt;/code&gt; 命令行工具检索特定 PV 的 &lt;code&gt;lastPhaseTransitionTime&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 pv &amp;lt;pv-name&amp;gt; -o &lt;span style=&#34;color:#b8860b&#34;&gt;jsonpath&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;{.status.lastPhaseTransitionTime}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## Going forward

This feature was initially introduced as an alpha feature, behind a feature gate that is disabled by default.
During the alpha phase, we (Kubernetes SIG Storage) will collect feedback from the end user community and address any issues or improvements identified.

Once sufficient feedback has been received, or no complaints are received the feature can move to beta.
The beta phase will allow us to further validate the implementation and ensure its stability.
--&gt;
&lt;h2 id=&#34;未来发展&#34;&gt;未来发展&lt;/h2&gt;
&lt;p&gt;此特性最初是作为 Alpha 特性引入的，位于默认情况下禁用的特性门控之下。
在 Alpha 阶段，我们（Kubernetes SIG Storage）将收集最终用户的反馈并解决发现的任何问题或改进。&lt;/p&gt;
&lt;p&gt;一旦收到足够的反馈，或者没有收到投诉，该特性就可以进入 Beta 阶段。
Beta 阶段将使我们能够进一步验证实施并确保其稳定性。&lt;/p&gt;
&lt;!--
At least two Kubernetes releases will happen between the release where this field graduates
to beta and the release that graduates the field to general availability (GA). That means that
the earliest release where this field could be generally available is Kubernetes 1.32,
likely to be scheduled for early 2025.
--&gt;
&lt;p&gt;在该字段升级到 Beta 级别和将该字段升级为通用版 (GA) 的版本之间，至少会经过两个 Kubernetes 版本。
这意味着该字段 GA 的最早版本是 Kubernetes 1.32，可能计划于 2025 年初发布。&lt;/p&gt;
&lt;!--
## Getting involved

We always welcome new contributors so if you would like to get involved you can
join our [Kubernetes Storage Special-Interest-Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG).
--&gt;
&lt;h2 id=&#34;欢迎参与&#34;&gt;欢迎参与&lt;/h2&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;/p&gt;
&lt;!--
If you would like to share feedback, you can do so on our
[public Slack channel](https://app.slack.com/client/T09NY5SBT/C09QZFCE5).
If you&#39;re not already part of that Slack workspace, you can visit https://slack.k8s.io/ for an invitation.
--&gt;
&lt;p&gt;如果你想分享反馈，可以在我们的 &lt;a href=&#34;https://app.slack.com/client/T09NY5SBT/C09QZFCE5&#34;&gt;公共 Slack 频道&lt;/a&gt;上分享。
如果你尚未加入 Slack 工作区，可以访问 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;https://slack.k8s.io/&lt;/a&gt; 获取邀请。&lt;/p&gt;
&lt;!--
Special thanks to all the contributors that provided great reviews, shared valuable insight and helped implement this feature (alphabetical order):
--&gt;
&lt;p&gt;特别感谢所有提供精彩评论、分享宝贵意见并帮助实现此特性的贡献者（按字母顺序排列）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Han Kang (&lt;a href=&#34;https://github.com/logicalhan&#34;&gt;logicalhan&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Jan Šafránek (&lt;a href=&#34;https://github.com/jsafrane&#34;&gt;jsafrane&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Jordan Liggitt (&lt;a href=&#34;https://github.com/liggitt&#34;&gt;liggitt&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Kiki (&lt;a href=&#34;https://github.com/carlory&#34;&gt;carlory&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Michelle Au (&lt;a href=&#34;https://github.com/msau42&#34;&gt;msau42&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tim Bannister (&lt;a href=&#34;https://github.com/sftim&#34;&gt;sftim&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Wojciech Tyczynski (&lt;a href=&#34;https://github.com/wojtek-t&#34;&gt;wojtek-t&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Xing Yang (&lt;a href=&#34;https://github.com/xing-yang&#34;&gt;xing-yang&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>2023 中国 Kubernetes 贡献者峰会简要回顾</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/20/kcs-shanghai/</link>
      <pubDate>Fri, 20 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/20/kcs-shanghai/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;A Quick Recap of 2023 China Kubernetes Contributor Summit&#34;
slug: kcs-shanghai
date: 2023-10-20
canonicalUrl: https://www.kubernetes.dev/blog/2023/10/20/kcs-shanghai/
--&gt;
&lt;!--
**Author:** Paco Xu and Michael Yao (DaoCloud)

On September 26, 2023, the first day of
[KubeCon + CloudNativeCon + Open Source Summit China 2023](https://www.lfasiallc.com/kubecon-cloudnativecon-open-source-summit-china/),
nearly 50 contributors gathered in Shanghai for the Kubernetes Contributor Summit.
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Paco Xu 和 Michael Yao (DaoCloud)&lt;/p&gt;
&lt;p&gt;2023 年 9 月 26 日，即
&lt;a href=&#34;https://www.lfasiallc.com/kubecon-cloudnativecon-open-source-summit-china/&#34;&gt;KubeCon + CloudNativeCon + Open Source Summit China 2023&lt;/a&gt;
第一天，近 50 位社区贡献者济济一堂，在上海聚首 Kubernetes 贡献者峰会。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs04.jpeg&#34;
         alt=&#34;All participants in the 2023 Kubernetes Contributor Summit&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;All participants in the 2023 Kubernetes Contributor Summit&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs04.jpeg&#34;
         alt=&#34;2023 Kubernetes 贡献者峰会与会者集体合影&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;2023 Kubernetes 贡献者峰会与会者集体合影&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
This marked the first in-person offline gathering held in China after three years of the pandemic.

## A joyful meetup

The event began with welcome speeches from [Kevin Wang](https://github.com/kevin-wangzefeng) from Huawei Cloud,
one of the co-chairs of KubeCon, and [Puja](https://github.com/puja108) from Giant Swarm.
--&gt;
&lt;p&gt;这是疫情三年之后，首次在中国本土召开的面对面线下聚会。&lt;/p&gt;
&lt;h2 id=&#34;开心遇见&#34;&gt;开心遇见&lt;/h2&gt;
&lt;p&gt;首先是本次 KubeCon 活动的联席主席、来自华为云的 &lt;a href=&#34;https://github.com/kevin-wangzefeng&#34;&gt;Kevin Wang&lt;/a&gt;
和来自 Gaint Swarm 的 &lt;a href=&#34;https://github.com/puja108&#34;&gt;Puja&lt;/a&gt; 做了欢迎致辞。&lt;/p&gt;
&lt;!--
Following the opening remarks, the contributors introduced themselves briefly. Most attendees were from China,
while some contributors had made the journey from Europe and the United States specifically for the conference.
Technical experts from companies such as Microsoft, Intel, Huawei, as well as emerging forces like DaoCloud,
were present. Laughter and cheerful voices filled the room, regardless of whether English was spoken with
European or American accents or if conversations were carried out in authentic Chinese language. This created
an atmosphere of comfort, joy, respect, and anticipation. Past contributions brought everyone closer, and
mutual recognition and accomplishments made this offline gathering possible.
--&gt;
&lt;p&gt;随后在座的几十位贡献者分别做了简单的自我介绍，80% 以上的与会者来自中国，还有一些贡献者专程从欧美飞到上海参会。
其中不乏来自微软、Intel、华为的技术大咖，也有来自 DaoCloud 这样的新锐中坚力量。
欢声笑语齐聚一堂，无论是操着欧美口音的英语，还是地道的中国话，都在诠释着舒心与欢畅，表达着尊敬和憧憬。
是曾经做出的贡献拉近了彼此，是互相的肯定和成就赋予了这次线下聚会的可能。&lt;/p&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs06.jpeg&#34;
         alt=&#34;Face to face meeting in Shanghai&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Face to face meeting in Shanghai&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs06.jpeg&#34;
         alt=&#34;Face to face meeting in Shanghai&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Face to face meeting in Shanghai&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
The attending contributors were no longer just GitHub IDs; they transformed into vivid faces.
From sitting together and capturing group photos to attempting to identify &#34;Who is who,&#34;
a loosely connected collective emerged. This team structure, although loosely knit and free-spirited,
was established to pursue shared dreams.

As the saying goes, &#34;You reap what you sow.&#34; Each effort has been diligently documented within
the Kubernetes community contributions. Regardless of the passage of time, the community will
not erase those shining traces. Brilliance can be found in your PRs, issues, or comments.
It can also be seen in the smiling faces captured in meetup photos or heard through stories
passed down among contributors.
--&gt;
&lt;p&gt;与会的贡献者不再是简单的 GitHub ID，而是进阶为一个个鲜活的面孔，
从静坐一堂，到合照留影，到寻觅彼此辨别 Who is Who 的那一刻起，我们事实上已形成了一个松散的集体。
这个 team 结构松散、自由开放，却是为了追逐梦想而成立。&lt;/p&gt;
&lt;p&gt;一分耕耘一分收获，每一份努力都已清晰地记录在 Kubernetes 社区贡献中。
无论时光如何流逝，社区中不会抹去那些发光的痕迹，璀璨可能是你的 PR、Issue 或 comments，
也可能是某次 Meetup 的合影笑脸，还可能是贡献者口口相传的故事。&lt;/p&gt;
&lt;!--
## Technical sharing and discussions

Next, there were three technical sharing sessions:

- [sig-multi-cluster](https://github.com/kubernetes/community/blob/master/sig-multicluster/README.md):
  [Hongcai Ren](https://github.com/RainbowMango), a maintainer of Karmada, provided an introduction to
  the responsibilities and roles of this SIG. Their focus is on designing, discussing, implementing,
  and maintaining APIs, tools, and documentation related to multi-cluster management.
  Cluster Federation, one of Karmada&#39;s core concepts, is also part of their work.
--&gt;
&lt;h2 id=&#34;技术分享和讨论&#34;&gt;技术分享和讨论&lt;/h2&gt;
&lt;p&gt;接下来是 3 个技术分享：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-multicluster/README.md&#34;&gt;sig-multi-cluster&lt;/a&gt;：
Karmada 的维护者 &lt;a href=&#34;https://github.com/RainbowMango&#34;&gt;Hongcai Ren&lt;/a&gt; 介绍了这个 SIG 的职责和作用。
这个 SIG 负责设计、讨论、实现和维护多集群管理相关的 API、工具和文档。
其中涉及的 Cluster Federation 也是 Karmada 的核心概念之一。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- [helmfile](https://github.com/helmfile/helmfile): [yxxhero](https://github.com/yxxhero)
  from [GitLab](https://gitlab.cn/) presented how to deploy Kubernetes manifests declaratively,
  customize configurations, and leverage the latest features of Helm, including Helmfile.

- [sig-scheduling](https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md):
  [william-wang](https://github.com/william-wang) from Huawei Cloud shared the recent updates and
  future plans of SIG Scheduling. This SIG is responsible for designing, developing, and testing
  components related to Pod scheduling.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/helmfile/helmfile&#34;&gt;helmfile&lt;/a&gt;：来自&lt;a href=&#34;https://gitlab.cn/&#34;&gt;极狐 GitLab&lt;/a&gt; 的
&lt;a href=&#34;https://github.com/yxxhero&#34;&gt;yxxhero&lt;/a&gt; 介绍了如何声明式部署 Kubernetes 清单，如何自定义配置，
如何使用 Helm 的最新特性 Helmfile 等内容。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md&#34;&gt;sig-scheduling&lt;/a&gt;：
来自华为云的 &lt;a href=&#34;https://github.com/william-wang&#34;&gt;william-wang&lt;/a&gt; 介绍了
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md&#34;&gt;SIG Scheduling&lt;/a&gt;
最近更新的特性以及未来的规划。SIG Scheduling 负责设计、开发和测试 Pod 调度相关的组件。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs03.jpeg&#34;
         alt=&#34;A technical session about sig-multi-cluster&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;A technical session about sig-multi-cluster&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
--&gt;


&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/10/20/kcs-shanghai/kcs03.jpeg&#34;
         alt=&#34;有关 sig-multi-cluster 的技术主题演讲&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;有关 sig-multi-cluster 的技术主题演讲&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;!--
Following the sessions, a video featuring a call for contributors by [Sergey Kanzhelev](https://github.com/SergeyKanzhelev),
the SIG-Node Chair, was played. The purpose was to encourage more contributors to join the Kubernetes community,
with a special emphasis on the popular SIG-Node.

Lastly, Kevin hosted an Unconference collective discussion session covering topics such as
multi-cluster management, scheduling, elasticity, AI, and more. For detailed minutes of
the Unconference meeting, please refer to &lt;https://docs.qq.com/doc/DY3pLWklzQkhjWHNT&gt;.
--&gt;
&lt;p&gt;随后播放了来自 SIG-Node Chair &lt;a href=&#34;https://github.com/SergeyKanzhelev&#34;&gt;Sergey Kanzhelev&lt;/a&gt;
的贡献者招募视频，希望更多贡献者参与到 Kubernetes 社区，特别是社区热门的 SIG-Node 方向。&lt;/p&gt;
&lt;p&gt;最后，Kevin 主持了 Unconference 的集体讨论活动，主要涉及到多集群、调度、弹性、AI 等方向。
有关 Unconference 会议纪要，参阅 &lt;a href=&#34;https://docs.qq.com/doc/DY3pLWklzQkhjWHNT&#34;&gt;https://docs.qq.com/doc/DY3pLWklzQkhjWHNT&lt;/a&gt;&lt;/p&gt;
&lt;!--
## China&#39;s contributor statistics

The contributor summit took place in Shanghai, with 90% of the attendees being Chinese.
Within the Cloud Native Computing Foundation (CNCF) ecosystem, contributions from China have been steadily increasing. Currently:

- Chinese contributors account for 9% of the total.
- Contributions from China make up 11.7% of the overall volume.
- China ranks second globally in terms of contributions.
--&gt;
&lt;h2 id=&#34;中国贡献者数据&#34;&gt;中国贡献者数据&lt;/h2&gt;
&lt;p&gt;本次贡献者峰会在上海举办，有 90% 的与会者为华人。而在 CNCF 生态体系中，来自中国的贡献数据也在持续增长，目前：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;中国贡献者占比 9%&lt;/li&gt;
&lt;li&gt;中国贡献量占比 11.7%&lt;/li&gt;
&lt;li&gt;全球贡献排名第 2&lt;/li&gt;
&lt;/ul&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;!--
The data is from KubeCon keynotes by Chris Aniszczyk, CTO of Cloud Native Computing Foundation,
on September 26, 2023. This probably understates Chinese contributions. A lot of Chinese contributors
use VPNs and may not show up as being from China in the stats accurately.
--&gt;
&lt;p&gt;以上数据来自 CNCF 首席技术官 Chris Aniszczyk 在 2023 年 9 月 26 日 KubeCon 的主题演讲。
另外，由于大量中国贡献者使用 VPN 连接社区，这些统计数据可能与真实数据有所差异。&lt;/p&gt;&lt;/div&gt;

&lt;!--
The Kubernetes Contributor Summit is an inclusive meetup that welcomes all community contributors, including:

- New Contributors
- Current Contributors
  - docs
  - code
  - community management
- Subproject members
- Members of Special Interest Group (SIG) / Working Group (WG)
- Active Contributors
- Casual Contributors
--&gt;
&lt;p&gt;Kubernetes 贡献者峰会是一个自由开放的 Meetup，欢迎社区所有贡献者参与：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;新人&lt;/li&gt;
&lt;li&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;/li&gt;
&lt;li&gt;子项目 Owner 和参与者&lt;/li&gt;
&lt;li&gt;特别兴趣小组（SIG）或工作小组（WG）人员&lt;/li&gt;
&lt;li&gt;活跃的贡献者&lt;/li&gt;
&lt;li&gt;临时贡献者&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Acknowledgments

We would like to express our gratitude to the organizers of this event:

- [Kevin Wang](https://github.com/kevin-wangzefeng), the co-chair of KubeCon and the lead of the kubernetes contributor summit.
- [Paco Xu](https://github.com/pacoxu), who actively coordinated the venue, meals, invited contributors from both China and
  international sources, and established WeChat groups to collect agenda topics. They also shared details of the event
  before and after its occurrence through [pre and post announcements](https://github.com/kubernetes/community/issues/7510).
- [Mengjiao Liu](https://github.com/mengjiao-liu), who was responsible for organizing, coordinating,
  and facilitating various matters related to the summit.
--&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/kevin-wangzefeng&#34;&gt;Kevin Wang&lt;/a&gt; 是本次 KubeCon 活动的联席主席，也是贡献者峰会的负责人&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/pacoxu&#34;&gt;Paco Xu&lt;/a&gt; 积极联络场地餐食，联系和邀请国内外贡献者，建立微信群征集议题，
&lt;a href=&#34;https://github.com/kubernetes/community/issues/7510&#34;&gt;会前会后公示活动细节&lt;/a&gt;等&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/mengjiao-liu&#34;&gt;Mengjiao Liu&lt;/a&gt; 负责组织协调和联络事宜&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
We extend our appreciation to all the contributors who attended the China Kubernetes Contributor Summit in Shanghai.
Your dedication and commitment to the Kubernetes community are invaluable.
Together, we continue to push the boundaries of cloud native technology and shape the future of this ecosystem.
--&gt;
&lt;p&gt;我们衷心感谢所有参加在上海举办的中国 Kubernetes 贡献者峰会的贡献者们。
你们对 Kubernetes 社区的奉献和承诺是无价之宝。
让我们携手共进，继续推动云原生技术的边界，塑造这个生态系统的未来。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>CRI-O 正迁移至 pkgs.k8s.io</title>
      <link>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/10/cri-o-community-package-infrastructure/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/10/cri-o-community-package-infrastructure/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;CRI-O is moving towards pkgs.k8s.io&#34;
date: 2023-10-10
slug: cri-o-community-package-infrastructure
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Sascha Grunert&lt;/p&gt;
&lt;!--
**Author:** Sascha Grunert
--&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
The Kubernetes community [recently announced](/blog/2023/08/31/legacy-package-repository-deprecation/) that their legacy package repositories are frozen, and now they moved to [introduced community-owned package repositories](/blog/2023/08/15/pkgs-k8s-io-introduction) powered by the [OpenBuildService (OBS)](https://build.opensuse.org/project/subprojects/isv:kubernetes). CRI-O has a long history of utilizing [OBS for their package builds](https://github.com/cri-o/cri-o/blob/e292f17/install.md#install-packaged-versions-of-cri-o), but all of the packaging efforts have been done manually so far.
--&gt;
&lt;p&gt;Kubernetes 社区&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/&#34;&gt;最近宣布&lt;/a&gt;旧的软件包仓库已被冻结，
现在这些软件包将被迁移到由 &lt;a href=&#34;https://build.opensuse.org/project/subprojects/isv:kubernetes&#34;&gt;OpenBuildService（OBS）&lt;/a&gt;
提供支持的&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/blog/2023/08/15/pkgs-k8s-io-introduction&#34;&gt;社区自治软件包仓库&lt;/a&gt;中。
很久以来，CRI-O 一直在利用 &lt;a href=&#34;https://github.com/cri-o/cri-o/blob/e292f17/install.md#install-packaged-versions-of-cri-o&#34;&gt;OBS 进行软件包构建&lt;/a&gt;，
但到目前为止，所有打包工作都是手动完成的。&lt;/p&gt;
&lt;!--
The CRI-O community absolutely loves Kubernetes, which means that they&#39;re delighted to announce that:
--&gt;
&lt;p&gt;CRI-O 社区非常喜欢 Kubernetes，这意味着他们很高兴地宣布：&lt;/p&gt;
&lt;!--
**All future CRI-O packages will be shipped as part of the officially supported Kubernetes infrastructure hosted on pkgs.k8s.io!**
--&gt;
&lt;p&gt;&lt;strong&gt;所有未来的 CRI-O 包都将作为在 pkgs.k8s.io 上托管的官方支持的 Kubernetes 基础设施的一部分提供！&lt;/strong&gt;&lt;/p&gt;
&lt;!--
There will be a deprecation phase for the existing packages, which is currently being [discussed in the CRI-O community](https://github.com/cri-o/cri-o/discussions/7315). The new infrastructure will only support releases of CRI-O `&gt;= v1.28.2` as well as release branches newer than `release-1.28`.
--&gt;
&lt;p&gt;现有软件包将进入一个弃用阶段，目前正在
&lt;a href=&#34;https://github.com/cri-o/cri-o/discussions/7315&#34;&gt;CRI-O 社区中讨论&lt;/a&gt;。
新的基础设施将仅支持 CRI-O &lt;code&gt;&amp;gt;= v1.28.2&lt;/code&gt; 的版本以及比 &lt;code&gt;release-1.28&lt;/code&gt; 新的版本分支。&lt;/p&gt;
&lt;!--
## How to use the new packages
--&gt;
&lt;h2 id=&#34;how-to-use-the-new-packages&#34;&gt;如何使用新软件包 &lt;/h2&gt;
&lt;!--
In the same way as the Kubernetes community, CRI-O provides `deb` and `rpm` packages as part of a dedicated subproject in OBS, called [`isv:kubernetes:addons:cri-o`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o). This project acts as an umbrella and provides `stable` (for CRI-O tags) as well as `prerelease` (for CRI-O `release-1.y` and `main` branches) package builds.
--&gt;
&lt;p&gt;与 Kubernetes 社区一样，CRI-O 提供 &lt;code&gt;deb&lt;/code&gt; 和 &lt;code&gt;rpm&lt;/code&gt; 软件包作为 OBS 中专用子项目的一部分，
被称为 &lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o&lt;/code&gt;&lt;/a&gt;。
这个项目是一个集合，提供 &lt;code&gt;stable&lt;/code&gt;（针对 CRI-O 标记）以及 &lt;code&gt;prerelease&lt;/code&gt;（针对 CRI-O &lt;code&gt;release-1.y&lt;/code&gt; 和 &lt;code&gt;main&lt;/code&gt; 分支）版本的软件包。&lt;/p&gt;
&lt;!--
**Stable Releases:**
--&gt;
&lt;p&gt;&lt;strong&gt;稳定版本：&lt;/strong&gt;&lt;/p&gt;
&lt;!--
- [`isv:kubernetes:addons:cri-o:stable`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable): Stable Packages
  - [`isv:kubernetes:addons:cri-o:stable:v1.29`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable:v1.29): `v1.29.z` tags
  - [`isv:kubernetes:addons:cri-o:stable:v1.28`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable:v1.28): `v1.28.z` tags
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:stable&lt;/code&gt;&lt;/a&gt;：稳定软件包
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable:v1.29&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:stable:v1.29&lt;/code&gt;&lt;/a&gt;：&lt;code&gt;v1.29.z&lt;/code&gt; 标记&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:stable:v1.28&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:stable:v1.28&lt;/code&gt;&lt;/a&gt;：&lt;code&gt;v1.28.z&lt;/code&gt; 标记&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**Prereleases:**
--&gt;
&lt;p&gt;&lt;strong&gt;预发布版本：&lt;/strong&gt;&lt;/p&gt;
&lt;!--
- [`isv:kubernetes:addons:cri-o:prerelease`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease): Prerelease Packages
  - [`isv:kubernetes:addons:cri-o:prerelease:main`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:main): [`main`](https://github.com/cri-o/cri-o/commits/main) branch
  - [`isv:kubernetes:addons:cri-o:prerelease:v1.29`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:v1.29): [`release-1.29`](https://github.com/cri-o/cri-o/commits/release-1.29) branch
  - [`isv:kubernetes:addons:cri-o:prerelease:v1.28`](https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:v1.28): [`release-1.28`](https://github.com/cri-o/cri-o/commits/release-1.28) branch
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:prerelease&lt;/code&gt;&lt;/a&gt;：预发布软件包
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:main&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:prerelease:main&lt;/code&gt;&lt;/a&gt;：
&lt;a href=&#34;https://github.com/cri-o/cri-o/commits/main&#34;&gt;&lt;code&gt;main&lt;/code&gt;&lt;/a&gt; 分支&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:v1.29&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:prerelease:v1.29&lt;/code&gt;&lt;/a&gt;：
&lt;a href=&#34;https://github.com/cri-o/cri-o/commits/release-1.29&#34;&gt;&lt;code&gt;release-1.29&lt;/code&gt;&lt;/a&gt; 分支&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://build.opensuse.org/project/show/isv:kubernetes:addons:cri-o:prerelease:v1.28&#34;&gt;&lt;code&gt;isv:kubernetes:addons:cri-o:prerelease:v1.28&lt;/code&gt;&lt;/a&gt;：
&lt;a href=&#34;https://github.com/cri-o/cri-o/commits/release-1.28&#34;&gt;&lt;code&gt;release-1.28&lt;/code&gt;&lt;/a&gt; 分支&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
There are no stable releases available in the v1.29 repository yet, because v1.29.0 will be released in December. The CRI-O community will also **not** support release branches older than `release-1.28`, because there have been CI requirements merged into `main` which could be only backported to `release-1.28` with appropriate efforts.
--&gt;
&lt;p&gt;v1.29 仓库中尚无可用的稳定版本，因为 v1.29.0 将于 12 月发布。
CRI-O 社区也&lt;strong&gt;不&lt;/strong&gt;支持早于 &lt;code&gt;release-1.28&lt;/code&gt; 的版本分支，
因为已经有 CI 需求合并到 &lt;code&gt;main&lt;/code&gt; 中，只有通过适当的努力才能向后移植到 &lt;code&gt;release-1.28&lt;/code&gt;。&lt;/p&gt;
&lt;!--
For example, If an end-user would like to install the latest available version of the CRI-O `main` branch, then they can add the repository in the same way as they do for Kubernetes.
--&gt;
&lt;p&gt;例如，如果最终用户想要安装 CRI-O &lt;code&gt;main&lt;/code&gt; 分支的最新可用版本，
那么他们可以按照与 Kubernetes 相同的方式添加仓库。&lt;/p&gt;
&lt;!--
### `rpm` Based Distributions
--&gt;
&lt;h3 id=&#34;rpm-based-distributions&#34;&gt;基于 &lt;code&gt;rpm&lt;/code&gt; 的发行版 &lt;/h3&gt;
&lt;!--
For `rpm` based distributions, you can run the following commands as a `root` user to install CRI-O together with Kubernetes:
--&gt;
&lt;p&gt;对于基于 &lt;code&gt;rpm&lt;/code&gt; 的发行版，您可以以 &lt;code&gt;root&lt;/code&gt;
用户身份运行以下命令来将 CRI-O 与 Kubernetes 一起安装：&lt;/p&gt;
&lt;!--
#### Add the Kubernetes repo
--&gt;
&lt;h4 id=&#34;add-the-kubernetes-repo&#34;&gt;添加 Kubernetes 仓库 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat &lt;span style=&#34;color:#b44&#34;&gt;&amp;lt;&amp;lt;EOF | tee /etc/yum.repos.d/kubernetes.repo
&lt;/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;[kubernetes]
&lt;/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;name=Kubernetes
&lt;/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;baseurl=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/
&lt;/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;enabled=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:#b44&#34;&gt;gpgcheck=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:#b44&#34;&gt;gpgkey=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key
&lt;/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;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Add the CRI-O repo
--&gt;
&lt;h4 id=&#34;add-the-cri-o-repo&#34;&gt;添加 CRI-O 仓库 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat &lt;span style=&#34;color:#b44&#34;&gt;&amp;lt;&amp;lt;EOF | tee /etc/yum.repos.d/cri-o.repo
&lt;/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;[cri-o]
&lt;/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;name=CRI-O
&lt;/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;baseurl=https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/rpm/
&lt;/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;enabled=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:#b44&#34;&gt;gpgcheck=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:#b44&#34;&gt;gpgkey=https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/rpm/repodata/repomd.xml.key
&lt;/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;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Install official package dependencies
--&gt;
&lt;h4 id=&#34;install-official-package-dependencies&#34;&gt;安装官方包依赖 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dnf install -y &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    conntrack &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    container-selinux &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    ebtables &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    ethtool &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    iptables &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    socat
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Install the packages from the added repos
--&gt;
&lt;h4 id=&#34;install-the-packages-from-the-added-repos&#34;&gt;从添加的仓库中安装软件包 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dnf install -y --repo cri-o --repo kubernetes &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    cri-o &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    kubeadm &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    kubectl &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;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    kubelet
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### `deb` Based Distributions
--&gt;
&lt;h3 id=&#34;deb-based-distributions&#34;&gt;基于 &lt;code&gt;deb&lt;/code&gt; 的发行版 &lt;/h3&gt;
&lt;!--
For `deb` based distributions, you can run the following commands as a `root` user:
--&gt;
&lt;p&gt;对于基于 &lt;code&gt;deb&lt;/code&gt; 的发行版，您可以以 &lt;code&gt;root&lt;/code&gt; 用户身份运行以下命令：&lt;/p&gt;
&lt;!--
#### Install dependencies for adding the repositories
--&gt;
&lt;h4 id=&#34;install-dependencies-for-adding-the-repositories&#34;&gt;安装用于添加仓库的依赖项 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get install -y software-properties-common curl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Add the Kubernetes repository
--&gt;
&lt;h4 id=&#34;add-the-kubernetes-repository&#34;&gt;添加 Kubernetes 仓库 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /&amp;#34;&lt;/span&gt; |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    tee /etc/apt/sources.list.d/kubernetes.list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Add the CRI-O repository
--&gt;
&lt;h4 id=&#34;add-the-cri-o-repository&#34;&gt;添加 CRI-O 仓库 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/Release.key |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/ /&amp;#34;&lt;/span&gt; |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    tee /etc/apt/sources.list.d/cri-o.list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Install the packages
--&gt;
&lt;h4 id=&#34;install-the-packages&#34;&gt;安装软件包 &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get install -y cri-o kubelet kubeadm kubectl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
#### Start CRI-O
--&gt;
&lt;h4 id=&#34;start-cri-o&#34;&gt;启动 CRI-O &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-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;systemctl start crio.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The Project&#39;s `prerelease:/main` prefix at the CRI-O&#39;s package path, can be replaced with `stable:/v1.28`, `stable:/v1.29`, `prerelease:/v1.28` or `prerelease:/v1.29` if another stream package is used.
--&gt;
&lt;p&gt;如果使用的是另一个包序列，CRI-O 包路径中项目的 &lt;code&gt;prerelease:/main&lt;/code&gt;
前缀可以替换为 &lt;code&gt;stable:/v1.28&lt;/code&gt;、&lt;code&gt;stable:/v1.29&lt;/code&gt;、&lt;code&gt;prerelease:/v1.28&lt;/code&gt; 或 &lt;code&gt;prerelease :/v1.29&lt;/code&gt;。&lt;/p&gt;
&lt;!--
Bootstrapping [a cluster using `kubeadm`](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) can be done by running `kubeadm init` command, which automatically detects that CRI-O is running in the background. There are also `Vagrantfile` examples available for [Fedora 38](https://github.com/cri-o/packaging/blob/91df5f7/test/rpm/Vagrantfile) as well as [Ubuntu 22.04](https://github.com/cri-o/packaging/blob/91df5f7/test/deb/Vagrantfile) for testing the packages together with `kubeadm`.
--&gt;
&lt;p&gt;你可以使用 &lt;code&gt;kubeadm init&lt;/code&gt; 命令来&lt;a href=&#34;https://deploy-preview-50011--kubernetes-io-main-staging.netlify.app/docs/setup/product-environment/tools/kubeadm/install-kubeadm/&#34;&gt;引导集群&lt;/a&gt;，
该命令会自动检测后台正在运行 CRI-O。还有适用于
&lt;a href=&#34;https://github.com/cri-o/packaging/blob/91df5f7/test/rpm/Vagrantfile&#34;&gt;Fedora 38&lt;/a&gt;
以及 &lt;a href=&#34;https://github.com/cri-o/packaging/blob/91df5f7/test/deb/Vagrantfile&#34;&gt;Ubuntu 22.04&lt;/a&gt;
的 &lt;code&gt;Vagrantfile&lt;/code&gt; 示例，可在使用 &lt;code&gt;kubeadm&lt;/code&gt; 的场景中测试下载的软件包。&lt;/p&gt;
&lt;!--
## How it works under the hood
--&gt;
&lt;h2 id=&#34;how-it-works-under-the-hood&#34;&gt;它是如何工作的 &lt;/h2&gt;
&lt;!--
Everything related to these packages lives in the new [CRI-O packaging repository](https://github.com/cri-o/packaging). It contains a [daily reconciliation](https://github.com/cri-o/packaging/blob/91df5f7/.github/workflows/schedule.yml) GitHub action workflow, for all supported release branches as well as tags of CRI-O. A [test pipeline](https://github.com/cri-o/packaging/actions/workflows/obs.yml) in the OBS workflow ensures that the packages can be correctly installed and used before being published. All of the staging and publishing of the packages is done with the help of the [Kubernetes Release Toolbox (krel)](https://github.com/kubernetes/release/blob/1f85912/docs/krel/README.md), which is also used for the official Kubernetes `deb` and `rpm` packages.
--&gt;
&lt;p&gt;与这些包相关的所有内容都位于新的 &lt;a href=&#34;https://github.com/cri-o/packaging&#34;&gt;CRI-O 打包仓库&lt;/a&gt;中。
它包含 &lt;a href=&#34;https://github.com/cri-o/packaging/blob/91df5f7/.github/workflows/schedule.yml&#34;&gt;Daily Reconciliation&lt;/a&gt; GitHub 工作流，
支持所有发布分支以及 CRI-O 标签。
OBS 工作流程中的&lt;a href=&#34;https://github.com/cri-o/packaging/actions/workflows/obs.yml&#34;&gt;测试管道&lt;/a&gt;确保包在发布之前可以被正确安装和使用。
所有包的暂存和发布都是在 &lt;a href=&#34;https://github.com/kubernetes/release/blob/1f85912/docs/krel/README.md&#34;&gt;Kubernetes 发布工具箱（krel）&lt;/a&gt;的帮助下完成的，
这一工具箱也被用于官方 Kubernetes &lt;code&gt;deb&lt;/code&gt; 和 &lt;code&gt;rpm&lt;/code&gt; 软件包。&lt;/p&gt;
&lt;!--
The package build inputs will undergo daily reconciliation and will be supplied by CRI-O&#39;s static binary bundles. These bundles are built and signed for each commit in the CRI-O CI, and contain everything CRI-O requires to run on a certain architecture. The static builds are reproducible, powered by [nixpkgs](https://github.com/NixOS/nixpkgs) and available only for `x86_64`, `aarch64` and `ppc64le` architecture.
--&gt;
&lt;p&gt;包构建的输入每天都会被动态调整，并使用 CRI-O 的静态二进制包。
这些包是基于 CRI-O CI 中的每次提交来构建和签名的，
并且包含 CRI-O 在特定架构上运行所需的所有内容。静态构建是可重复的，
由 &lt;a href=&#34;https://github.com/NixOS/nixpkgs&#34;&gt;nixpkgs&lt;/a&gt; 提供支持，
并且仅适用于 &lt;code&gt;x86_64&lt;/code&gt;、&lt;code&gt;aarch64&lt;/code&gt; 以及 &lt;code&gt;ppc64le&lt;/code&gt; 架构。&lt;/p&gt;
&lt;!--
The CRI-O maintainers will be happy to listen to any feedback or suggestions on the new packaging efforts! Thank you for reading this blog post, feel free to reach out to the maintainers via the Kubernetes [Slack channel #crio](https://kubernetes.slack.com/messages/CAZH62UR1) or create an issue in the [packaging repository](https://github.com/cri-o/packaging/issues).
--&gt;
&lt;p&gt;CRI-O 维护者将很乐意听取有关新软件包工作情况的任何反馈或建议！
感谢您阅读本文，请随时通过 Kubernetes &lt;a href=&#34;https://kubernetes.slack.com/messages/CAZH62UR1&#34;&gt;Slack 频道 #crio&lt;/a&gt;
联系维护人员或在&lt;a href=&#34;https://github.com/cri-o/packaging/issues&#34;&gt;打包仓库&lt;/a&gt;中创建 Issue。&lt;/p&gt;

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