<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kubernetes Blog</title>
    <link>https://deploy-preview-57407--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-57407--kubernetes-io-main-staging.netlify.app/zh-cn/</link>
    </image>
    
    <atom:link href="https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/feed.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Kubernetes 1.29: 解耦污点管理器与节点生命周期控制器</title>
      <link>https://deploy-preview-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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;!--
**Author**: Sunny Song (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Sunny Song (Google)&lt;/p&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;disk-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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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 src=&#34;gateway-api-logo.png&#34; alt=&#34;Gateway API Logo&#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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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-57407--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 note callout&#34; role=&#34;alert&#34;&gt;
  &lt;strong&gt;说明：&lt;/strong&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;/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-57407--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-57407--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-57407--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-57407--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-57407--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>
    
    <item>
      <title>聚焦 SIG Architecture: Conformance</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/05/sig-architecture-conformance-spotlight-2023/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/05/sig-architecture-conformance-spotlight-2023/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG Architecture: Conformance&#34;
slug: sig-architecture-conformance-spotlight-2023
date: 2023-10-05
canonicalUrl: https://www.k8s.dev/blog/2023/10/05/sig-architecture-conformance-spotlight-2023/
--&gt;
&lt;!--
**Author**: 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;：&lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt; (DaoCloud)&lt;/p&gt;
&lt;!--
_This is the first interview of a SIG Architecture Spotlight series
that will cover the different subprojects. We start with the SIG
Architecture: Conformance subproject_

In this [SIG
Architecture](https://github.com/kubernetes/community/blob/master/sig-architecture/README.md)
spotlight, we talked with [Riaan
Kleinhans](https://github.com/Riaankl) (ii-Team), Lead for the
[Conformance
sub-project](https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#conformance-definition-1).
--&gt;
&lt;p&gt;&lt;strong&gt;这是 SIG Architecture 焦点访谈系列的首次采访，这一系列访谈将涵盖多个子项目。
我们从 SIG Architecture：Conformance 子项目开始。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在本次 &lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-architecture/README.md&#34;&gt;SIG Architecture&lt;/a&gt;
访谈中，我们与 &lt;a href=&#34;https://github.com/Riaankl&#34;&gt;Riaan Kleinhans&lt;/a&gt; (ii-Team) 进行了对话，他是
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#conformance-definition-1&#34;&gt;Conformance 子项目&lt;/a&gt;的负责人。&lt;/p&gt;
&lt;!--
## About SIG Architecture and the Conformance subproject

**Frederico (FSM)**: Hello Riaan, and welcome! For starters, tell us a
bit about yourself, your role and how you got involved in Kubernetes.

**Riaan Kleinhans (RK)**: Hi! My name is Riaan Kleinhans and I live in
South Africa. I am the Project manager for the [ii-Team](ii.nz) in New
Zealand. When I joined ii the plan was to move to New Zealand in April
2020 and then Covid happened. Fortunately, being a flexible and
dynamic team we were able to make it work remotely and in very
different time zones.
--&gt;
&lt;h2 id=&#34;关于-sig-architecture-和-conformance-子项目&#34;&gt;关于 SIG Architecture 和 Conformance 子项目&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Frederico (FSM)&lt;/strong&gt;：你好 Riaan，欢迎！首先，请介绍一下你自己，你的角色以及你是如何参与 Kubernetes 的。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Riaan Kleinhans (RK)&lt;/strong&gt;：嗨！我叫 Riaan Kleinhans，我住在南非。
我是新西兰 &lt;a href=&#34;ii.nz&#34;&gt;ii-Team&lt;/a&gt; 的项目经理。在我加入 ii 时，本来计划在 2020 年 4 月搬到新西兰，
然后新冠疫情爆发了。幸运的是，作为一个灵活和富有活力的团队，我们能够在各个不同的时区以远程方式协作。&lt;/p&gt;
&lt;!--
The ii team have been tasked with managing the Kubernetes Conformance
testing technical debt and writing tests to clear the technical
debt. I stepped into the role of project manager to be the link
between monitoring, test writing and the community. Through that work
I had the privilege of meeting [Dan Kohn](https://github.com/dankohn)
in those first months, his enthusiasm about the work we were doing was
a great inspiration.
--&gt;
&lt;p&gt;ii 团队负责管理 Kubernetes Conformance 测试的技术债务，并编写测试内容来消除这些技术债务。
我担任项目经理的角色，成为监控、测试内容编写和社区之间的桥梁。通过这项工作，我有幸在最初的几个月里结识了
&lt;a href=&#34;https://github.com/dankohn&#34;&gt;Dan Kohn&lt;/a&gt;，他对我们的工作充满热情，给了我很大的启发。&lt;/p&gt;
&lt;!--
**FSM**: Thank you - so, your involvement in SIG Architecture started
because of the conformance work?

**RK**: SIG Architecture is the home for the Kubernetes Conformance
subproject. Initially, most of my interactions were directly with SIG
Architecture through the Conformance sub-project. However, as we
began organizing the work by SIG, we started engaging directly with
each individual SIG. These engagements with the SIGs that own the
untested APIs have helped us accelerate our work.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：谢谢！所以，你参与 SIG Architecture 是因为合规性的工作？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：SIG Architecture 负责管理 Kubernetes Conformance 子项目。
最初，我大部分时间直接与 SIG Architecture 交流 Conformance 子项目。
然而，随着我们开始按 SIG 来组织工作任务，我们开始直接与各个 SIG 进行协作。
与拥有未被测试的 API 的这些 SIG 的协作帮助我们加快了工作进度。&lt;/p&gt;
&lt;!--
**FSM**: How would you describe the main goals and
areas of intervention of the Conformance sub-project?

**RM**: The Kubernetes Conformance sub-project focuses on guaranteeing
compatibility and adherence to the Kubernetes specification by
developing and maintaining a comprehensive conformance test suite. Its
main goals include assuring compatibility across different Kubernetes
implementations, verifying adherence to the API specification,
supporting the ecosystem by encouraging conformance certification, and
fostering collaboration within the Kubernetes community. By providing
standardised tests and promoting consistent behaviour and
functionality, the Conformance subproject ensures a reliable and
compatible Kubernetes ecosystem for developers and users alike.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：你如何描述 Conformance 子项目的主要目标和介入的领域？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RM&lt;/strong&gt;: Kubernetes Conformance 子项目专注于通过开发和维护全面的合规性测试套件来确保兼容性并遵守
Kubernetes 规范。其主要目标包括确保不同 Kubernetes 实现之间的兼容性，验证 API 规范的遵守情况，
通过鼓励合规性认证来支持生态体系，并促进 Kubernetes 社区内的合作。
通过提供标准化的测试并促进一致的行为和功能，
Conformance 子项目为开发人员和用户提供了一个可靠且兼容的 Kubernetes 生态体系。&lt;/p&gt;
&lt;!--
## More on the Conformance Test Suite

**FSM**: A part of providing those standardised tests is, I believe,
the [Conformance Test
Suite](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md). Could
you explain what it is and its importance?

**RK**: The Kubernetes Conformance Test Suite checks if Kubernetes
distributions meet the project&#39;s specifications, ensuring
compatibility across different implementations. It covers various
features like APIs, networking, storage, scheduling, and
security. Passing the tests confirms proper implementation and
promotes a consistent and portable container orchestration platform.
--&gt;
&lt;h2 id=&#34;关于-conformance-test-suite-的更多内容&#34;&gt;关于 Conformance Test Suite 的更多内容&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：我认为，提供这些标准化测试的一部分工作在于
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md&#34;&gt;Conformance Test Suite&lt;/a&gt;。
你能解释一下它是什么以及其重要性吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：Kubernetes Conformance Test Suite 检查 Kubernetes 发行版是否符合项目的规范，
确保在不同的实现之间的兼容性。它涵盖了诸如 API、联网、存储、调度和安全等各个特性。
能够通过测试，则表示实现合理，便于推动构建一致且可移植的容器编排平台。&lt;/p&gt;
&lt;!--
**FSM**: Right, the tests are important in the way they define the
minimum features that any Kubernetes cluster must support. Could you
describe the process around determining which features are considered
for inclusion? Is there any tension between a more minimal approach,
and proposals from the other SIGs?

**RK**: The requirements for each endpoint that undergoes conformance
testing are clearly defined by SIG Architecture. Only API endpoints
that are generally available and non-optional features are eligible
for conformance. Over the years, there have been several discussions
regarding conformance profiles, exploring the possibility of including
optional endpoints like RBAC, which are widely used by most end users,
in specific profiles. However, this aspect is still a work in
progress.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：是的，这些测试很重要，因为它们定义了所有 Kubernetes 集群必须支持的最小特性集合。
你能描述一下决定将哪些特性包含在内的过程吗？在最小特性集的思路与其他 SIG 提案之间是否有所冲突？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：SIG Architecture 针对经受合规性测试的每个端点的要求，都有明确的定义。
API 端点只有正式发布且不是可选的特性，才会被（进一步）考虑是否合规。
多年来，关于合规性配置文件已经进行了若干讨论，
探讨将被大多数终端用户广泛使用的可选端点（例如 RBAC）纳入特定配置文件中的可能性。
然而，这一方面仍在不断改进中。&lt;/p&gt;
&lt;!--
Endpoints that do not meet the conformance criteria are listed in
[ineligible_endpoints.yaml](https://github.com/kubernetes/kubernetes/blob/master/test/conformance/testdata/ineligible_endpoints.yaml),
which is publicly accessible in the Kubernetes repo. This file can be
updated to add or remove endpoints as their status or requirements
change. These ineligible endpoints are also visible on
[APISnoop](https://apisnoop.cncf.io/).

Ensuring transparency and incorporating community input regarding the
eligibility or ineligibility of endpoints is of utmost importance to
SIG Architecture.
--&gt;
&lt;p&gt;不满足合规性标准的端点被列在
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/master/test/conformance/testdata/ineligible_endpoints.yaml&#34;&gt;ineligible_endpoints.yaml&lt;/a&gt; 中，
该文件放在 Kubernetes 代码仓库中，是被公开访问的。
随着这些端点的状态或要求发生变化，此文件可能会被更新以添加或删除端点。
不合格的端点也可以在 &lt;a href=&#34;https://apisnoop.cncf.io/&#34;&gt;APISnoop&lt;/a&gt; 上看到。&lt;/p&gt;
&lt;p&gt;对于 SIG Architecture 来说，确保透明度并纳入社区意见以确定端点的合格或不合格状态是至关重要的。&lt;/p&gt;
&lt;!--
**FSM**: Writing tests for new features is something generally
requires some kind of enforcement. How do you see the evolution of
this in Kubernetes? Was there a specific effort to improve the process
in a way that required tests would be a first-class citizen, or was
that never an issue?

**RK**: When discussions surrounding the Kubernetes conformance
programme began in 2018, only approximately 11% of endpoints were
covered by tests. At that time, the CNCF&#39;s governing board requested
that if funding were to be provided for the work to cover missing
conformance tests, the Kubernetes Community should adopt a policy of
not allowing new features to be added unless they include conformance
tests for their stable APIs.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：为新特性编写测试内容通常需要某种强制执行方式。
你如何看待 Kubernetes 中这方面的演变？是否有人在努力改进这个流程，
使得必须具备测试成为头等要务，或许这从来都不是一个问题？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：在 2018 年开始围绕 Kubernetes 合规性计划进行讨论时，只有大约 11% 的端点被测试所覆盖。
那时，CNCF 的管理委员会提出一个要求，如果要提供资金覆盖缺失的合规性测试，Kubernetes 社区应采取一个策略，
即如果新特性没有包含稳定 API 的合规性测试，则不允许添加此特性。&lt;/p&gt;
&lt;!--
SIG Architecture is responsible for stewarding this requirement, and
[APISnoop](https://apisnoop.cncf.io/) has proven to be an invaluable
tool in this regard. Through automation, APISnoop generates a pull
request every weekend to highlight any discrepancies in Conformance
coverage. If any endpoints are promoted to General Availability
without a conformance test, it will be promptly identified. This
approach helps prevent the accumulation of new technical debt.

Additionally, there are plans in the near future to create a release
informing job, which will add an additional layer to prevent any new
technical debt.
--&gt;
&lt;p&gt;SIG Architecture 负责监督这一要求，&lt;a href=&#34;https://apisnoop.cncf.io/&#34;&gt;APISnoop&lt;/a&gt;
在此方面被证明是一个非常有价值的工具。通过自动化流程，APISnoop 在每个周末生成一个 PR，
以突出 Conformance 覆盖范围的变化。如果有端点在没有进行合规性测试的情况下进阶至正式发布，
将会被迅速识别发现。这种方法有助于防止积累新的技术债务。&lt;/p&gt;
&lt;p&gt;此外，我们计划在不久的将来创建一个发布通知任务，作用是添加额外一层防护，以防止产生新的技术债务。&lt;/p&gt;
&lt;!--
**FSM**: I see, tooling and automation play an important role
there. What are, in your opinion, the areas that, conformance-wise,
still require some work to be done? In other words, what are the
current priority areas marked for improvement?

**RK**: We have reached the “100% Conformance Tested” milestone in
release 1.27!
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：我明白了，工具化和自动化在其中起着重要的作用。
在你看来，就合规性而言，还有哪些领域需要做一些工作？
换句话说，目前标记为优先改进的领域有哪些？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：在 1.27 版本中，我们已完成了 “100% 合规性测试” 的里程碑！&lt;/p&gt;
&lt;!--
At that point, the community took another look at all the endpoints
that were listed as ineligible for conformance. The list was populated
through community input over several years.  Several endpoints
that were previously deemed ineligible for conformance have been
identified and relocated to a new dedicated list, which is currently
receiving focused attention for conformance test development. Again,
that list can also be checked on apisnoop.cncf.io.
--&gt;
&lt;p&gt;当时，社区重新审视了所有被列为不合规的端点。这个列表是收集多年的社区意见后填充的。
之前被认为不合规的几个端点已被挑选出来并迁移到一个新的专用列表中，
该列表中包含目前合规性测试开发的焦点。同样，可以在 apisnoop.cncf.io 上查阅此列表。&lt;/p&gt;
&lt;!--
To ensure the avoidance of new technical debt in the conformance
project, there are upcoming plans to establish a release informing job
as an additional preventive measure.

While APISnoop is currently hosted on CNCF infrastructure, the project
has been generously donated to the Kubernetes community. Consequently,
it will be transferred to community-owned infrastructure before the
end of 2023.
--&gt;
&lt;p&gt;为了确保在合规性项目中避免产生新的技术债务，我们计划建立一个发布通知任务作为额外的预防措施。&lt;/p&gt;
&lt;p&gt;虽然 APISnoop 目前被托管在 CNCF 基础设施上，但此项目已慷慨地捐赠给了 Kubernetes 社区。
因此，它将在 2023 年底之前转移到社区自治的基础设施上。&lt;/p&gt;
&lt;!--
**FSM**: That&#39;s great news! For anyone wanting to help, what are the
venues for collaboration that you would highlight? Do all of them
require solid knowledge of Kubernetes as a whole, or are there ways
someone newer to the project can contribute?

**RK**: Contributing to conformance testing is akin to the task of
&#34;washing the dishes&#34; – it may not be highly visible, but it remains
incredibly important. It necessitates a strong understanding of
Kubernetes, particularly in the areas where the endpoints need to be
tested. This is why working with each SIG that owns the API endpoint
being tested is so important.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：这是个好消息！对于想要提供帮助的人们，你能否重点说明一下协作的价值所在？
参与贡献是否需要对 Kubernetes 有很扎实的知识，或否有办法让一些新人也能为此项目做出贡献？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：参与合规性测试就像 &amp;quot;洗碗&amp;quot; 一样，它可能不太显眼，但仍然非常重要。
这需要对 Kubernetes 有深入的理解，特别是在需要对端点进行测试的领域。
这就是为什么与负责测试 API 端点的每个 SIG 进行协作会如此重要。&lt;/p&gt;
&lt;!--
As part of our commitment to making test writing accessible to
everyone, the ii team is currently engaged in the development of a
&#34;click and deploy&#34; solution. This solution aims to enable anyone to
swiftly create a working environment on real hardware within
minutes. We will share updates regarding this development as soon as
we are ready.
--&gt;
&lt;p&gt;我们的承诺是让所有人都能参与测试内容编写，作为这一承诺的一部分，
ii 团队目前正在开发一个 “点击即部署（click and deploy）” 的解决方案。
此解决方案旨在使所有人都能在几分钟内快速创建一个在真实硬件上工作的环境。
我们将在准备好后分享有关此项开发的更新。&lt;/p&gt;
&lt;!--
**FSM**: That&#39;s very helpful, thank you. Any final comments you would
like to share with our readers?

**RK**: Conformance testing is a collaborative community endeavour that
involves extensive cooperation among SIGs. SIG Architecture has
spearheaded the initiative and provided guidance. However, the
progress of the work relies heavily on the support of all SIGs in
reviewing, enhancing, and endorsing the tests.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：那会非常有帮助，谢谢。最后你还想与我们的读者分享些什么见解吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;RK&lt;/strong&gt;：合规性测试是一个协作性的社区工作，涉及各个 SIG 之间的广泛合作。
SIG Architecture 在推动倡议并提供指导方面起到了领头作用。然而，
工作的进展在很大程度上依赖于所有 SIG 在审查、增强和认可测试方面的支持。&lt;/p&gt;
&lt;!--
I would like to extend my sincere appreciation to the ii team for
their unwavering commitment to resolving technical debt over the
years. In particular, [Hippie Hacker](https://github.com/hh)&#39;s
guidance and stewardship of the vision has been
invaluable. Additionally, I want to give special recognition to
Stephen Heywood for shouldering the majority of the test writing
workload in recent releases, as well as to Zach Mandeville for his
contributions to APISnoop.
--&gt;
&lt;p&gt;我要衷心感谢 ii 团队多年来对解决技术债务的坚定承诺。
特别要感谢 &lt;a href=&#34;https://github.com/hh&#34;&gt;Hippie Hacker&lt;/a&gt; 的指导和对愿景的引领作用，这是非常宝贵的。
此外，我还要特别表扬 Stephen Heywood 在最近几个版本中承担了大部分测试内容编写工作而做出的贡献，
还有 Zach Mandeville 对 APISnoop 也做了很好的贡献。&lt;/p&gt;
&lt;!--
**FSM**: Many thanks for your availability and insightful comments,
I&#39;ve personally learned quite a bit with it and I&#39;m sure our readers
will as well.
--&gt;
&lt;p&gt;&lt;strong&gt;FSM&lt;/strong&gt;：非常感谢你参加本次访谈并分享你的深刻见解，我本人从中获益良多，我相信读者们也会同样受益。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>公布 2023 年指导委员会选举结果</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/02/steering-committee-results-2023/</link>
      <pubDate>Mon, 02 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/10/02/steering-committee-results-2023/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Announcing the 2023 Steering Committee Election Results&#34;
date: 2023-10-02
slug: steering-committee-results-2023
--&gt;
&lt;!--
**Author**: Kaslin Fields
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Kaslin Fields&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Xin Li(DaoCloud)&lt;/p&gt;
&lt;!--
The [2023 Steering Committee Election](https://github.com/kubernetes/community/tree/master/events/elections/2023) is now complete.
The Kubernetes Steering Committee consists of 7 seats, 4 of which were up for election in 2023.
Incoming committee members serve a term of 2 years, and all members are elected by the Kubernetes Community.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/events/elections/2023&#34;&gt;2023 年指导委员会选举&lt;/a&gt;现已完成。
Kubernetes 指导委员会由 7 个席位组成，其中 4 个席位于 2023 年进行选举。
新任委员会成员的任期为 2 年，所有成员均由 Kubernetes 社区选举产生。&lt;/p&gt;
&lt;!--
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).
--&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;!--
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;/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;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;), 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;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;Bob Killen (&lt;a href=&#34;https://github.com/mrbobbytables&#34;&gt;@mrbobbytables&lt;/a&gt;), Google&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nabarun Pal (&lt;a href=&#34;https://github.com/palnabarun&#34;&gt;@palnabarun&lt;/a&gt;), VMware&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Stephen Augustus is a returning Steering Committee Member.
--&gt;
&lt;p&gt;Stephen Augustus 是回归的指导委员会成员。&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;Davanum Srinavas (&lt;a href=&#34;https://github.com/dims&#34;&gt;@dims&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Kaslin Fields (&lt;a href=&#34;https://github.com/kaslin&#34;&gt;@kaslin&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;Christoph Blecker (&lt;a href=&#34;https://github.com/cblecker&#34;&gt;@cblecker&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Carlos Tadeu Panato Jr. (&lt;a href=&#34;https://github.com/cpanato&#34;&gt;@cpanato&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tim Pepper (&lt;a href=&#34;https://github.com/tpepper&#34;&gt;@tpepper&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 [backlog items](https://github.com/orgs/kubernetes/projects/40) 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 9:30am 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;你可以关注指导委员会&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;太平洋时间每月第一个周一上午 9:30&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 at the [Kubernetes Contributor Summit in Chicago](https://k8s.dev/summit).
--&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;如果你想认识一些新当选的指导委员会成员，请参加我们在&lt;a href=&#34;https://k8s.dev/summit&#34;&gt;芝加哥 Kubernetes 贡献者峰会&lt;/a&gt;举行的 Steering AMA。&lt;/p&gt;
&lt;hr&gt;
&lt;!--
_This post was 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>kubeadm 七周年生日快乐！</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/26/happy-7th-birthday-kubeadm/</link>
      <pubDate>Tue, 26 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/26/happy-7th-birthday-kubeadm/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Happy 7th Birthday kubeadm!&#39;
date: 2023-09-26
slug: happy-7th-birthday-kubeadm
--&gt;
&lt;!--
**Author:** Fabrizio Pandini (VMware)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Fabrizio Pandini (VMware)&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;!--
What a journey so far!

Starting from the initial blog post [“How we made Kubernetes insanely easy to install”](/blog/2016/09/how-we-made-kubernetes-easy-to-install/) in September 2016, followed by an exciting growth that lead to general availability / [“Production-Ready Kubernetes Cluster Creation with kubeadm”](/blog/2018/12/04/production-ready-kubernetes-cluster-creation-with-kubeadm/) two years later.

And later on a continuous, steady and reliable flow of small improvements that is still going on as of today.
--&gt;
&lt;p&gt;回首向来萧瑟处，七年光阴风雨路！&lt;/p&gt;
&lt;p&gt;从 2016 年 9 月发表第一篇博文
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2016/09/how-we-made-kubernetes-easy-to-install/&#34;&gt;How we made Kubernetes insanely easy to install&lt;/a&gt;
开始，kubeadm 经历了令人激动的成长旅程，两年后随着
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2018/12/04/production-ready-kubernetes-cluster-creation-with-kubeadm/&#34;&gt;Production-Ready Kubernetes Cluster Creation with kubeadm&lt;/a&gt;
这篇博文的发表进阶为正式发布。&lt;/p&gt;
&lt;p&gt;此后，持续、稳定且可靠的系列小幅改进一直延续至今。&lt;/p&gt;
&lt;!--
## What is kubeadm? (quick refresher)

kubeadm is focused on bootstrapping Kubernetes clusters on existing infrastructure and performing an essential set of maintenance tasks. The core of the kubeadm interface is quite simple: new control plane nodes
are created by running [`kubeadm init`](/docs/reference/setup-tools/kubeadm/kubeadm-init/) and
worker nodes are joined to the control plane by running
[`kubeadm join`](/docs/reference/setup-tools/kubeadm/kubeadm-join/).
Also included are utilities for managing already bootstrapped clusters, such as control plane upgrades
and token and certificate renewal.
--&gt;
&lt;h2 id=&#34;什么是-kubeadm-简要回顾&#34;&gt;什么是 kubeadm？（简要回顾）&lt;/h2&gt;
&lt;p&gt;kubeadm 专注于在现有基础设施上启动引导 Kubernetes 集群并执行一组重要的维护任务。
kubeadm 接口的核心非常简单：通过运行
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-init/&#34;&gt;&lt;code&gt;kubeadm init&lt;/code&gt;&lt;/a&gt;
创建新的控制平面节点，通过运行
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-join/&#34;&gt;&lt;code&gt;kubeadm join&lt;/code&gt;&lt;/a&gt;
将工作节点加入控制平面。此外还有用于管理已启动引导的集群的实用程序，例如控制平面升级、令牌和证书续订等。&lt;/p&gt;
&lt;!--
To keep kubeadm lean, focused, and vendor/infrastructure agnostic, the following tasks are out of its scope:
- Infrastructure provisioning
- Third-party networking
- Non-critical add-ons, e.g. for monitoring, logging, and visualization
- Specific cloud provider integrations
--&gt;
&lt;p&gt;为了使 kubeadm 精简、聚焦且与供应商/基础设施无关，以下任务不包括在其范围内：&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;li&gt;特定云驱动集成&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Infrastructure provisioning, for example, is left to other SIG Cluster Lifecycle projects, such as the
[Cluster API](https://cluster-api.sigs.k8s.io/). Instead, kubeadm covers only the common denominator
in every Kubernetes cluster: the
[control plane](/docs/concepts/overview/components/#control-plane-components).
The user may install their preferred networking solution and other add-ons on top of Kubernetes
*after* cluster creation.
--&gt;
&lt;p&gt;例如，基础设施制备留给 SIG Cluster Lifecycle 等其他项目来处理，
比如 &lt;a href=&#34;https://cluster-api.sigs.k8s.io/&#34;&gt;Cluster API&lt;/a&gt;。
kubeadm 仅涵盖每个 Kubernetes 集群中的共同要素：
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/components/#control-plane-components&#34;&gt;控制平面&lt;/a&gt;。
用户可以在集群创建后安装其偏好的联网方案和其他插件。&lt;/p&gt;
&lt;!--
Behind the scenes, kubeadm does a lot. The tool makes sure you have all the key components:
etcd, the API server, the scheduler, the controller manager. You can join more control plane nodes
for improving resiliency or join worker nodes for running your workloads. You get cluster DNS
and kube-proxy set up for you. TLS between components is enabled and used for encryption in transit.
--&gt;
&lt;p&gt;kubeadm 在幕后做了大量工作。它确保你拥有所有关键组件：etcd、API 服务器、调度器、控制器管理器。
你可以加入更多的控制平面节点以提高容错性，或者加入工作节点以运行你的工作负载。
kubeadm 还为你设置好了集群 DNS 和 kube-proxy；在各组件之间启用 TLS 用于传输加密。&lt;/p&gt;
&lt;!--
## Let&#39;s celebrate! Past, present and future of kubeadm

In all and for all kubeadm&#39;s story is tightly coupled with Kubernetes&#39; story, and with this amazing community.

Therefore celebrating kubeadm is first of all celebrating this community, a set of people, who joined forces in finding a common ground, a minimum viable tool, for bootstrapping Kubernetes clusters.
--&gt;
&lt;h2 id=&#34;庆祝-kubeadm-的过去-现在和未来&#34;&gt;庆祝 kubeadm 的过去、现在和未来！&lt;/h2&gt;
&lt;p&gt;总之，kubeadm 的故事与 Kubernetes 深度耦合，也离不开这个令人惊叹的社区。&lt;/p&gt;
&lt;p&gt;因此庆祝 kubeadm 首先是庆祝这个社区，一群人共同努力寻找一个共同点，一个最小可行工具，用于启动引导 Kubernetes 集群。&lt;/p&gt;
&lt;!--
This tool, was instrumental to the Kubernetes success back in time as well as it is today, and the silver line of kubeadm&#39;s value proposition can be summarized in two points

- An obsession in making things deadly simple for the majority of the users: kubeadm init &amp; kubeadm join, that&#39;s all you need! 

- A sharp focus on a well-defined problem scope: bootstrapping Kubernetes clusters on existing infrastructure. As our slogan says: *keep it simple, keep it extensible!*
--&gt;
&lt;p&gt;kubeadm 这个工具对 Kubernetes 的成功起到了关键作用，其价值主张可以概括为两点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;极致的简单：只需两个命令 kubeadm init 和 kubeadm join 即可完成初始化和接入集群的操作！让大多数用户轻松上手。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;明确定义的问题范围：专注于在现有基础设施上启动引导 Kubernetes 集群。正如我们的口号所说：&lt;strong&gt;保持简单，保持可扩展！&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
This silver line, this clear contract, is the foundation the entire kubeadm user base relies on, and this post is a celebration for kubeadm&#39;s users as well.

We are deeply thankful for any feedback from our users, for the enthusiasm that they are continuously showing for this tool via Slack, GitHub, social media, blogs, in person at every KubeCon or at the various meet ups around the world. Keep going!
--&gt;
&lt;p&gt;这个明确的约定是整个 kubeadm 用户群体所依赖的基石，同时本文也是为了与 kubeadm 的使用者们共同欢庆。&lt;/p&gt;
&lt;p&gt;我们由衷感谢用户给予的反馈，感谢他们通过 Slack、GitHub、社交媒体、博客、每次 KubeCon
会面以及各种聚会上持续展现的热情。来看看后续的发展！&lt;/p&gt;
&lt;!--
What continues to amaze me after all those years is the great things people are building on top of kubeadm, and as of today there is a strong and very active list of projects doing so:
- [minikube](https://minikube.sigs.k8s.io/)
- [kind](https://kind.sigs.k8s.io/)
- [Cluster API](https://cluster-api.sigs.k8s.io/)
- [Kubespray](https://kubespray.io/)
- and many more; if you are using Kubernetes today, there is a good chance that you are using kubeadm even without knowing it 😜
--&gt;
&lt;p&gt;这么多年来，对人们基于 kubeadm 构建的诸多项目我感到惊叹。迄今已经有很多强大而活跃的项目，例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://minikube.sigs.k8s.io/&#34;&gt;minikube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kind.sigs.k8s.io/&#34;&gt;kind&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cluster-api.sigs.k8s.io/&#34;&gt;Cluster API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kubespray.io/&#34;&gt;Kubespray&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;还有更多；如果你正在使用 Kubernetes，很可能你甚至不知道自己正在使用 kubeadm 😜&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
This community, the kubeadm’s users, the projects building on top of kubeadm are the highlights of kubeadm’s 7th birthday celebration and the foundation for what will come next!
--&gt;
&lt;p&gt;这个社区、kubeadm 的用户以及基于 kubeadm 构建的项目，是 kubeadm 七周年庆典的亮点，也是未来怎么发展的基础！&lt;/p&gt;
&lt;!--
Stay tuned, and feel free to reach out to us!
- Try [kubeadm](/docs/setup/) to install Kubernetes today
- Get involved with the Kubernetes project on [GitHub](https://github.com/kubernetes/kubernetes)
- Connect with the community on [Slack](http://slack.k8s.io/)
- Follow us on Twitter [@Kubernetesio](https://twitter.com/kubernetesio) for latest updates
--&gt;
&lt;p&gt;请继续关注我们，并随时与我们联系！&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;现在尝试使用 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/&#34;&gt;kubeadm&lt;/a&gt; 安装 Kubernetes&lt;/li&gt;
&lt;li&gt;在 &lt;a href=&#34;https://github.com/kubernetes/kubernetes&#34;&gt;GitHub&lt;/a&gt; 参与 Kubernetes 项目&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;关注我们的 Twitter 账号 &lt;a href=&#34;https://twitter.com/kubernetesio&#34;&gt;@Kubernetesio&lt;/a&gt;，获取最近更新信息&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>kubeadm：使用 etcd Learner 安全地接入控制平面节点</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/25/kubeadm-use-etcd-learner-mode/</link>
      <pubDate>Mon, 25 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/25/kubeadm-use-etcd-learner-mode/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;kubeadm: Use etcd Learner to Join a Control Plane Node Safely&#39;
date: 2023-09-25
slug: kubeadm-use-etcd-learner-mode
--&gt;
&lt;!--
**Author:** Paco Xu (DaoCloud)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Paco Xu (DaoCloud)&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;!--
The [`kubeadm`](/docs/reference/setup-tools/kubeadm/) tool now supports etcd learner mode, which
allows you to enhance the resilience and stability
of your Kubernetes clusters by leveraging the [learner mode](https://etcd.io/docs/v3.4/learning/design-learner/#appendix-learner-implementation-in-v34)
feature introduced in etcd version 3.4.
This guide will walk you through using etcd learner mode with kubeadm. By default, kubeadm runs
a local etcd instance on each control plane node.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-57407--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; 工具现在支持 etcd learner 模式，
借助 etcd 3.4 版本引入的
&lt;a href=&#34;https://etcd.io/docs/v3.4/learning/design-learner/#appendix-learner-implementation-in-v34&#34;&gt;learner 模式&lt;/a&gt;特性，
可以提高 Kubernetes 集群的弹性和稳定性。本文将介绍如何在 kubeadm 中使用 etcd learner 模式。
默认情况下，kubeadm 在每个控制平面节点上运行一个本地 etcd 实例。&lt;/p&gt;
&lt;!--
In v1.27, kubeadm introduced a new feature gate `EtcdLearnerMode`. With this feature gate enabled,
when joining a new control plane node, a new etcd member will be created as a learner and
promoted to a voting member only after the etcd data are fully aligned.
--&gt;
&lt;p&gt;在 v1.27 中，kubeadm 引入了一个新的特性门控 &lt;code&gt;EtcdLearnerMode&lt;/code&gt;。
启用此特性门控后，在加入新的控制平面节点时，一个新的 etcd 成员将被创建为 learner，
只有在 etcd 数据被完全对齐后此成员才会晋升为投票成员。&lt;/p&gt;
&lt;!--
## What are the advantages of using learner mode?

etcd learner mode offers several compelling reasons to consider its adoption
in Kubernetes clusters:
--&gt;
&lt;h2 id=&#34;what-are-advantages-of-using-learner-mode&#34;&gt;使用 etcd learner 模式的优势是什么？  &lt;/h2&gt;
&lt;p&gt;在 Kubernetes 集群中采用 etcd learner 模式具有以下几个优点：&lt;/p&gt;
&lt;!--
1. **Enhanced Resilience**: etcd learner nodes are non-voting members that catch up with
   the leader&#39;s logs before becoming fully operational. This prevents new cluster members
   from disrupting the quorum or causing leader elections, making the cluster more resilient
   during membership changes.
1. **Reduced Cluster Unavailability**: Traditional approaches to adding new members often
   result in cluster unavailability periods, especially in slow infrastructure or misconfigurations.
   etcd learner mode minimizes such disruptions.
1. **Simplified Maintenance**: Learner nodes provide a safer and reversible way to add or replace
   cluster members. This reduces the risk of accidental cluster outages due to misconfigurations or
   missteps during member additions.
1. **Improved Network Tolerance**: In scenarios involving network partitions, learner mode allows
   for more graceful handling. Depending on the partition a new member lands, it can seamlessly
   integrate with the existing cluster without causing disruptions.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;增强了弹性&lt;/strong&gt;：etcd learner 节点是非投票成员，在完全进入角色之前会追随领导者的日志。
这样可以防止新的集群成员干扰投票结果或引起领导者选举，从而使集群在成员变更期间更具弹性。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;减少了集群不可用时间&lt;/strong&gt;：传统的添加新成员的方法通常会造成一段时间集群不可用，特别是在基础设施迟缓或误配的情况下更为明显。
而 etcd learner 模式可以最大程度地减少此类干扰。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;简化了维护&lt;/strong&gt;：learner 节点提供了一种更安全、可逆的方式来添加或替换集群成员。
这降低了由于误配或在成员添加过程中出错而导致集群意外失效的风险。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;改进了网络容错性&lt;/strong&gt;：在涉及网络分区的场景中，learner 模式允许更优雅的处理。
根据新成员所落入的分区，它可以无缝地与现有集群集成，而不会造成中断。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
In summary, the etcd learner mode improves the reliability and manageability of Kubernetes clusters
during member additions and changes, making it a valuable feature for cluster operators.
--&gt;
&lt;p&gt;总之，etcd learner 模式可以在成员添加和变更期间提高 Kubernetes 集群的可靠性和可管理性，
这个特性对集群运营人员很有价值。&lt;/p&gt;
&lt;!--
## How nodes join a cluster that&#39;s using the new mode

### Create a Kubernetes cluster backed by etcd in learner mode {#create-K8s-cluster-etcd-learner-mode}
--&gt;
&lt;h2 id=&#34;how-nodes-join-cluster-that-using-new-node&#34;&gt;节点如何接入使用这种新模式的集群  &lt;/h2&gt;
&lt;h3 id=&#34;create-K8s-cluster-etcd-learner-mode&#34;&gt;创建以 etcd learner 模式支撑的 Kubernetes 集群 &lt;/h3&gt;
&lt;!--
For a general explanation about creating highly available clusters with kubeadm, you can refer to
[Creating Highly Available Clusters with kubeadm](/docs/setup/production-environment/tools/kubeadm/high-availability/).

To create a Kubernetes cluster, backed by etcd in learner mode, using kubeadm, follow these steps:
--&gt;
&lt;p&gt;关于使用 kubeadm 创建高可用集群的通用说明，
请参阅&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/production-environment/tools/kubeadm/high-availability/&#34;&gt;使用 kubeadm 创建高可用集群&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;要使用 kubeadm 创建一个后台是 learner 模式的 etcd 的 Kubernetes 集群，按照以下步骤操作：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# kubeadm init --feature-gates=EtcdLearnerMode=true ...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubeadm init --config&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;kubeadm-config.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The kubeadm configuration file is like below:
--&gt;
&lt;p&gt;kubeadm 配置文件如下：&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;kubeadm.k8s.io/v1beta3&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;ClusterConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;featureGates&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;EtcdLearnerMode&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;!--
The kubeadm tool deploys a single-node Kubernetes cluster with etcd set to use learner mode.
--&gt;
&lt;p&gt;这里，kubeadm 工具部署单节点 Kubernetes 集群，其中的 etcd 被设置为 learner 模式。&lt;/p&gt;
&lt;!--
### Join nodes to the Kubernetes cluster

Before joining a control-plane node to the new Kubernetes cluster, ensure that the existing control plane nodes
and all etcd members are healthy.

Check the cluster health with `etcdctl`. If `etcdctl` isn&#39;t available, you can run this tool inside a container image.
You would do that directly with your container runtime using a tool such as `crictl run` and not through Kubernetes

Here is an example on a client command that uses secure communication to check the cluster health of the etcd cluster:
--&gt;
&lt;h3 id=&#34;join-nodes-to-the-kubernetes-cluster&#34;&gt;将节点接入 Kubernetes 集群  &lt;/h3&gt;
&lt;p&gt;在将控制平面节点接入新的 Kubernetes 集群之前，确保现有的控制平面节点和所有 etcd 成员都健康。&lt;/p&gt;
&lt;p&gt;使用 &lt;code&gt;etcdctl&lt;/code&gt; 检查集群的健康状况。如果 &lt;code&gt;etcdctl&lt;/code&gt; 不可用，你可以运行在容器镜像内的这个工具。
你可以直接使用 &lt;code&gt;crictl run&lt;/code&gt; 这类容器运行时工具而不是通过 Kubernetes 来执行此操作。&lt;/p&gt;
&lt;p&gt;以下是一个使用安全通信来检查 etcd 集群健康状况的客户端命令示例：&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;ETCDCTL_API&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;3&lt;/span&gt; etcdctl --endpoints 127.0.0.1:2379 &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;  --cert&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/etc/kubernetes/pki/etcd/server.crt &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;  --key&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/etc/kubernetes/pki/etcd/server.key &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;  --cacert&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/etc/kubernetes/pki/etcd/ca.crt &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;  member list
&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;dc543c4d307fadb9, started, node1, https://10.6.177.40:2380, https://10.6.177.40:2379, &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;!--
To check if the Kubernetes control plane is healthy, run `kubectl get node -l node-role.kubernetes.io/control-plane=`
and check if the nodes are ready.
--&gt;
&lt;p&gt;要检查 Kubernetes 控制平面是否健康，运行 &lt;code&gt;kubectl get node -l node-role.kubernetes.io/control-plane=&lt;/code&gt;
并检查节点是否就绪。&lt;/p&gt;
&lt;div class=&#34;alert alert-info note callout&#34; role=&#34;alert&#34;&gt;
  &lt;strong&gt;说明：&lt;/strong&gt; &lt;!--
It is recommended to have an odd number of members in an etcd cluster.
--&gt;
&lt;p&gt;建议在 etcd 集群中的成员个数为奇数。
&lt;/div&gt;
&lt;!--
Before joining a worker node to the new Kubernetes cluster, ensure that the control plane nodes are healthy.
--&gt;
&lt;p&gt;在将工作节点接入新的 Kubernetes 集群之前，确保控制平面节点健康。&lt;/p&gt;
&lt;!--
## What&#39;s next

- The feature gate `EtcdLearnerMode` is alpha in v1.27 and we expect it to graduate to beta in the next
  minor release of Kubernetes (v1.29).
- etcd has an open issue that may make the process more automatic:
  [Support auto-promoting a learner member to a voting member](https://github.com/etcd-io/etcd/issues/15107).
- Learn more about the kubeadm [configuration format](/docs/reference/config-api/kubeadm-config.v1beta3/).
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;接下来的步骤  &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;特性门控 &lt;code&gt;EtcdLearnerMode&lt;/code&gt; 在 v1.27 中为 Alpha，预计会在 Kubernetes 的下一个小版本发布（v1.29）中进阶至 Beta。&lt;/li&gt;
&lt;li&gt;etcd 社区有一个开放问题，目的是使这个过程更加自动化：
&lt;a href=&#34;https://github.com/etcd-io/etcd/issues/15107&#34;&gt;支持自动将 learner 成员晋升为投票成员&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;更多细节参阅 kubeadm &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3/&#34;&gt;配置格式&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Feedback

Was this guide helpful? If you have any feedback or encounter any issues, please let us know.
Your feedback is always welcome! Join the bi-weekly [SIG Cluster Lifecycle meeting](https://docs.google.com/document/d/1Gmc7LyCIL_148a9Tft7pdhdee0NBHdOfHS1SAF0duI4/edit)
or weekly [kubeadm office hours](https://docs.google.com/document/d/130_kiXjG7graFNSnIAgtMS1G8zPDwpkshgfRYS0nggo/edit).
Or reach us via [Slack](https://slack.k8s.io/) (channel **#kubeadm**), or the
[SIG&#39;s mailing list](https://groups.google.com/g/kubernetes-sig-cluster-lifecycle).
--&gt;
&lt;h2 id=&#34;feedback&#34;&gt;反馈  &lt;/h2&gt;
&lt;p&gt;本文对你有帮助吗？如果你有任何反馈或遇到任何问题，请告诉我们。
非常欢迎你提出反馈！你可以参加 &lt;a href=&#34;https://docs.google.com/document/d/1Gmc7LyCIL_148a9Tft7pdhdee0NBHdOfHS1SAF0duI4/edit&#34;&gt;SIG Cluster Lifecycle 双周例会&lt;/a&gt;
或 &lt;a href=&#34;https://docs.google.com/document/d/130_kiXjG7graFNSnIAgtMS1G8zPDwpkshgfRYS0nggo/edit&#34;&gt;kubeadm 每周讨论会&lt;/a&gt;。
你还可以通过 &lt;a href=&#34;https://slack.k8s.io/&#34;&gt;Slack&lt;/a&gt;（频道 &lt;strong&gt;#kubeadm&lt;/strong&gt;）或
&lt;a href=&#34;https://groups.google.com/g/kubernetes-sig-cluster-lifecycle&#34;&gt;SIG 邮件列表&lt;/a&gt;联系我们。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>用户命名空间：对运行有状态 Pod 的支持进入 Alpha 阶段!</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/13/userns-alpha/</link>
      <pubDate>Wed, 13 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/13/userns-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;User Namespaces: Now Supports Running Stateful Pods in Alpha!&#34;
date: 2023-09-13
slug: userns-alpha
--&gt;
&lt;!--
**Authors:** Rodrigo Campos Catelin (Microsoft), Giuseppe Scrivano (Red Hat), Sascha Grunert (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Rodrigo Campos Catelin (Microsoft), Giuseppe Scrivano (Red Hat), Sascha Grunert (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
Kubernetes v1.25 introduced support for user namespaces for only stateless
pods. Kubernetes 1.28 lifted that restriction, after some design changes were
done in 1.27.
--&gt;
&lt;p&gt;Kubernetes v1.25 引入用户命名空间（User Namespace）特性，仅支持无状态（Stateless）Pod。
Kubernetes 1.28 在 1.27 的基础上中进行了一些改进后，取消了这一限制。&lt;/p&gt;
&lt;!--
The beauty of this feature is that:
 * it is trivial to adopt (you just need to set a bool in the pod spec)
 * doesn&#39;t need any changes for **most** applications
 * improves security by _drastically_ enhancing the isolation of containers and
   mitigating CVEs rated HIGH and CRITICAL.
--&gt;
&lt;p&gt;此特性的精妙之处在于：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;使用起来很简单（只需在 Pod 规约（spec）中设置一个 bool）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;大多数&lt;/strong&gt;应用程序不需要任何更改&lt;/li&gt;
&lt;li&gt;通过&lt;strong&gt;大幅度&lt;/strong&gt;加强容器的隔离性以及应对评级为高（HIGH）和关键（CRITICAL）的 CVE 来提高安全性。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
This post explains the basics of user namespaces and also shows:
 * the changes that arrived in the recent Kubernetes v1.28 release
 * a **demo of a vulnerability rated as HIGH** that is not exploitable with user namespaces
 * the runtime requirements to use this feature
 * what you can expect in future releases regarding user namespaces.
--&gt;
&lt;p&gt;这篇文章介绍了用户命名空间的基础知识，并展示了：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;最近的 Kubernetes v1.28 版本中出现的变化&lt;/li&gt;
&lt;li&gt;一个评级为&lt;strong&gt;高（HIGH）的漏洞的演示（Demo）&lt;/strong&gt;，该漏洞无法在用户命名空间中被利用&lt;/li&gt;
&lt;li&gt;使用此特性的运行时要求&lt;/li&gt;
&lt;li&gt;关于用户命名空间的未来版本中可以期待的内容&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## What is a user namespace?

A user namespace is a Linux feature that isolates the user and group identifiers
(UIDs and GIDs) of the containers from the ones on the host. The indentifiers
in the container can be mapped to indentifiers on the host in a way where the
host UID/GIDs used for different containers never overlap. Even more, the
identifiers can be mapped to *unprivileged* non-overlapping UIDs and GIDs on the
host. This basically means two things:
--&gt;
&lt;h2 id=&#34;用户命名空间是什么&#34;&gt;用户命名空间是什么？&lt;/h2&gt;
&lt;p&gt;用户命名空间是 Linux 的一项特性，它将容器的用户和组标识符（UID 和 GID）与宿主机上的标识符隔离开来。
容器中的标识符可以映射到宿主机上的标识符，其中用于不同容器的主机 UID/GID 从不重叠。
更重要的是，标识符可以映射到宿主机上的&lt;strong&gt;非特权&lt;/strong&gt;、非重叠的 UID 和 GID。这基本上意味着两件事：&lt;/p&gt;
&lt;!--
 * As the UIDs and GIDs for different containers are mapped to different UIDs
   and GIDs on the host, containers have a harder time to attack each other even
   if they escape the container boundaries. For example, if container A is running
   with different UIDs and GIDs on the host than container B, the operations it
   can do on container B&#39;s files and process are limited: only read/write what a
   file allows to others, as it will never have permission for the owner or
   group (the UIDs/GIDs on the host are guaranteed to be different for
   different containers).
--&gt;
&lt;ul&gt;
&lt;li&gt;由于不同容器的 UID 和 GID 映射到宿主机上不同的 UID 和 GID，因此即使它们逃逸出了容器的边界，也很难相互攻击。
例如，如果容器 A 在宿主机上使用与容器 B 不同的 UID 和 GID 运行，则它可以对容器 B
的文件和进程执行的操作受到限制：只能读/写允许其他人使用的文件，
因为它永远不会拥有所有者或组的权限（宿主机上的 UID/GID 保证对于不同的容器是不同的）。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
 * As the UIDs and GIDs are mapped to unprivileged users on the host, if a
   container escapes the container boundaries, even if it is running 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.
--&gt;
&lt;ul&gt;
&lt;li&gt;由于 UID 和 GID 映射到宿主机上的非特权用户，如果容器逃逸出了容器边界，
即使它在容器内以 root 身份运行，它在宿主机上也没有特权。
这极大地保护了它可以读/写哪些宿主机文件、可以向哪个进程发送信号等。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;此外，所授予的权能（Capability）仅在用户命名空间内有效，而在宿主机上无效。&lt;/p&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. And 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.28

As already mentioned, starting from 1.28, Kubernetes supports user namespaces
with stateful pods. This means that pods with user namespaces can use any type
of volume, they are no longer limited to only some volume types as before.
--&gt;
&lt;h2 id=&#34;1-28-版本的变化&#34;&gt;1.28 版本的变化&lt;/h2&gt;
&lt;p&gt;正如之前提到的，从 1.28 版本开始，Kubernetes 支持有状态的 Pod 的用户命名空间。
这意味着具有用户命名空间的 Pod 可以使用任何类型的卷，不再仅限于以前的部分卷类型。&lt;/p&gt;
&lt;!--
The feature gate to activate this feature was renamed, it is no longer
`UserNamespacesStatelessPodsSupport` but from 1.28 onwards you should use
`UserNamespacesSupport`. There were many changes done and the requirements on
the node hosts changed. So with Kubernetes 1.28 the feature flag was renamed to
reflect this.
--&gt;
&lt;p&gt;从 1.28 版本开始，用于激活此特性的特性门控已被重命名，不再是 &lt;code&gt;UserNamespacesStatelessPodsSupport&lt;/code&gt;，
而应该使用 &lt;code&gt;UserNamespacesSupport&lt;/code&gt;。此特性经历了许多更改，
对节点主机的要求也发生了变化。因此，Kubernetes 1.28 版本将该特性标志重命名以反映这一变化。&lt;/p&gt;
&lt;!--
## Demo

Rodrigo created a demo which exploits [CVE 2022-0492][cve-link] and shows how
the exploit can occur without user namespaces. He also shows how it is not
possible to use this exploit from a Pod where the containers are using this
feature.
--&gt;
&lt;h2 id=&#34;演示&#34;&gt;演示&lt;/h2&gt;
&lt;p&gt;Rodrigo 创建了一个利用 &lt;a href=&#34;https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/&#34;&gt;CVE 2022-0492&lt;/a&gt; 的演示，
用以展现如何在没有用户命名空间的情况下利用该漏洞。
他还展示了在容器使用了此特性的 Pod 中无法利用此漏洞的情况。&lt;/p&gt;
&lt;!--
This vulnerability is rated **HIGH** and allows **a container with no special
privileges to read/write to any path on the host** and launch processes as root
on the host too.


&lt;div style=&#34;position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;&#34;&gt;
  &lt;iframe src=&#34;https://www.youtube.com/embed/M4a2b4KkXN8&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;&#34; allowfullscreen title=&#34;Mitigation of CVE-2022-0492 on Kubernetes by enabling User Namespace support&#34;&gt;&lt;/iframe&gt;
&lt;/div&gt;

--&gt;
&lt;p&gt;此漏洞被评为高危，允许一个没有特殊特权的容器读/写宿主机上的任何路径，并在宿主机上以 root 身份启动进程。&lt;/p&gt;

&lt;div style=&#34;position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;&#34;&gt;
  &lt;iframe src=&#34;https://www.youtube.com/embed/M4a2b4KkXN8&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;&#34; allowfullscreen title=&#34;Mitigation of CVE-2022-0492 on Kubernetes by enabling User Namespace support&#34;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;!--
Most applications in containers run as root today, or as a semi-predictable
non-root user (user ID 65534 is a somewhat popular choice). When you run a Pod
with containers using a userns, Kubernetes runs those containers as unprivileged
users, with no changes needed in your app.
--&gt;
&lt;p&gt;如今，容器中的大多数应用程序都以 root 身份运行，或者以半可预测的非 root
用户身份运行（用户 ID 65534 是一个比较流行的选择）。
当你运行某个 Pod，而其中带有使用用户名命名空间（userns）的容器时，Kubernetes
以非特权用户身份运行这些容器，无需在你的应用程序中进行任何更改。&lt;/p&gt;
&lt;!--
This means two containers running as user 65534 will effectively be mapped to
different users on the host, limiting what they can do to each other in case of
an escape, and if they are running as root, the privileges on the host are
reduced to the one of an unprivileged user.

[cve-link]: https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/
--&gt;
&lt;p&gt;这意味着两个以用户 65534 身份运行的容器实际上会被映射到宿主机上的不同用户，
从而限制了它们在发生逃逸的情况下能够对彼此执行的操作，如果它们以 root 身份运行，
宿主机上的特权也会降低到非特权用户的权限。&lt;/p&gt;
&lt;!--
## Node system requirements

There are requirements on the Linux kernel version as well as the container
runtime to use this feature.
--&gt;
&lt;h2 id=&#34;节点系统要求&#34;&gt;节点系统要求&lt;/h2&gt;
&lt;p&gt;要使用此功能，对 Linux 内核版本以及容器运行时有一定要求。&lt;/p&gt;
&lt;!--
On Linux you need Linux 6.3 or greater. This is because the feature relies on a
kernel feature named idmap mounts, and support to use idmap mounts with tmpfs
was merged in Linux 6.3.

If you are using CRI-O with crun, this is [supported in CRI-O
1.28.1][CRIO-release] and crun 1.9 or greater. If you are using CRI-O with runc,
this is still not supported.
--&gt;
&lt;p&gt;在 Linux上，你需要 Linux 6.3 或更高版本。这是因为该特性依赖于一个名为
idmap mounts 的内核特性，而 Linux 6.3 中合并了针对 tmpfs 使用 idmap mounts 的支持&lt;/p&gt;
&lt;p&gt;如果你使用 CRI-O 与 crun，这一特性在 &lt;a href=&#34;https://github.com/cri-o/cri-o/releases/tag/v1.28.1&#34;&gt;CRI-O 1.28.1&lt;/a&gt; 和 crun 1.9 或更高版本中受支持。
如果你使用 CRI-O 与 runc，目前仍不受支持。&lt;/p&gt;
&lt;!--
containerd support is currently targeted for containerd 2.0; it is likely that
it won&#39;t matter if you use it with crun or runc.

Please note that containerd 1.7 added _experimental_ support for user
namespaces as implemented in Kubernetes 1.25 and 1.26. The redesign done in 1.27
is not supported by containerd 1.7, therefore it only works, in terms of user
namespaces support, with Kubernetes 1.25 and 1.26.
--&gt;
&lt;p&gt;containerd 对此的支持目前设定的目标是 containerd 2.0；不管你是否与 crun 或 runc 一起使用，或许都不重要。&lt;/p&gt;
&lt;p&gt;请注意，containerd 1.7 添加了对用户命名空间的实验性支持，正如在 Kubernetes 1.25
和 1.26 中实现的那样。1.27 版本中进行的重新设计不受 containerd 1.7 支持，
因此它在用户命名空间支持方面仅适用于 Kubernetes 1.25 和 1.26。&lt;/p&gt;
&lt;!--
One limitation present in containerd 1.7 is that it needs to change the
ownership of every file and directory inside the container image, during Pod
startup. This means it has a storage overhead and can significantly impact the
container startup latency. Containerd 2.0 will probably include a implementation
that will eliminate the startup latency added and the storage overhead. Take
this into account if you plan to use containerd 1.7 with user namespaces in
production.

None of these containerd limitations apply to [CRI-O 1.28][CRIO-release].

[CRIO-release]: https://github.com/cri-o/cri-o/releases/tag/v1.28.1
--&gt;
&lt;p&gt;containerd 1.7 存在的一个限制是，在 Pod 启动期间需要更改容器镜像中每个文件和目录的所有权。
这意味着它具有存储开销，并且可能会显著影响容器启动延迟。containerd 2.0
可能会包括一个实现，可以消除增加的启动延迟和存储开销。如果计划在生产中使用
containerd 1.7 与用户命名空间，请考虑这一点。&lt;/p&gt;
&lt;p&gt;这些 Containerd 限制均不适用于 [CRI-O 1.28][CRIO 版本]。&lt;/p&gt;
&lt;!--
## What’s next?

Looking ahead to Kubernetes 1.29, the plan is to work with SIG Auth to integrate user
namespaces to Pod Security Standards (PSS) and the Pod Security Admission. For
the time being, the plan is to relax checks in PSS policies when user namespaces are
in use. This means that the fields `spec[.*].securityContext` `runAsUser`,
`runAsNonRoot`, `allowPrivilegeEscalation` and `capabilities` will not trigger a
violation if user namespaces are in use. The behavior will probably be controlled by
utilizing a API Server feature gate, like `UserNamespacesPodSecurityStandards`
or similar.
--&gt;
&lt;h2 id=&#34;接下来&#34;&gt;接下来？&lt;/h2&gt;
&lt;p&gt;展望 Kubernetes 1.29，计划是与 SIG Auth 合作，将用户命名空间集成到 Pod 安全标准（PSS）和 Pod 安全准入中。
目前的计划是在使用用户命名空间时放宽 Pod 安全标准（PSS）策略中的检查。这意味着如果使用用户命名空间，那么字段
&lt;code&gt;spec[.*].securityContext&lt;/code&gt;、&lt;code&gt;runAsUser&lt;/code&gt;、&lt;code&gt;runAsNonRoot&lt;/code&gt;、&lt;code&gt;allowPrivilegeEscalation和capabilities&lt;/code&gt;
将不会触发违规，此行为可能会通过使用 API Server 特性门控来控制，比如 &lt;code&gt;UserNamespacesPodSecurityStandards&lt;/code&gt; 或其他类似的。&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)

You can also contact us directly:
- GitHub: @rata @giuseppe @saschagrunert
- Slack: @rata @giuseppe @sascha
--&gt;
&lt;h2 id=&#34;我该如何参与&#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;Mailing list&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/community/labels/sig%2Fnode&#34;&gt;Open Community Issues/PRs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&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>比较本地 Kubernetes 开发工具：Telepresence、Gefyra 和 mirrord</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/12/local-k8s-development-tools/</link>
      <pubDate>Tue, 12 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/09/12/local-k8s-development-tools/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Comparing Local Kubernetes Development Tools: Telepresence, Gefyra, and mirrord&#39;
date: 2023-09-12
slug: local-k8s-development-tools
--&gt;
&lt;!--
**Author:** Eyal Bukchin (MetalBear)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Eyal Bukchin (MetalBear)&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;!--
The Kubernetes development cycle is an evolving landscape with a myriad of tools seeking to streamline the process. Each tool has its unique approach, and the choice often comes down to individual project requirements, the team&#39;s expertise, and the preferred workflow.
--&gt;
&lt;p&gt;Kubernetes 的开发周期是一个不断演化的领域，有许多工具在寻求简化这个过程。
每个工具都有其独特的方法，具体选择通常取决于各个项目的要求、团队的专业知识以及所偏好的工作流。&lt;/p&gt;
&lt;!--
Among the various solutions, a category we dubbed “Local K8S Development tools” has emerged, which seeks to enhance the Kubernetes development experience by connecting locally running components to the Kubernetes cluster. This facilitates rapid testing of new code in cloud conditions, circumventing the traditional cycle of Dockerization, CI, and deployment.

In this post, we compare three solutions in this category: Telepresence, Gefyra, and our own contender, mirrord.
--&gt;
&lt;p&gt;在各种解决方案中，我们称之为“本地 K8S 开发工具”的一个类别已渐露端倪，
这一类方案通过将本地运行的组件连接到 Kubernetes 集群来提升 Kubernetes 开发体验。
这样可以在云环境中快速测试新代码，避开了 Docker 化、CI 和部署这样的传统周期。&lt;/p&gt;
&lt;p&gt;在本文中，我们将比较这个类别中的三个解决方案：Telepresence、Gefyra 和我们自己的挑战者 mirrord。&lt;/p&gt;
&lt;h2 id=&#34;telepresence&#34;&gt;Telepresence&lt;/h2&gt;
&lt;!--
The oldest and most well-established solution in the category, [Telepresence](https://www.telepresence.io/) uses a VPN (or more specifically, a `tun` device) to connect the user&#39;s machine (or a locally running container) and the cluster&#39;s network. It then supports the interception of incoming traffic to a specific service in the cluster, and its redirection to a local port. The traffic being redirected can also be filtered to avoid completely disrupting the remote service. It also offers complementary features to support file access (by locally mounting a volume mounted to a pod) and importing environment variables.
Telepresence requires the installation of a local daemon on the user&#39;s machine (which requires root privileges) and a Traffic Manager component on the cluster. Additionally, it runs an Agent as a sidecar on the pod to intercept the desired traffic.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://www.telepresence.io/&#34;&gt;Telepresence&lt;/a&gt; 是这类工具中最早也最成熟的解决方案，
它使用 VPN（或更具体地说，一个 &lt;code&gt;tun&lt;/code&gt; 设备）将用户的机器（或本地运行的容器）与集群的网络相连。
它支持拦截发送到集群中特定服务的传入流量，并将其重定向到本地端口。
被重定向的流量还可以被过滤，以避免完全破坏远程服务。
它还提供了一些补充特性，如支持文件访问（通过本地挂载卷将其挂载到 Pod 上）和导入环境变量。
Telepresence 需要在用户的机器上安装一个本地守护进程（需要 root 权限），并在集群上运行一个
Traffic Manager 组件。此外，它在 Pod 上以边车的形式运行一个 Agent 来拦截所需的流量。&lt;/p&gt;
&lt;h2 id=&#34;gefyra&#34;&gt;Gefyra&lt;/h2&gt;
&lt;!--
[Gefyra](https://gefyra.dev/), similar to Telepresence, employs a VPN to connect to the cluster. However, it only supports connecting locally running Docker containers to the cluster. This approach enhances portability across different OSes and local setups. However, the downside is that it does not support natively run uncontainerized code.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://gefyra.dev/&#34;&gt;Gefyra&lt;/a&gt; 与 Telepresence 类似，也采用 VPN 连接到集群。
但 Gefyra 只支持将本地运行的 Docker 容器连接到集群。
这种方法增强了在不同操作系统和本地设置环境之间的可移植性。
然而，它的缺点是不支持原生运行非容器化的代码。&lt;/p&gt;
&lt;!--
Gefyra primarily focuses on network traffic, leaving file access and environment variables unsupported. Unlike Telepresence, it doesn&#39;t alter the workloads in the cluster, ensuring a straightforward clean-up process if things go awry.
--&gt;
&lt;p&gt;Gefyra 主要关注网络流量，不支持文件访问和环境变量。
与 Telepresence 不同，Gefyra 不会改变集群中的工作负载，
因此如果发生意外情况，清理过程更加简单明了。&lt;/p&gt;
&lt;h2 id=&#34;mirrord&#34;&gt;mirrord&lt;/h2&gt;
&lt;!--
The newest of the three tools, [mirrord](https://mirrord.dev/) adopts a different approach by injecting itself
into the local binary (utilizing `LD_PRELOAD` on Linux or `DYLD_INSERT_LIBRARIES` on macOS),
and overriding libc function calls, which it then proxies a temporary agent it runs in the cluster.
For example, when the local process tries to read a file mirrord intercepts that call and sends it
to the agent, which then reads the file from the remote pod. This method allows mirrord to cover
all inputs and outputs to the process – covering network access, file access, and
environment variables uniformly.
--&gt;
&lt;p&gt;作为这三个工具中最新的工具，&lt;a href=&#34;https://mirrord.dev/&#34;&gt;mirrord&lt;/a&gt;采用了一种不同的方法，
它通过将自身注入到本地二进制文件中（在 Linux 上利用 &lt;code&gt;LD_PRELOAD&lt;/code&gt;，在 macOS 上利用 &lt;code&gt;DYLD_INSERT_LIBRARIES&lt;/code&gt;），
并重写 libc 函数调用，然后代理到在集群中运行的临时代理。
例如，当本地进程尝试读取一个文件时，mirrord 会拦截该调用并将其发送到该代理，
该代理再从远程 Pod 读取文件。这种方法允许 mirrord 覆盖进程的所有输入和输出，统一处理网络访问、文件访问和环境变量。&lt;/p&gt;
&lt;!--
By working at the process level, mirrord supports running multiple local processes simultaneously, each in the context of their respective pod in the cluster, without requiring them to be containerized and without needing root permissions on the user’s machine.
--&gt;
&lt;p&gt;通过在进程级别工作，mirrord 支持同时运行多个本地进程，每个进程都在集群中的相应 Pod 上下文中运行，
无需将这些进程容器化，也无需在用户机器上获取 root 权限。&lt;/p&gt;
&lt;!--
## Summary
--&gt;
&lt;h2 id=&#34;summary&#34;&gt;摘要  &lt;/h2&gt;
&lt;table&gt;
&lt;!--
&lt;caption&gt;Comparison of Telepresence, Gefyra, and mirrord&lt;/caption&gt;
--&gt;
&lt;caption&gt;比较 Telepresence、Gefyra 和 mirrord&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;td class=&#34;empty&#34;&gt;&lt;/td&gt;
&lt;th&gt;Telepresence&lt;/th&gt;
&lt;th&gt;Gefyra&lt;/th&gt;
&lt;th&gt;mirrord&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;Cluster connection scope&lt;/th&gt;
&lt;td&gt;Entire machine or container&lt;/td&gt;
&lt;td&gt;Container&lt;/td&gt;
&lt;td&gt;Process&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;集群连接作用域&lt;/th&gt;
&lt;td&gt;整台机器或容器&lt;/td&gt;
&lt;td&gt;容器&lt;/td&gt;
&lt;td&gt;进程&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;Developer OS support&lt;/th&gt;
&lt;td&gt;Linux, macOS, Windows&lt;/td&gt;
&lt;td&gt;Linux, macOS, Windows&lt;/td&gt;
&lt;td&gt;Linux, macOS, Windows (WSL)&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;开发者操作系统支持&lt;/th&gt;
&lt;td&gt;Linux、macOS、Windows&lt;/td&gt;
&lt;td&gt;Linux、macOS、Windows&lt;/td&gt;
&lt;td&gt;Linux、macOS、Windows (WSL)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;Incoming traffic features&lt;/th&gt;
&lt;td&gt;Interception&lt;/td&gt;
&lt;td&gt;Interception&lt;/td&gt;
&lt;td&gt;Interception or mirroring&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;传入的流量特性&lt;/th&gt;
&lt;td&gt;拦截&lt;/td&gt;
&lt;td&gt;拦截&lt;/td&gt;
&lt;td&gt;拦截或镜像&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;File access&lt;/th&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;td&gt;Unsupported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;文件访问&lt;/th&gt;
&lt;td&gt;已支持&lt;/td&gt;
&lt;td&gt;不支持&lt;/td&gt;
&lt;td&gt;已支持&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;Environment variables&lt;/th&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;td&gt;Unsupported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;环境变量&lt;/th&gt;
&lt;td&gt;已支持&lt;/td&gt;
&lt;td&gt;不支持&lt;/td&gt;
&lt;td&gt;已支持&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;Requires local root&lt;/th&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;需要本地 root&lt;/th&gt;
&lt;td&gt;是&lt;/td&gt;
&lt;td&gt;否&lt;/td&gt;
&lt;td&gt;否&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;!--
&lt;th scope=&#34;row&#34;&gt;How to use&lt;/th&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Docker Desktop extension&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Docker Desktop extension&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Visual Studio Code extension&lt;/li&gt;&lt;li&gt;IntelliJ plugin&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
--&gt;
&lt;th scope=&#34;row&#34;&gt;如何使用&lt;/th&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Docker Desktop 扩展&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Docker Desktop 扩展&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;CLI&lt;/li&gt;&lt;li&gt;Visual Studio Code 扩展&lt;/li&gt;&lt;li&gt;IntelliJ 插件&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!--
## Conclusion

Telepresence, Gefyra, and mirrord each offer unique approaches to streamline the Kubernetes development cycle, each having its strengths and weaknesses. Telepresence is feature-rich but comes with complexities, mirrord offers a seamless experience and supports various functionalities, while Gefyra aims for simplicity and robustness.
--&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;结论  &lt;/h2&gt;
&lt;p&gt;Telepresence、Gefyra 和 mirrord 各自提供了独特的方法来简化 Kubernetes 开发周期，
每个工具都有其优缺点。Telepresence 功能丰富但复杂，mirrord 提供无缝体验并支持各种功能，
而 Gefyra 则追求简单和稳健。&lt;/p&gt;
&lt;!--
Your choice between them should depend on the specific requirements of your project, your team&#39;s familiarity with the tools, and the desired development workflow. Whichever tool you choose, we believe the local Kubernetes development approach can provide an easy, effective, and cheap solution to the bottlenecks of the Kubernetes development cycle, and will become even more prevalent as these tools continue to innovate and evolve.
--&gt;
&lt;p&gt;你的选择应取决于项目的具体要求、团队对工具的熟悉程度以及所需的开发工作流。
无论你选择哪个工具，我们相信本地 Kubernetes 开发方法都可以提供一种简单、有效和低成本的解决方案，
来应对 Kubernetes 开发周期中的瓶颈，并且随着这些工具的不断创新和发展，这种本地方法将变得更加普遍。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 旧版软件包仓库将于 2023 年 9 月 13 日被冻结</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/</link>
      <pubDate>Thu, 31 Aug 2023 15:30:00 -0700</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes Legacy Package Repositories Will Be Frozen On September 13, 2023&#34;
date: 2023-08-31T15:30:00-07:00
slug: legacy-package-repository-deprecation
evergreen: true
--&gt;
&lt;!--
**Authors**: Bob Killen (Google), Chris Short (AWS), Jeremy Rickard (Microsoft), Marko Mudrinić (Kubermatic), Tim Bannister (The Scale Factory)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Bob Killen (Google), Chris Short (AWS), Jeremy Rickard (Microsoft), Marko Mudrinić (Kubermatic), Tim Bannister (The Scale Factory)&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 August 15, 2023, the Kubernetes project announced the general availability of
the community-owned package repositories for Debian and RPM packages available
at `pkgs.k8s.io`. The new package repositories are replacement for the legacy
Google-hosted package repositories: `apt.kubernetes.io` and `yum.kubernetes.io`.
The
[announcement blog post for `pkgs.k8s.io`](/blog/2023/08/15/pkgs-k8s-io-introduction/)
highlighted that we will stop publishing packages to the legacy repositories in
the future.
--&gt;
&lt;p&gt;2023 年 8 月 15 日，Kubernetes 项目宣布社区拥有的 Debian 和 RPM
软件包仓库在 &lt;code&gt;pkgs.k8s.io&lt;/code&gt; 上正式提供。新的软件包仓库将取代旧的由
Google 托管的软件包仓库：&lt;code&gt;apt.kubernetes.io&lt;/code&gt; 和 &lt;code&gt;yum.kubernetes.io&lt;/code&gt;。
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/15/pkgs-k8s-io-introduction/&#34;&gt;&lt;code&gt;pkgs.k8s.io&lt;/code&gt; 的公告博客文章&lt;/a&gt;强调我们未来将停止将软件包发布到旧仓库。&lt;/p&gt;
&lt;!--
Today, we&#39;re formally deprecating the legacy package repositories (`apt.kubernetes.io`
and `yum.kubernetes.io`), and we&#39;re announcing our plans to freeze the contents of
the repositories as of **September 13, 2023**.
--&gt;
&lt;p&gt;今天，我们正式弃用旧软件包仓库（&lt;code&gt;apt.kubernetes.io&lt;/code&gt; 和 &lt;code&gt;yum.kubernetes.io&lt;/code&gt;），
并且宣布我们计划在 &lt;strong&gt;2023 年 9 月 13 日&lt;/strong&gt; 冻结仓库的内容。&lt;/p&gt;
&lt;!--
Please continue reading in order to learn what does this mean for you as an user or
distributor, and what steps you may need to take.
--&gt;
&lt;p&gt;请继续阅读以了解这对于作为用户或分发商的你意味着什么，
以及你可能需要采取哪些步骤。&lt;/p&gt;
&lt;!--
## How does this affect me as a Kubernetes end user?

This change affects users **directly installing upstream versions of Kubernetes**,
either manually by following the official
[installation](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) and
[upgrade](/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/) instructions, or
by **using a Kubernetes installer** that&#39;s using packages provided by the Kubernetes
project.
--&gt;
&lt;h2 id=&#34;how-does-this-affect-me-as-a-kubernetes-end-user&#34;&gt;作为 Kubernetes 最终用户，这对我有何影响？&lt;/h2&gt;
&lt;p&gt;此更改影响&lt;strong&gt;直接安装 Kubernetes 的上游版本&lt;/strong&gt;的用户，
无论是按照官方手动&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83/%E5%B7%A5%E5%85%B7/kubeadm/install-kubeadm/&#34;&gt;安装&lt;/a&gt;
和&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/&#34;&gt;升级&lt;/a&gt;说明，
还是通过&lt;strong&gt;使用 Kubernetes 安装工具&lt;/strong&gt;，该安装工具使用 Kubernetes 项目提供的软件包。&lt;/p&gt;
&lt;!--
**This change also affects you if you run Linux on your own PC and have installed `kubectl` using the legacy package repositories**.
We&#39;ll explain later on how to [check](#check-if-affected) if you&#39;re affected.
--&gt;
&lt;p&gt;&lt;strong&gt;如果你在自己的 PC 上运行 Linux 并使用旧软件包仓库安装了 &lt;code&gt;kubectl&lt;/code&gt;，则此更改也会影响你&lt;/strong&gt;。
我们稍后将解释如何&lt;a href=&#34;#check-if-affected&#34;&gt;检查&lt;/a&gt;是否你会受到影响。&lt;/p&gt;
&lt;!--
If you use **fully managed** Kubernetes, for example through a service from a cloud
provider, you would only be affected by this change if you also installed `kubectl`
on your Linux PC using packages from the legacy repositories. Cloud providers are
generally using their own Kubernetes distributions and therefore they don&#39;t use
packages provided by the Kubernetes project; more importantly, if someone else is
managing Kubernetes for you, then they would usually take responsibility for that check.
--&gt;
&lt;p&gt;如果你使用&lt;strong&gt;完全托管的&lt;/strong&gt; Kubernetes，例如从云提供商获取服务，
那么只有在你还使用旧仓库中的软件包在你的 Linux PC 上安装 &lt;code&gt;kubectl&lt;/code&gt; 时，
你才会受到此更改的影响。云提供商通常使用他们自己的 Kubernetes 发行版，
因此他们不使用 Kubernetes 项目提供的软件包；更重要的是，如果有其他人为你管理 Kubernetes，
那么他们通常会负责该检查。&lt;/p&gt;
&lt;!--
If you have a managed [control plane](/docs/concepts/overview/components/#control-plane-components)
but you are responsible for **managing the nodes yourself**, and any of those nodes run Linux,
you should [check](#check-if-affected) whether you are affected.
--&gt;
&lt;p&gt;如果你使用的是托管的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/components/#control-plane-components&#34;&gt;控制平面&lt;/a&gt;
但你负责&lt;strong&gt;自行管理节点&lt;/strong&gt;，并且每个节点都运行 Linux，
你应该&lt;a href=&#34;#check-if-affected&#34;&gt;检查&lt;/a&gt;你是否会受到影响。&lt;/p&gt;
&lt;!--
If you&#39;re managing your clusters on your own by following the official installation
and upgrade instructions, please follow the instructions in this blog post to migrate
to the (new) community-owned package repositories.
--&gt;
&lt;p&gt;如果你按照官方的安装和升级说明自己管理你的集群，
请按照本博客文章中的说明迁移到（新的）社区拥有的软件包仓库。&lt;/p&gt;
&lt;!--
If you&#39;re using a Kubernetes installer that&#39;s using packages provided by the
Kubernetes project, please check the installer tool&#39;s communication channels for
information about what steps you need to take, and eventually if needed, follow up
with maintainers to let them know about this change.
--&gt;
&lt;p&gt;如果你使用的 Kubernetes 安装程序使用 Kubernetes 项目提供的软件包，
请检查安装程序工具的通信渠道，了解有关你需要采取的步骤的信息，最后如果需要，
请与维护人员联系，让他们了解此更改。&lt;/p&gt;
&lt;!--
The following diagram shows who&#39;s affected by this change in a visual form
(click on diagram for the larger version):


&lt;figure class=&#34;diagram-large&#34;&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/08/31/legacy-package-repository-deprecation/flow.svg&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/08/31/legacy-package-repository-deprecation/flow.svg&#34;
         alt=&#34;Visual explanation of who&amp;#39;s affected by the legacy repositories being deprecated and frozen. Textual explanation is available above this diagram.&#34;/&gt; &lt;/a&gt;
&lt;/figure&gt;

--&gt;
&lt;p&gt;下图以可视化形式显示了谁受到此更改的影响（单击图表可查看大图）：&lt;/p&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/flow.svg&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/flow.svg&#34;
         alt=&#34;直观地解释谁受到弃用和冻结的遗留仓库的影响。图上提供了文字解释。&#34;/&gt; &lt;/a&gt;
&lt;/figure&gt;

&lt;!--
## How does this affect me as a Kubernetes distributor?

If you&#39;re using the legacy repositories as part of your project (e.g. a Kubernetes
installer tool), you should migrate to the community-owned repositories as soon as
possible and inform your users about this change and what steps they need to take.
--&gt;
&lt;h2 id=&#34;how-does-this-affect-me-as-a-kubernetes-distributor&#34;&gt;这对我作为 Kubernetes 分发商有何影响？ &lt;/h2&gt;
&lt;p&gt;如果你将旧仓库用作项目的一部分（例如 Kubernetes 安装程序工具），
则应尽快迁移到社区拥有的仓库，并告知用户此更改以及他们需要采取哪些步骤。&lt;/p&gt;
&lt;!--
## Timeline of changes

- **15th August 2023:**  
  Kubernetes announces a new, community-managed source for Linux software packages of Kubernetes components
- **31st August 2023:**  
  _(this announcement)_ Kubernetes formally deprecates the legacy
  package repositories
- **13th September 2023** (approximately):  
  Kubernetes will freeze the legacy package repositories,
  (`apt.kubernetes.io` and `yum.kubernetes.io`).
  The freeze will happen immediately following the patch releases that are scheduled for September, 2023.
--&gt;
&lt;h2 id=&#34;timeline-of-changes&#34;&gt;变更时间表 &lt;/h2&gt;
&lt;!-- note to maintainers - the trailing whitespace is significant --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;2023 年 8 月 15 日：&lt;/strong&gt;&lt;br&gt;
Kubernetes 宣布推出一个新的社区管理的 Kubernetes 组件 Linux 软件包源&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2023 年 8 月 31 日：&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;（本公告）&lt;/strong&gt; Kubernetes 正式弃用旧版软件包仓库&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2023 年 9 月 13 日&lt;/strong&gt;（左右）：&lt;br&gt;
Kubernetes 将冻结旧软件包仓库（&lt;code&gt;apt.kubernetes.io&lt;/code&gt; 和 &lt;code&gt;yum.kubernetes.io&lt;/code&gt;）。
冻结将计划于 2023 年 9 月发布补丁版本后立即进行。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The Kubernetes patch releases scheduled for September 2023 (v1.28.2, v1.27.6,
v1.26.9, v1.25.14) will have packages published **both** to the community-owned and
the legacy repositories.
--&gt;
&lt;p&gt;计划于 2023 年 9 月发布的 Kubernetes 补丁（v1.28.2、v1.27.6、v1.26.9、v1.25.14）
将把软件包发布到社区拥有的仓库和旧仓库。&lt;/p&gt;
&lt;!--
We&#39;ll freeze the legacy repositories after cutting the patch releases for September
which means that we&#39;ll completely stop publishing packages to the legacy repositories
at that point.
--&gt;
&lt;p&gt;在发布 9 月份的补丁版本后，我们将冻结旧仓库，这意味着届时我们将完全停止向旧仓库发布软件包。&lt;/p&gt;
&lt;!--
For the v1.28, v1.27, v1.26, and v1.25 patch releases from October 2023 and onwards,
we&#39;ll only publish packages to the new package repositories (`pkgs.k8s.io`).
--&gt;
&lt;p&gt;对于 2023 年 10 月及以后的 v1.28、v1.27、v1.26 和 v1.25 补丁版本，
我们仅将软件包发布到新的软件包仓库 (&lt;code&gt;pkgs.k8s.io&lt;/code&gt;)。&lt;/p&gt;
&lt;!--
### What about future minor releases?

Kubernetes 1.29 and onwards will have packages published **only** to the
community-owned repositories (`pkgs.k8s.io`).
--&gt;
&lt;h3 id=&#34;what-about-future-minor-releases&#34;&gt;未来的次要版本怎么样？ &lt;/h3&gt;
&lt;p&gt;Kubernetes 1.29 及以后的版本将&lt;strong&gt;仅&lt;/strong&gt;发布软件包到社区拥有的仓库（&lt;code&gt;pkgs.k8s.io&lt;/code&gt;）。&lt;/p&gt;
&lt;!--
## Can I continue to use the legacy package repositories?

The existing packages in the legacy repositories will be available for the foreseeable
future. However, the Kubernetes project can&#39;t provide _any_ guarantees on how long
is that going to be. The deprecated legacy repositories, and their contents, might
be removed at any time in the future and without a further notice period.

**UPDATE**: The legacy packages are expected to go away in January 2024.
--&gt;
&lt;h2 id=&#34;can-i-continue-to-use-the-legacy-package-repositories&#34;&gt;我可以继续使用旧软件包仓库吗？&lt;/h2&gt;
&lt;p&gt;&lt;del&gt;旧仓库中的现有软件包将在可预见的未来内保持可用。然而，
Kubernetes 项目无法对这会持续多久提供&lt;strong&gt;任何&lt;/strong&gt;保证。
已弃用的旧仓库及其内容可能会在未来随时删除，恕不另行通知。&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;更新&lt;/strong&gt;: 旧版软件包预计将于 2024 年 1 月被删除。&lt;/p&gt;
&lt;!--
The Kubernetes project **strongly recommends** migrating to the new community-owned
repositories **as soon as possible**.
--&gt;
&lt;p&gt;Kubernetes 项目&lt;strong&gt;强烈建议尽快&lt;/strong&gt;迁移到新的社区拥有的仓库。&lt;/p&gt;
&lt;!--
Given that no new releases will be published to the legacy repositories **after the September 13, 2023**
cut-off point, **you will not be able to upgrade to any patch or minor release made from that date onwards.**
--&gt;
&lt;p&gt;鉴于&lt;strong&gt;在 2023 年 9 月 13 日&lt;/strong&gt;截止时间点之后不会向旧仓库发布任何新版本，
&lt;strong&gt;你将无法升级到自该日期起发布的任何补丁或次要版本。&lt;/strong&gt;&lt;/p&gt;
&lt;!--
Whilst the project makes every effort to release secure software, there may one
day be a high-severity vulnerability in Kubernetes, and consequently an important
release to upgrade to. The advice we&#39;re announcing will help you be as prepared for
any future security update, whether trivial or urgent.
--&gt;
&lt;p&gt;尽管该项目会尽一切努力发布安全软件，但有一天 Kubernetes 可能会出现一个高危性漏洞，
因此需要升级到一个重要版本。我们所公开的建议将帮助你为未来的所有安全更新（无论是微不足道的还是紧急的）做好准备。&lt;/p&gt;
&lt;!--
## How can I check if I&#39;m using the legacy repositories? {#check-if-affected}

The steps to check if you&#39;re using the legacy repositories depend on whether you&#39;re
using Debian-based distributions (Debian, Ubuntu, and more) or RPM-based distributions
(CentOS, RHEL, Rocky Linux, and more) in your cluster.

Run these instructions on one of your nodes in the cluster.
--&gt;
&lt;h2 id=&#34;check-if-affected&#34;&gt;如何检查我是否正在使用旧仓库？&lt;/h2&gt;
&lt;p&gt;检查你是否使用旧仓库的步骤取决于你在集群中使用的是基于
Debian 的发行版（Debian、Ubuntu 等）还是基于 RPM
的发行版（CentOS、RHEL、Rocky Linux 等）。&lt;/p&gt;
&lt;p&gt;在集群中的一个节点上运行以下指令。&lt;/p&gt;
&lt;!--
### Debian-based Linux distributions

The repository definitions (sources) are located in `/etc/apt/sources.list` and `/etc/apt/sources.list.d/`
on Debian-based distributions. Inspect these two locations and try to locate a
package repository definition that looks like:
--&gt;
&lt;h3 id=&#34;debian-based-linux-distributions&#34;&gt;基于 Debian 的 Linux 发行版 &lt;/h3&gt;
&lt;p&gt;在基于 Debian 的发行版上，仓库定义（源）位于&lt;code&gt;/etc/apt/sources.list&lt;/code&gt;
和 &lt;code&gt;/etc/apt/sources.list.d/&lt;/code&gt;中。检查这两个位置并尝试找到如下所示的软件包仓库定义：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
&lt;/code&gt;&lt;/pre&gt;&lt;!--
**If you find a repository definition that looks like this, you&#39;re using the legacy repository and you need to migrate.**

If the repository definition uses `pkgs.k8s.io`, you&#39;re already using the
community-hosted repositories and you don&#39;t need to take any action.
--&gt;
&lt;p&gt;&lt;strong&gt;如果你发现像这样的仓库定义，则你正在使用旧仓库并且需要迁移。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;如果仓库定义使用 &lt;code&gt;pkgs.k8s.io&lt;/code&gt;，则你已经在使用社区托管的仓库，无需执行任何操作。&lt;/p&gt;
&lt;!--
On most systems, this repository definition should be located in
`/etc/apt/sources.list.d/kubernetes.list` (as recommended by the Kubernetes
documentation), but on some systems it might be in a different location.
--&gt;
&lt;p&gt;在大多数系统上，此仓库定义应位于 &lt;code&gt;/etc/apt/sources.list.d/kubernetes.list&lt;/code&gt;
（按照 Kubernetes 文档的建议），但在某些系统上它可能位于不同的位置。&lt;/p&gt;
&lt;!--
If you can&#39;t find a repository definition related to Kubernetes, it&#39;s likely that you
don&#39;t use package managers to install Kubernetes and you don&#39;t need to take any action.
--&gt;
&lt;p&gt;如果你找不到与 Kubernetes 相关的仓库定义，
则很可能你没有使用软件包管理器来安装 Kubernetes，因此不需要执行任何操作。&lt;/p&gt;
&lt;!--
### RPM-based Linux distributions

The repository definitions are located in `/etc/yum.repos.d` if you&#39;re using the
`yum` package manager, or `/etc/dnf/dnf.conf` and `/etc/dnf/repos.d/` if you&#39;re using
`dnf` package manager. Inspect those locations and try to locate a package repository
definition that looks like this:
--&gt;
&lt;h3 id=&#34;rpm-based-linux-distributions&#34;&gt;基于 RPM 的 Linux 发行版 &lt;/h3&gt;
&lt;p&gt;如果你使用的是 &lt;code&gt;yum&lt;/code&gt; 软件包管理器，则仓库定义位于
&lt;code&gt;/etc/yum.repos.d&lt;/code&gt;，或者 &lt;code&gt;/etc/dnf/dnf.conf&lt;/code&gt; 和 &lt;code&gt;/etc/dnf/repos.d/&lt;/code&gt;
如果你使用的是 &lt;code&gt;dnf&lt;/code&gt; 软件包管理器。检查这些位置并尝试找到如下所示的软件包仓库定义：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
&lt;/code&gt;&lt;/pre&gt;&lt;!--
**If you find a repository definition that looks like this, you&#39;re using the legacy repository and you need to migrate.**

If the repository definition uses `pkgs.k8s.io`, you&#39;re already using the
community-hosted repositories and you don&#39;t need to take any action.
--&gt;
&lt;p&gt;&lt;strong&gt;如果你发现像这样的仓库定义，则你正在使用旧仓库并且需要迁移。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;如果仓库定义使用 &lt;code&gt;pkgs.k8s.io&lt;/code&gt;，则你已经在使用社区托管的仓库，无需执行任何操作。&lt;/p&gt;
&lt;!--
On most systems, that repository definition should be located in `/etc/yum.repos.d/kubernetes.repo`
(as recommended by the Kubernetes documentation), but on some systems it might be
in a different location.
--&gt;
&lt;p&gt;在大多数系统上，该仓库定义应位于 &lt;code&gt;/etc/yum.repos.d/kubernetes.repo&lt;/code&gt;
（按照 Kubernetes 文档的建议），但在某些系统上它可能位于不同的位置。&lt;/p&gt;
&lt;!--
If you can&#39;t find a repository definition related to Kubernetes, it&#39;s likely that you
don&#39;t use package managers to install Kubernetes and you don&#39;t need to take any action.
--&gt;
&lt;p&gt;如果你找不到与 Kubernetes 相关的仓库定义，则很可能你没有使用软件包管理器来安装
Kubernetes，那么你不需要执行任何操作。&lt;/p&gt;
&lt;!--
## How can I migrate to the new community-operated repositories?

For more information on how to migrate to the new community
managed packages, please refer to the
[announcement blog post for `pkgs.k8s.io`](/blog/2023/08/15/pkgs-k8s-io-introduction/).
--&gt;
&lt;h2 id=&#34;how-can-i-migrate-to-the-new-community-operated-repositories&#34;&gt;我如何迁移到新的社区运营的仓库？ &lt;/h2&gt;
&lt;p&gt;有关如何迁移到新的社区管理软件包的更多信息，请参阅
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/15/pkgs-k8s-io-introduction/&#34;&gt;&lt;code&gt;pkgs.k8s.io&lt;/code&gt;的公告博客文章&lt;/a&gt; 。&lt;/p&gt;
&lt;!--
## Why is the Kubernetes project making this change?

Kubernetes has been publishing packages solely to the Google-hosted repository
since Kubernetes v1.5, or the past **seven** years! Following in the footsteps of
migrating to our community-managed registry, `registry.k8s.io`, we are now migrating the
Kubernetes package repositories to our own community-managed infrastructure. We’re
thankful to Google for their continuous hosting and support all these years, but
this transition marks another big milestone for the project’s goal of migrating
to complete community-owned infrastructure.
--&gt;
&lt;h2 id=&#34;why-is-the-kubernetes-project-making-this-change&#34;&gt;为什么 Kubernetes 项目要做出这样的改变？ &lt;/h2&gt;
&lt;p&gt;自 Kubernetes v1.5 或过去&lt;strong&gt;七&lt;/strong&gt;年以来，Kubernetes 一直只将软件包发布到
Google 托管的仓库！继迁移到社区管理的注册表 &lt;code&gt;registry.k8s.io&lt;/code&gt; 之后，
我们现在正在将 Kubernetes 软件包仓库迁移到我们自己的社区管理的基础设施。
我们感谢 Google 这些年来持续的托管和支持，
但这一转变标志着该项目迁移到完全由社区拥有的基础设施的目标的又一个重要里程碑。&lt;/p&gt;
&lt;!--
## Is there a Kubernetes tool to help me migrate?

We don&#39;t have any announcement to make about tooling there. As a Kubernetes user, you
have to manually modify your configuration to use the new repositories. Automating
the migration from the legacy to the community-owned repositories is technically
challenging and we want to avoid any potential risks associated with this.
--&gt;
&lt;h2 id=&#34;is-there-a-kubernetes-tool-to-help-me-migrate&#34;&gt;有 Kubernetes 工具可以帮助我迁移吗？&lt;/h2&gt;
&lt;p&gt;关于迁移工具方面，我们目前没有任何公告。作为 Kubernetes 用户，
你必须手动修改配置才能使用新仓库。自动从旧仓库迁移到社区拥有的仓库在技术上具有挑战性，
我们希望避免与此相关的任何潜在风险。&lt;/p&gt;
&lt;!--
## Acknowledgments

First of all, we want to acknowledge the contributions from Alphabet. Staff at Google
have provided their time; Google as a business has provided both the infrastructure
to serve packages, and the security context for giving those packages trustworthy
digital signatures.
These have been important to the adoption and growth of Kubernetes.
--&gt;
&lt;h2 id=&#34;acknowledgments&#34;&gt;致谢 &lt;/h2&gt;
&lt;p&gt;首先，我们要感谢 Alphabet 的贡献。Google 的员工投入了他们的时间；
作为一家企业，谷歌既提供了服务于软件包的基础设施，也提供了为这些软件包提供可信数字签名的安全上下文。
这些对于 Kubernetes 的采用和成长非常重要。&lt;/p&gt;
&lt;!--
Releasing software might not be glamorous but it&#39;s important. Many people within
the Kubernetes contributor community have contributed to the new way that we, as a
project, have for building and publishing packages.
--&gt;
&lt;p&gt;发布软件可能并不那么引人注目，但很重要。Kubernetes
贡献者社区中的许多人都为我们作为一个项目构建和发布软件包的新方法做出了贡献。&lt;/p&gt;
&lt;!--
And finally, we want to once again acknowledge the help from SUSE. OpenBuildService,
from SUSE, is the technology that the powers the new community-managed package repositories.
--&gt;
&lt;p&gt;最后，我们要再次感谢 SUSE 的帮助。SUSE 的 OpenBuildService
为新的社区管理的软件包仓库提供支持的技术。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Gateway API v0.8.0：引入服务网格支持</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/29/gateway-api-v0-8/</link>
      <pubDate>Tue, 29 Aug 2023 10:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/29/gateway-api-v0-8/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Gateway API v0.8.0: Introducing Service Mesh Support&#34;
date: 2023-08-29T10:00:00-08:00
slug: gateway-api-v0-8
--&gt;
&lt;!--
***Authors:*** Flynn (Buoyant), John Howard (Google), Keith Mattix (Microsoft), Michael Beaumont (Kong), Mike Morris (independent), Rob Scott (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Flynn (Buoyant), John Howard (Google), Keith Mattix (Microsoft), Michael Beaumont (Kong), Mike Morris (independent), Rob Scott (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
We are thrilled to announce the v0.8.0 release of Gateway API! With this
release, Gateway API support for service mesh has reached [Experimental
status][status]. We look forward to your feedback!

We&#39;re especially delighted to announce that Kuma 2.3+, Linkerd 2.14+, and Istio
1.16+ are all fully-conformant implementations of Gateway API service mesh
support.
--&gt;
&lt;p&gt;我们很高兴地宣布 Gateway API 的 v0.8.0 版本发布了！
通过此版本，Gateway API 对服务网格的支持已达到&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/overview/#status&#34;&gt;实验性（Experimental）状态&lt;/a&gt;。
我们期待你的反馈！&lt;/p&gt;
&lt;p&gt;我们很高兴地宣布 Kuma 2.3+、Linkerd 2.14+ 和 Istio 1.16+ 都是 Gateway API
服务网格支持的完全一致实现。&lt;/p&gt;
&lt;!--
## Service mesh support in Gateway API

While the initial focus of Gateway API was always ingress (north-south)
traffic, it was clear almost from the beginning that the same basic routing
concepts should also be applicable to service mesh (east-west) traffic. In
2022, the Gateway API subproject started the [GAMMA initiative][gamma], a
dedicated vendor-neutral workstream, specifically to examine how best to fit
service mesh support into the framework of the Gateway API resources, without
requiring users of Gateway API to relearn everything they understand about the
API.
--&gt;
&lt;h2 id=&#34;gateway-api-中的服务网格支持&#34;&gt;Gateway API 中的服务网格支持&lt;/h2&gt;
&lt;p&gt;虽然 Gateway API 最初的重点一直是入站（南北）流量，但几乎从最开始就比较明确，
相同的基本路由概念也应适用于服务网格（东西）流量。2022 年，Gateway API
子项目启动了 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/gamma/&#34;&gt;GAMMA 计划&lt;/a&gt;，这是一个专门的供应商中立的工作流，
旨在专门研究如何最好地将服务网格支持纳入 Gateway API 资源的框架中，
而不需要 Gateway API 的用户重新学习他们了解的有关 API 的一切。&lt;/p&gt;
&lt;!--
Over the last year, GAMMA has dug deeply into the challenges and possible
solutions around using Gateway API for service mesh. The end result is a small
number of [enhancement proposals][geps] that subsume many hours of thought and
debate, and provide a minimum viable path to allow Gateway API to be used for
service mesh.
--&gt;
&lt;p&gt;在过去的一年中，GAMMA 深入研究了使用 Gateway API 用于服务网格的挑战和可能的解决方案。
最终结果是少量的&lt;a href=&#34;https://gateway-api.sigs.k8s.io/contributing/enhancement-requests/&#34;&gt;增强提案&lt;/a&gt;，其中包含了很长时间的思考和辩论，并提供允许使用 Gateway API
用于服务网格的最短可行路径。&lt;/p&gt;
&lt;!--
### How will mesh routing work when using Gateway API?

You can find all the details in the [Gateway API Mesh routing
documentation][mesh-routing] and [GEP-1426], but the short version for Gateway
API v0.8.0 is that an HTTPRoute can now have a `parentRef` that is a Service,
rather than just a Gateway. We anticipate future GEPs in this area as we gain
more experience with service mesh use cases -- binding to a Service makes it
possible to use the Gateway API with a service mesh, but there are several
interesting use cases that remain difficult to cover.

As an example, you might use an HTTPRoute to do an A-B test in the mesh as
follows:
--&gt;
&lt;h3 id=&#34;当使用-gateway-api-时-网格路由将如何工作&#34;&gt;当使用 Gateway API 时，网格路由将如何工作？&lt;/h3&gt;
&lt;p&gt;你可以在 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/gamma/#how-the-gateway-api-works-for-service-mesh&#34;&gt;Gateway API Mesh 路由文档&lt;/a&gt;和 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1426/&#34;&gt;GEP-1426&lt;/a&gt; 中找到所有详细信息，
但对于 Gateway API v0.8.0 的简短的版本是现在 HTTPRoute 可以设置 &lt;code&gt;parentRef&lt;/code&gt;，
它是一个 Service，而不仅仅是一个网关。随着我们对服务网格用例的经验不断丰富，我们预计在这个领域会出现更多
GEP -- 绑定到 Service 使得将 Gateway API 与服务网格结合使用成为可能，但仍有几个有趣的用例难以覆盖。&lt;/p&gt;
&lt;p&gt;例如，你可以使用 HTTPRoute 在网格中进行 A-B 测试，如下所示：&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/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;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;bar-route&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;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;demo-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;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;rules&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matches&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;headers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;Exact&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;env&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;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;demo-app-v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;demo-app-v2&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;port&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5000&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;!--
Any request to port 5000 of the `demo-app` Service that has the header `env:
v1` will be routed to `demo-app-v1`, while any request without that header
will be routed to `demo-app-v2` -- and since this is being handled by the
service mesh, not the ingress controller, the A/B test can happen anywhere in
the application&#39;s call graph.
--&gt;
&lt;p&gt;任何对 &lt;code&gt;demo-app&lt;/code&gt; Service 5000 端口且具有 &lt;code&gt;env: v1&lt;/code&gt; 表头的请求都将被路由到 &lt;code&gt;demo-app-v1&lt;/code&gt;，
而没有该标头的请求都将被路由到 &lt;code&gt;demo-app-v2&lt;/code&gt; -- 并且由于这是由服务网格而不是
Ingress 控制器处理的，A/B 测试可以发生在应用程序的调用图中的任何位置。&lt;/p&gt;
&lt;!--
### How do I know this will be truly portable?

Gateway API has been investing heavily in conformance tests across all
features it supports, and mesh is no exception. One of the challenges that the
GAMMA initiative ran into is that many of these tests were strongly tied to
the idea that a given implementation provides an ingress controller. Many
service meshes don&#39;t, and requiring a GAMMA-conformant mesh to also implement
an ingress controller seemed impractical at best. This resulted in work
restarting on Gateway API _conformance profiles_, as discussed in [GEP-1709].
--&gt;
&lt;h3 id=&#34;如何确定这种方案的可移植性是真的&#34;&gt;如何确定这种方案的可移植性是真的？&lt;/h3&gt;
&lt;p&gt;Gateway API 一直在其支持的所有功能的一致性测试上投入大量资源，网格也不例外。
GAMMA 面临的挑战之一是，许多测试都认为一个给定实现会提供 Ingress 控制器。
许多服务网格不提供 Ingress 控制器，要求符合 GAMMA 标准的网格同时实现 Ingress 控制器似乎并不切实际。
这导致在 Gateway API &lt;strong&gt;一致性配置文件&lt;/strong&gt;的工作重新启动，如 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1709/&#34;&gt;GEP-1709&lt;/a&gt; 中所述。&lt;/p&gt;
&lt;!--
The basic idea of conformance profiles is that we can define subsets of the
Gateway API, and allow implementations to choose (and document) which subsets
they conform to. GAMMA is adding a new profile, named `Mesh` and described in
[GEP-1686], which checks only the mesh functionality as defined by GAMMA. At
this point, Kuma 2.3+, Linkerd 2.14+, and Istio 1.16+ are all conformant with
the `Mesh` profile.
--&gt;
&lt;p&gt;一致性配置文件的基本思想是，我们可以定义 Gateway API 的子集，并允许实现选择（并记录）他们符合哪些子集。
GAMMA 正在添加一个名为 &lt;code&gt;Mesh&lt;/code&gt; 的新配置文件，其描述在 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1686/&#34;&gt;GEP-1686&lt;/a&gt; 中，仅检查由 GAMMA 定义的网格功能。
此时，Kuma 2.3+、Linkerd 2.14+ 和 Istio 1.16+ 都符合 &lt;code&gt;Mesh&lt;/code&gt; 配置文件的标准。&lt;/p&gt;
&lt;!--
## What else is in Gateway API v0.8.0?

This release is all about preparing Gateway API for the upcoming v1.0 release
where HTTPRoute, Gateway, and GatewayClass will graduate to GA. There are two
main changes related to this: CEL validation and API version changes.
--&gt;
&lt;h2 id=&#34;gateway-api-v0-8-0-中还有什么&#34;&gt;Gateway API v0.8.0 中还有什么？&lt;/h2&gt;
&lt;p&gt;这个版本的发布都是为了即将到来的 v1.0 版本做准备，其中
HTTPRoute、Gateway 和 GatewayClass 将进级为 GA。与此相关的有两个主要更改：
CEL 验证和 API 版本更改。&lt;/p&gt;
&lt;!--
### CEL Validation

The first major change is that Gateway API v0.8.0 is the start of a transition
from webhook validation to [CEL validation][cel] using information built into
the CRDs. That will mean different things depending on the version of
Kubernetes you&#39;re using:
--&gt;
&lt;h3 id=&#34;cel-验证&#34;&gt;CEL 验证&lt;/h3&gt;
&lt;p&gt;第一个重大变化是，Gateway API v0.8.0 起从 Webhook 验证转向使用内置于
CRD 中的信息的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/cel/&#34;&gt;CEL 验证&lt;/a&gt;。取决于你使用的 Kubernetes 版本，这一转换的影响有些不同：&lt;/p&gt;
&lt;!--
#### Kubernetes 1.25+

CEL validation is fully supported, and almost all validation is implemented in
CEL. (The sole exception is that header names in header modifier filters can
only do case-insensitive validation. There is more information in [issue
2277].)

We recommend _not_ using the validating webhook on these Kubernetes versions.
--&gt;
&lt;h4 id=&#34;kubernetes-1-25&#34;&gt;Kubernetes 1.25+&lt;/h4&gt;
&lt;p&gt;CEL 验证得到了完全支持，并且几乎所有验证都是在 CEL 中实现的。
（唯一的例外是，标头修饰符过滤器中的标头名称只能进行不区分大小写的验证，
更多的相关信息，请参见 &lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/issues/2277&#34;&gt;issue 2277&lt;/a&gt;。）&lt;/p&gt;
&lt;p&gt;我们建议在这些 Kubernetes 版本上不使用验证 Webhook。&lt;/p&gt;
&lt;!--
#### Kubernetes 1.23 and 1.24

CEL validation is not supported, but Gateway API v0.8.0 CRDs can still be
installed. When you upgrade to Kubernetes 1.25+, the validation included in
these CRDs will automatically take effect.

We recommend continuing to use the validating webhook on these Kubernetes
versions.
--&gt;
&lt;h4 id=&#34;kubernetes-1-23-和-1-24&#34;&gt;Kubernetes 1.23 和 1.24&lt;/h4&gt;
&lt;p&gt;不支持 CEL 验证，但仍可以安装 Gateway API v0.8.0 CRD。
当你升级到 Kubernetes 1.25+ 时，这些 CRD 中包含的验证将自动生效。&lt;/p&gt;
&lt;p&gt;我们建议在这些 Kubernetes 版本上继续使用验证 Webhook。&lt;/p&gt;
&lt;!--
#### Kubernetes 1.22 and older

Gateway API only commits to support for [5 most recent versions of
Kubernetes][supported-versions]. As such, these versions are no longer
supported by Gateway API, and unfortunately Gateway API v0.8.0 cannot be
installed on them, since CRDs containing CEL validation will be rejected.
--&gt;
&lt;h4 id=&#34;kubernetes-1-22-及更早版本&#34;&gt;Kubernetes 1.22 及更早版本&lt;/h4&gt;
&lt;p&gt;Gateway API 只承诺支持&lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/versioning/#supported-versions&#34;&gt;最新的 5 个 Kubernetes 版本&lt;/a&gt;。
因此，Gateway API 不再支持这些版本，不幸的是，在这些集群版本中无法安装 Gateway API v0.8.0，
因为包含 CEL 验证的 CRD 将被拒绝。&lt;/p&gt;
&lt;!--
### API Version Changes

As we prepare for a v1.0 release that will graduate Gateway, GatewayClass, and
HTTPRoute to the `v1` API Version from `v1beta1`, we are continuing the process
of moving away from `v1alpha2` for resources that have graduated to `v1beta1`.
For more information on this change and everything else included in this
release, refer to the [v0.8.0 release notes][v0.8.0 release notes].
--&gt;
&lt;h3 id=&#34;api-版本更改&#34;&gt;API 版本更改&lt;/h3&gt;
&lt;p&gt;在我们所准备的 v1.0 版本中，Gateway、GatewayClass 和 HTTPRoute 都会从
&lt;code&gt;v1beta1&lt;/code&gt; 升级到 &lt;code&gt;v1&lt;/code&gt; API 版本，对于已升级到 &lt;code&gt;v1beta1&lt;/code&gt; 的资源，我们将继续从 &lt;code&gt;v1alpha2&lt;/code&gt; 迁移的过程。&lt;/p&gt;
&lt;p&gt;有关此更改以及此版本中包含的所有其他内容的更多信息，请参见 &lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/releases/tag/v0.8.0&#34;&gt;v0.8.0 发布说明&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## How can I get started with Gateway API?

Gateway API represents the future of load balancing, routing, and service mesh
APIs in Kubernetes. There are already more than 20 [implementations][impl]
available (including both ingress controllers and service meshes) and the list
keeps growing.
--&gt;
&lt;h2 id=&#34;如何开始使用-gateway-api&#34;&gt;如何开始使用 Gateway API？&lt;/h2&gt;
&lt;p&gt;Gateway API 代表了 Kubernetes 中负载平衡、路由和服务网格 API 的未来。
已经有超过 20 个&lt;a href=&#34;https://gateway-api.sigs.k8s.io/implementations/&#34;&gt;实现&lt;/a&gt;可用（包括入口控制器和服务网格），而这一列表还在不断增长。&lt;/p&gt;
&lt;!--
If you&#39;re interested in getting started with Gateway API, take a look at the
[API concepts documentation][concepts] and check out some of the
[Guides][guides] to try it out. Because this is a CRD-based API, you can
install the latest version on any Kubernetes 1.23+ cluster.
--&gt;
&lt;p&gt;如果你有兴趣开始使用 Gateway API，请查阅 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/api-overview/&#34;&gt;API 概念文档&lt;/a&gt; 和一些&lt;a href=&#34;https://gateway-api.sigs.k8s.io/guides/getting-started/&#34;&gt;指南&lt;/a&gt;以尝试使用它。
因为这是一个基于 CRD 的 API，所以你可以在任何 Kubernetes 1.23+ 集群上安装最新版本。&lt;/p&gt;
&lt;!--
If you&#39;re specifically interested in helping to contribute to Gateway API, we
would love to have you! Please feel free to [open a new issue][issue] on the
repository, or join in the [discussions][disc]. Also check out the [community
page][community] which includes links to the Slack channel and community
meetings. We look forward to seeing you!!
--&gt;
&lt;p&gt;如果你有兴趣为 Gateway API 做出贡献，我们非常欢迎你！
请随时在仓库中&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/issues/new/choose&#34;&gt;报告问题&lt;/a&gt;，或加入&lt;a href=&#34;https://github.com/kubernetes-sigs/gateway-api/discussions&#34;&gt;讨论&lt;/a&gt;。
另请查看&lt;a href=&#34;https://gateway-api.sigs.k8s.io/contributing/community/&#34;&gt;社区页面&lt;/a&gt;，其中包含 Slack 频道和社区会议的链接。
我们期待你的光临！！&lt;/p&gt;
&lt;!--
## Further Reading:

- [GEP-1324] provides an overview of the GAMMA goals and some important
  definitions. This GEP is well worth a read for its discussion of the problem
  space.
- [GEP-1426] defines how to use Gateway API route resources, such as
  HTTPRoute, to manage traffic within a service mesh.
- [GEP-1686] builds on the work of [GEP-1709] to define a _conformance
  profile_ for service meshes to be declared conformant with Gateway API.
--&gt;
&lt;h2 id=&#34;进一步阅读&#34;&gt;进一步阅读：&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1324/&#34;&gt;GEP-1324&lt;/a&gt; 提供了 GAMMA 目标和一些重要定义的概述。这个 GEP 值得一读，因为它讨论了问题空间。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1426/&#34;&gt;GEP-1426&lt;/a&gt; 定义了如何使用 Gateway API 路由资源（如 HTTPRoute）管理服务网格内的流量。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1686/&#34;&gt;GEP-1686&lt;/a&gt; 在 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/gep-1709/&#34;&gt;GEP-1709&lt;/a&gt; 的工作基础上，为声明符合 Gateway API 的服务网格定义了一个一致性配置文件。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Although these are [Experimental][status] patterns, note that they are available
in the [`standard` release channel][ch], since the GAMMA initiative has not
needed to introduce new resources or fields to date.
--&gt;
&lt;p&gt;虽然这些都是&lt;a href=&#34;https://gateway-api.sigs.k8s.io/geps/overview/#status&#34;&gt;实验特性&lt;/a&gt;，但请注意，它们可在 &lt;a href=&#34;https://gateway-api.sigs.k8s.io/concepts/versioning/#release-channels-eg-experimental-standard&#34;&gt;standard 发布频道&lt;/a&gt;使用，
因为 GAMMA 计划迄今为止不需要引入新的资源或字段。&lt;/p&gt;
&lt;!--
[gamma]:https://gateway-api.sigs.k8s.io/concepts/gamma/
[status]:https://gateway-api.sigs.k8s.io/geps/overview/#status
[ch]:https://gateway-api.sigs.k8s.io/concepts/versioning/#release-channels-eg-experimental-standard
[cel]:/docs/reference/using-api/cel/
[crd]:/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/
[concepts]:https://gateway-api.sigs.k8s.io/concepts/api-overview/
[geps]:https://gateway-api.sigs.k8s.io/contributing/enhancement-requests/
[guides]:https://gateway-api.sigs.k8s.io/guides/getting-started/
[impl]:https://gateway-api.sigs.k8s.io/implementations/
[install-crds]:https://gateway-api.sigs.k8s.io/guides/getting-started/#install-the-crds
[issue]:https://github.com/kubernetes-sigs/gateway-api/issues/new/choose
[disc]:https://github.com/kubernetes-sigs/gateway-api/discussions
[community]:https://gateway-api.sigs.k8s.io/contributing/community/
[mesh-routing]:https://gateway-api.sigs.k8s.io/concepts/gamma/#how-the-gateway-api-works-for-service-mesh
[GEP-1426]:https://gateway-api.sigs.k8s.io/geps/gep-1426/
[GEP-1324]:https://gateway-api.sigs.k8s.io/geps/gep-1324/
[GEP-1686]:https://gateway-api.sigs.k8s.io/geps/gep-1686/
[GEP-1709]:https://gateway-api.sigs.k8s.io/geps/gep-1709/
[issue 2277]:https://github.com/kubernetes-sigs/gateway-api/issues/2277
[supported-versions]:https://gateway-api.sigs.k8s.io/concepts/versioning/#supported-versions
[v0.8.0 release notes]:https://github.com/kubernetes-sigs/gateway-api/releases/tag/v0.8.0
[versioning docs]:https://gateway-api.sigs.k8s.io/concepts/versioning/
--&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.28：用于改进集群安全升级的新（Alpha）机制</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/28/kubernetes-1-28-feature-mixed-version-proxy-alpha/</link>
      <pubDate>Mon, 28 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/28/kubernetes-1-28-feature-mixed-version-proxy-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.28: A New (alpha) Mechanism For Safer Cluster Upgrades&#34;
date: 2023-08-28
slug: kubernetes-1-28-feature-mixed-version-proxy-alpha
--&gt;
&lt;!--
**Author:** Richa Banker (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Richa Banker (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
This blog describes the _mixed version proxy_, a new alpha feature in Kubernetes 1.28. The
mixed version proxy enables an HTTP request for a resource to be served by the correct API server
in cases where there are multiple API servers at varied versions in a cluster. For example,
this is useful during a cluster upgrade, or when you&#39;re rolling out the runtime configuration of
the cluster&#39;s control plane.
--&gt;
&lt;p&gt;本博客介绍了&lt;strong&gt;混合版本代理（Mixed Version Proxy）&lt;/strong&gt;，这是 Kubernetes 1.28 中的一个新的
Alpha 级别特性。当集群中存在多个不同版本的 API 服务器时，混合版本代理使对资源的 HTTP 请求能够被正确的
API 服务器处理。例如，在集群升级期间或当发布集群控制平面的运行时配置时此特性非常有用。&lt;/p&gt;
&lt;!--
## What problem does this solve?
When a cluster undergoes an upgrade, the kube-apiservers existing at different
versions in that scenario can serve different sets (groups, versions, resources)
of built-in resources. A resource request made in this scenario may be served by
any of the available apiservers, potentially resulting in the request ending up
at an apiserver that may not be aware of the requested resource; consequently it
being served a 404 not found error which is incorrect. Furthermore, incorrect serving
of the 404 errors can lead to serious consequences such as namespace deletion being
blocked incorrectly or objects being garbage collected mistakenly.
--&gt;
&lt;h2 id=&#34;这解决了什么问题&#34;&gt;这解决了什么问题？&lt;/h2&gt;
&lt;p&gt;当集群进行升级时，集群中不同版本的 kube-apiserver 为不同的内置资源集（组、版本、资源）提供服务。
在这种情况下资源请求如果由任一可用的 apiserver 提供服务，请求可能会到达无法解析此请求资源的
apiserver 中；因此，它会收到 404（&amp;quot;Not Found&amp;quot;）的响应报错，这是不正确的。
此外，返回 404 的错误服务可能会导致严重的后果，例如命名空间的删除被错误阻止或资源对象被错误地回收。&lt;/p&gt;
&lt;!--
## How do we solve the problem?


&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-08-28-a-new-alpha-mechanism-for-safer-cluster-upgrades/mvp-flow-diagram.svg&#34;/&gt; 
&lt;/figure&gt;

--&gt;
&lt;h2 id=&#34;如何解决此问题&#34;&gt;如何解决此问题？&lt;/h2&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-08-28-a-new-alpha-mechanism-for-safer-cluster-upgrades/mvp-flow-diagram_zh.svg&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
The new feature “Mixed Version Proxy” provides the kube-apiserver with the capability to proxy a request to a peer kube-apiserver which is aware of the requested resource and hence can serve the request. To do this, a new filter has been added to the handler chain in the API server&#39;s aggregation layer.
--&gt;
&lt;p&gt;&amp;quot;混合版本代理&amp;quot;新特性为 kube-apiserver 提供了将请求代理到对等的、
能够感知所请求的资源并因此能够服务请求的 kube-apiserver。
为此，一个全新的过滤器已被添加到 API&lt;/p&gt;
&lt;!--
1. The new filter in the handler chain checks if the request is for a group/version/resource
   that the apiserver doesn&#39;t know about (using the existing
   [StorageVersion API](https://github.com/kubernetes/kubernetes/blob/release-1.28/pkg/apis/apiserverinternal/types.go#L25-L37)).
   If so, it proxies the request to one of the apiservers that is listed in the ServerStorageVersion object.
   If the identified peer apiserver fails to respond (due to reasons like network connectivity,
   race between the request being received and the controller registering the apiserver-resource info
   in ServerStorageVersion object), then error 503(&#34;Service Unavailable&#34;) is served.
2. To prevent indefinite proxying of the request, a (new for v1.28) HTTP header
   `X-Kubernetes-APIServer-Rerouted: true` is added to the original request once
   it is determined that the request cannot be served by the original API server.
   Setting that to true marks that the original API server couldn&#39;t handle the request
   and it should therefore be proxied. If a destination peer API server sees this header,
   it never proxies the request further.
3. To set the network location of a kube-apiserver that peers will use to proxy requests,
   the value passed in `--advertise-address` or (when `--advertise-address` is unspecified)
   the `--bind-address` flag is used. For users with network configurations that would not
   allow communication between peer kube-apiservers using the addresses specified in these flags,
   there is an option to pass in the correct peer address as `--peer-advertise-ip` and
   `--peer-advertise-port` flags that are introduced in this feature.
--&gt;
&lt;ol&gt;
&lt;li&gt;处理程序链中的新过滤器检查请求是否为 apiserver 无法解析的 API 组/版本/资源（使用现有的
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/release-1.28/pkg/apis/apiserverinternal/types.go#L25-L37&#34;&gt;StorageVersion API&lt;/a&gt;）。
如果是，它会将请求代理到 ServerStorageVersion 对象中列出的 apiserver 之一。
如果所选的对等 apiserver 无法响应（由于网络连接、收到的请求与在 ServerStorageVersion
对象中注册 apiserver-resource 信息的控制器之间的竞争等原因），则会出现 503（&amp;quot;Service Unavailable&amp;quot;）错误响应。&lt;/li&gt;
&lt;li&gt;为了防止无限期地代理请求，一旦最初的 API 服务器确定无法处理该请求，就会在原始请求中添加一个
（v1.28 新增）HTTP 请求头 &lt;code&gt;X-Kubernetes-APIServer-Rerouted: true&lt;/code&gt;。将其设置为 true 意味着原始
API 服务器无法处理该请求，需要对其进行代理。如果目标侧对等 API 服务器看到此标头，则不会对该请求做进一步的代理操作。&lt;/li&gt;
&lt;li&gt;要设置 kube-apiserver 的网络位置，以供对等服务器来代理请求，将使用 &lt;code&gt;--advertise-address&lt;/code&gt;
或（当未指定&lt;code&gt;--advertise-address&lt;/code&gt;时）&lt;code&gt;--bind-address&lt;/code&gt; 标志所设置的值。
如果网络配置中不允许用户在对等 kube-apiserver 之间使用这些标志中指定的地址进行通信，
可以选择将正确的对等地址配置在此特性引入的 &lt;code&gt;--peer-advertise-ip&lt;/code&gt; 和 &lt;code&gt;--peer-advertise-port&lt;/code&gt;
参数中。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## How do I enable this feature?
Following are the required steps to enable the feature:
--&gt;
&lt;h2 id=&#34;如何启用此特性&#34;&gt;如何启用此特性？&lt;/h2&gt;
&lt;p&gt;以下是启用此特性的步骤：&lt;/p&gt;
&lt;!--
* Download the [latest Kubernetes project](/releases/download/) (version `v1.28.0` or later)  
* Switch on the feature gate with the command line flag `--feature-gates=UnknownVersionInteroperabilityProxy=true`
  on the kube-apiservers
* Pass the CA bundle that will be used by source kube-apiserver to authenticate
  destination kube-apiserver&#39;s serving certs using the flag `--peer-ca-file`
  on the kube-apiservers. Note: this is a required flag for this feature to work.
  There is no default value enabled for this flag.
* Pass the correct ip and port of the local kube-apiserver that will be used by
  peers to connect to this kube-apiserver while proxying a request.
  Use the flags `--peer-advertise-ip` and `peer-advertise-port` to the kube-apiservers
  upon startup. If unset, the value passed to either `--advertise-address` or `--bind-address`
  is used. If those too, are unset, the host&#39;s default interface will be used.
--&gt;
&lt;ul&gt;
&lt;li&gt;下载&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/releases/download/&#34;&gt;Kubernetes 项目的最新版本&lt;/a&gt;（版本 &lt;code&gt;v1.28.0&lt;/code&gt; 或更高版本）&lt;/li&gt;
&lt;li&gt;在 kube-apiserver 上使用命令行标志 &lt;code&gt;--feature-gates=UnknownVersionInteroperabilityProxy=true&lt;/code&gt;
打开特性门控&lt;/li&gt;
&lt;li&gt;使用 kube-apiserver 的 &lt;code&gt;--peer-ca-file&lt;/code&gt; 参数为源 kube-apiserver 提供 CA 证书，
用以验证目标 kube-apiserver 的服务证书。注意：这是此功能正常工作所必需的参数。
此参数没有默认值。&lt;/li&gt;
&lt;li&gt;为本地 kube-apiserver 设置正确的 IP 和端口，在代理请求时，对等方将使用该 IP 和端口连接到此
&lt;code&gt;--peer-advertise-port&lt;/code&gt; 命令行参数来配置 kube-apiserver。
&lt;code&gt;--peer-advertise-port&lt;/code&gt; 命令行参数。
如果未设置这两个参数，则默认使用 &lt;code&gt;--advertise-address&lt;/code&gt; 或 &lt;code&gt;--bind-address&lt;/code&gt; 命令行参数的值。
如果这些也未设置，则将使用主机的默认接口。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## What’s missing?
Currently we only proxy resource requests to a peer kube-apiserver when its determined to do so.
Next we need to address how to work discovery requests in such scenarios. Right now we are planning
to have the following capabilities for beta
--&gt;
&lt;h2 id=&#34;少了什么东西&#34;&gt;少了什么东西？&lt;/h2&gt;
&lt;p&gt;目前，我们仅在确定时将资源请求代理到对等 kube-apiserver。
接下来我们需要解决如何在这种情况下处理发现请求。
目前我们计划在测试版中提供以下特性：&lt;/p&gt;
&lt;!--
* Merged discovery across all kube-apiservers
* Use an egress dialer for network connections made to peer kube-apiservers
--&gt;
&lt;ul&gt;
&lt;li&gt;合并所有 kube-apiserver 的发现数据&lt;/li&gt;
&lt;li&gt;使用出口拨号器（egress dialer）与对等 kube-apiserver 进行网络连接&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How can I learn more?

- Read the [Mixed Version Proxy documentation](/docs/concepts/architecture/mixed-version-proxy)
- Read [KEP-4020: Unknown Version Interoperability Proxy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4020-unknown-version-interoperability-proxy)
--&gt;
&lt;h2 id=&#34;如何进一步了解&#34;&gt;如何进一步了解？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;阅读&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/mixed-version-proxy&#34;&gt;混合版本代理文档&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4020-unknown-version-interoperability-proxy&#34;&gt;KEP-4020：未知版本互操作代理&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How can I get involved?
Reach us on [Slack](https://slack.k8s.io/): [#sig-api-machinery](https://kubernetes.slack.com/messages/sig-api-machinery), or through the [mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-api-machinery). 

Huge thanks to the contributors that have helped in the design, implementation, and review of this feature: Daniel Smith, Han Kang, Joe Betz, Jordan Liggit, Antonio Ojea, David Eads and Ben Luddy!
--&gt;
&lt;h2 id=&#34;如何参与其中&#34;&gt;如何参与其中？&lt;/h2&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-api-machinery&#34;&gt;#sig-api-machinery&lt;/a&gt;
或&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-api-machinery&#34;&gt;邮件列表&lt;/a&gt;
联系我们。&lt;/p&gt;
&lt;p&gt;非常感谢帮助设计、实施和评审此特性的贡献者：
Daniel Smith、Han Kang、Joe Betz、Jordan Liggit、Antonio Ojea、David Eads 和 Ben Luddy！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.28：介绍原生边车容器</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/25/native-sidecar-containers/</link>
      <pubDate>Fri, 25 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/25/native-sidecar-containers/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.28: Introducing native sidecar containers&#34;
date: 2023-08-25
slug: native-sidecar-containers
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Todd Neal (AWS), Matthias Bertschy (ARMO), Sergey Kanzhelev (Google), Gunju Kim (NAVER), Shannon Kularathna (Google)&lt;/p&gt;
&lt;!--
***Authors:*** Todd Neal (AWS), Matthias Bertschy (ARMO), Sergey Kanzhelev (Google), Gunju Kim (NAVER), Shannon Kularathna (Google)
--&gt;
&lt;!--
This post explains how to use the new sidecar feature, which enables restartable init containers and is available in alpha in Kubernetes 1.28. We want your feedback so that we can graduate this feature as soon as possible.
--&gt;
&lt;p&gt;本文介绍了如何使用新的边车（Sidecar）功能，该功能支持可重新启动的 Init 容器，
并且在 Kubernetes 1.28 以 Alpha 版本发布。我们希望得到你的反馈，以便我们尽快完成此功能。&lt;/p&gt;
&lt;!--
The concept of a “sidecar” has been part of Kubernetes since nearly the very beginning. In 2015, sidecars were described in a [blog post](/blog/2015/06/the-distributed-system-toolkit-patterns/) about composite containers as additional containers that “extend and enhance the ‘main’ container”. Sidecar containers have become a common Kubernetes deployment pattern and are often used for network proxies or as part of a logging system. Until now, sidecars were a concept that Kubernetes users applied without native support. The lack of native support has caused some usage friction, which this enhancement aims to resolve.
--&gt;
&lt;p&gt;“边车”的概念几乎从一开始就是 Kubernetes 的一部分。在 2015 年，
一篇关于复合容器的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2015/06/the-distributed-system-toolkit-patterns/&#34;&gt;博客文章（英文）&lt;/a&gt;将边车描述为“扩展和增强 ‘main’ 容器”的附加容器。
边车容器已成为一种常见的 Kubernetes 部署模式，通常用于网络代理或作为日志系统的一部分。
到目前为止，边车已经成为 Kubernetes 用户在没有原生支持情况下使用的概念。
缺乏原生支持导致了一些使用摩擦，此增强功能旨在解决这些问题。&lt;/p&gt;
&lt;!--
## What are sidecar containers in 1.28?
--&gt;
&lt;h2 id=&#34;what-are-sidecar-containers-in-1-28&#34;&gt;在 Kubernetes 1.28 中的边车容器是什么？ &lt;/h2&gt;
&lt;!--
Kubernetes 1.28 adds a new `restartPolicy` field to [init containers](/docs/concepts/workloads/pods/init-containers/) that is available when the `SidecarContainers` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled.
--&gt;
&lt;p&gt;Kubernetes 1.28 在 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/init-containers/&#34;&gt;Init 容器&lt;/a&gt;中添加了一个新的 &lt;code&gt;restartPolicy&lt;/code&gt; 字段，
该字段在 &lt;code&gt;SidecarContainers&lt;/code&gt; &lt;a href=&#34;https://deploy-preview-57407--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;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;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;initContainers&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;secret-fetch&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;secret-fetch:1.0&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;network-proxy&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;network-proxy:1.0&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Always&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The field is optional and, if set, the only valid value is Always. Setting this field changes the behavior of init containers as follows:
--&gt;
&lt;p&gt;该字段是可选的，如果对其设置，则唯一有效的值为 Always。设置此字段会更改 Init 容器的行为，如下所示：&lt;/p&gt;
&lt;!--
- The container restarts if it exits
- Any subsequent init container starts immediately after the [startupProbe](/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-startup-probes) has successfully completed instead of waiting for the restartable init container to exit
- The resource usage calculation changes for the pod as restartable init container resources are now added to the sum of the resource requests by the main containers
--&gt;
&lt;ul&gt;
&lt;li&gt;如果容器退出则会重新启动&lt;/li&gt;
&lt;li&gt;任何后续的 Init 容器在 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-startup-probes&#34;&gt;startupProbe&lt;/a&gt;
成功完成后立即启动，而不是等待可重新启动 Init 容器退出&lt;/li&gt;
&lt;li&gt;由于可重新启动的 Init 容器资源现在添加到主容器的资源请求总和中，所以 Pod 使用的资源计算发生了变化。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
[Pod termination](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination) continues to only depend on the main containers. An init container with a `restartPolicy` of `Always` (named a sidecar) won&#39;t prevent the pod from terminating after the main containers exit.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination&#34;&gt;Pod 终止&lt;/a&gt;继续仅依赖于主容器。
&lt;code&gt;restartPolicy&lt;/code&gt; 为 &lt;code&gt;Always&lt;/code&gt; 的 Init 容器（称为边车）不会阻止 Pod 在主容器退出后终止。&lt;/p&gt;
&lt;!--
The following properties of restartable init containers make them ideal for the sidecar deployment pattern:
--&gt;
&lt;p&gt;可重新启动的 Init 容器的以下属性使其非常适合边车部署模式：&lt;/p&gt;
&lt;!--
- Init containers have a well-defined startup order regardless of whether you set a `restartPolicy`, so you can ensure that your sidecar starts before any container declarations that come after the sidecar declaration in your manifest.
- Sidecar containers don&#39;t extend the lifetime of the Pod, so you can use them in short-lived Pods with no changes to the Pod lifecycle.
- Sidecar containers are restarted on exit, which improves resilience and lets you use sidecars to provide services that your main containers can more reliably consume.
--&gt;
&lt;ul&gt;
&lt;li&gt;无论你是否设置 &lt;code&gt;restartPolicy&lt;/code&gt;，初始化容器都有一个明确定义的启动顺序，
因此你可以确保你的边车在其所在清单中声明的后续任何容器之前启动。&lt;/li&gt;
&lt;li&gt;边车容器不会延长 Pod 的生命周期，因此你可以在短生命周期的 Pod 中使用它们，而不会对 Pod 生命周期产生改变。&lt;/li&gt;
&lt;li&gt;边车容器在退出时将被重新启动，这提高了弹性，并允许你使用边车来为主容器提供更可靠地服务。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## When to use sidecar containers
--&gt;
&lt;h2 id=&#34;when-to-use-sidecar-containers&#34;&gt;何时要使用边车容器&lt;/h2&gt;
&lt;!--
You might find built-in sidecar containers useful for workloads such as the following:
--&gt;
&lt;p&gt;你可能会发现内置边车容器对于以下工作负载很有用：&lt;/p&gt;
&lt;!--
- **Batch or AI/ML workloads**, or other Pods that run to completion. These workloads will experience the most significant benefits.
- **Network proxies** that start up before any other container in the manifest. Every other container that runs can use the proxy container&#39;s services. For instructions, see the [Kubernetes Native sidecars in Istio blog post](https://istio.io/latest/blog/2023/native-sidecars/).
- **Log collection containers**, which can now start before any other container and run until the Pod terminates. This improves the reliability of log collection in your Pods.
- **Jobs**, which can use sidecars for any purpose without Job completion being blocked by the running sidecar. No additional configuration is required to ensure this behavior.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;批量或 AI/ML 工作负载&lt;/strong&gt;，或已运行完成的其他 Pod。这些工作负载将获得最显着的好处。&lt;/li&gt;
&lt;li&gt;任何在清单中其他容器之前启动的&lt;strong&gt;网络代理&lt;/strong&gt;。所有运行的其他容器都可以使用代理容器的服务。
有关说明，请参阅&lt;a href=&#34;https://istio.io/latest/blog/2023/native-sidecars/&#34;&gt;在 Istio 中使用 Kubernetes 原生 Sidecar&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;日志收集容器&lt;/strong&gt;，现在可以在任何其他容器之前启动并运行直到 Pod 终止。这提高了 Pod 中日志收集的可靠性。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Job&lt;/strong&gt;，可以将边车用于任何目的，而 Job 完成不会被正在运行的边车阻止。无需额外配置即可确保此行为。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How did users get sidecar behavior before 1.28?
--&gt;
&lt;h2 id=&#34;how-did-users-get-sidecar-behavior-before-1-28&#34;&gt;1.28 之前用户如何获得 Sidecar 行为？&lt;/h2&gt;
&lt;!--
Prior to the sidecar feature, the following options were available for implementing sidecar behavior depending on the desired lifetime of the sidecar container:
--&gt;
&lt;p&gt;在边车功能出现之前，可以使用以下选项来根据边车容器的所需生命周期来实现边车行为：&lt;/p&gt;
&lt;!--
- **Lifetime of sidecar less than Pod lifetime**: Use an init container, which provides well-defined startup order. However, the sidecar has to exit for other init containers and main Pod containers to start.
- **Lifetime of sidecar equal to Pod lifetime**: Use a main container that runs alongside your workload containers in the Pod. This method doesn&#39;t give you control over startup order, and lets the sidecar container potentially block Pod termination after the workload containers exit.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;边车的生命周期小于 Pod 生命周期&lt;/strong&gt;：使用 Init 容器，它提供明确定义的启动顺序。
然而，边车必须退出才能让其他 Init 容器和主 Pod 容器启动。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;边车的生命周期等于 Pod 生命周期&lt;/strong&gt;：使用与 Pod 中的工作负载容器一起运行的主容器。
此方法无法让你控制启动顺序，并让边车容器可能会在工作负载容器退出后阻止 Pod 终止。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The built-in sidecar feature solves for the use case of having a lifetime equal to the Pod lifetime and has the following additional benefits:
--&gt;
&lt;p&gt;内置的边车功能解决了其生命周期与 Pod 生命周期相同的用例，并具有以下额外优势：&lt;/p&gt;
&lt;!--
- Provides control over startup order
- Doesn’t block Pod termination
--&gt;
&lt;ul&gt;
&lt;li&gt;提供对启动顺序的控制&lt;/li&gt;
&lt;li&gt;不阻碍 Pod 终止&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Transitioning existing sidecars to the new model
--&gt;
&lt;h2 id=&#34;transitioning-existing-sidecars-to-the-new-model&#34;&gt;将现有边车过渡到新模式&lt;/h2&gt;
&lt;!--
We recommend only using the sidecars feature gate in [short lived testing clusters](/docs/reference/command-line-tools-reference/feature-gates/#feature-stages) at the alpha stage. If you have an existing sidecar that is configured as a main container so it can run for the lifetime of the pod, it can be moved to the `initContainers` section of the pod spec and given a `restartPolicy` of `Always`. In many cases, the sidecar should work as before with the added benefit of having a defined startup ordering and not prolonging the pod lifetime.
--&gt;
&lt;p&gt;我们建议仅在 Alpha 阶段的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/#feature-stages&#34;&gt;短期测试集群&lt;/a&gt;中使用边车功能。
如果你有一个现有的边车，被配置为主容器，以便它可以在 Pod 的生命周期内运行，
则可以将其移至 Pod 规范的 &lt;code&gt;initContainers&lt;/code&gt; 部分，并将 &lt;code&gt;restartPolicy&lt;/code&gt; 指定为 &lt;code&gt;Always&lt;/code&gt;。
在许多情况下，边车应该像以前一样工作，并具有定义启动顺序且不会延长 Pod 生命周期的额外好处。&lt;/p&gt;
&lt;!--
## Known issues
--&gt;
&lt;h2 id=&#34;known-issues&#34;&gt;已知问题&lt;/h2&gt;
&lt;!--
The alpha release of built-in sidecar containers has the following known issues, which we&#39;ll resolve before graduating the feature to beta:
--&gt;
&lt;p&gt;内置边车容器的 Alpha 版本具有以下已知问题，我们将在该功能升级为 Beta 之前解决这些问题：&lt;/p&gt;
&lt;!--
- The CPU, memory, device, and topology manager are unaware of the sidecar container lifetime and additional resource usage, and will operate as if the Pod had lower resource requests than it actually does.
- The output of `kubectl describe node` is incorrect when sidecars are in use. The output shows resource usage that&#39;s lower than the actual usage because it doesn&#39;t use the new resource usage calculation for sidecar containers.
--&gt;
&lt;ul&gt;
&lt;li&gt;CPU、内存、设备和拓扑管理器不知道边车容器的生命周期和额外的资源使用情况，并且会像 Pod 的资源请求低于实际情况的方式运行。&lt;/li&gt;
&lt;li&gt;使用边车时，&lt;code&gt;kubectl describe node&lt;/code&gt; 的输出不正确。输出显示的资源使用量低于实际使用量，
因为它没有对边车容器使用新的资源使用计算方式。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## We need your feedback!
--&gt;
&lt;h2 id=&#34;we-need-your-feedback&#34;&gt;我们需要你的反馈！&lt;/h2&gt;
&lt;!--
In the alpha stage, we want you to try out sidecar containers in your environments and open issues if you encounter bugs or friction points. We&#39;re especially interested in feedback about the following:
--&gt;
&lt;p&gt;在 Alpha 阶段，我们希望你在环境中尝试边车容器，并在遇到错误或摩擦点时提出问题。我们对以下方面的反馈特别感兴趣：&lt;/p&gt;
&lt;!--
- The shutdown sequence, especially with multiple sidecars running 
- The backoff timeout adjustment for crashing sidecars 
- The behavior of Pod readiness and liveness probes when sidecars are running
--&gt;
&lt;ul&gt;
&lt;li&gt;关闭顺序，尤其是多个边车运行时&lt;/li&gt;
&lt;li&gt;碰撞边车的退避超时调整&lt;/li&gt;
&lt;li&gt;边车运行时 Pod 就绪性和活性探测的行为&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
To open an issue, see the [Kubernetes GitHub repository](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;Kubernetes GitHub 存储库&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## What’s next?
--&gt;
&lt;h2 id=&#34;what-s-next&#34;&gt;接下来是什么？&lt;/h2&gt;
&lt;!--
In addition to the known issues that will be resolved, we&#39;re working on adding termination ordering for sidecar and main containers. This will ensure that sidecar containers only terminate after the Pod&#39;s main containers have exited.
--&gt;
&lt;p&gt;除了将要解决的已知问题之外，我们正在努力为边车和主容器添加终止顺序。这将确保边车容器仅在 Pod 主容器退出后终止。&lt;/p&gt;
&lt;!--
We’re excited to see the sidecar feature come to Kubernetes and are interested in feedback.
--&gt;
&lt;p&gt;我们很高兴看到 Kubernetes 引入了边车功能，并期望得到反馈。&lt;/p&gt;
&lt;!--
## Acknowledgements
--&gt;
&lt;h2 id=&#34;acknowledgements&#34;&gt;致谢&lt;/h2&gt;
&lt;!--
Many years have passed since the original KEP was written, so we apologize if we omit anyone who worked on this feature over the years. This is a best-effort attempt to recognize the people involved in this effort.
--&gt;
&lt;p&gt;自从最初的 KEP 编写以来已经过去了很多年，因此如果我们遗漏了多年来致力于此功能的任何人，我们将深表歉意。
这也是识别该功能参与者的最大限度努力。&lt;/p&gt;
&lt;!--
- [mrunalp](https://github.com/mrunalp/) for design discussions and reviews
- [thockin](https://github.com/thockin/) for API discussions and support thru years
- [bobbypage](https://github.com/bobbypage) for reviews
- [smarterclayton](https://github.com/smarterclayton) for detailed review and feedback
- [howardjohn](https://github.com/howardjohn) for feedback over years and trying it early during implementation
- [derekwaynecarr](https://github.com/derekwaynecarr) and [dchen1107](https://github.com/dchen1107) for leadership
- [jpbetz](https://github.com/Jpbetz) for API and termination ordering designs as well as code reviews
- [Joseph-Irving](https://github.com/Joseph-Irving) and [rata](https://github.com/rata) for the early iterations design and reviews years back
- [swatisehgal](https://github.com/swatisehgal) and [ffromani](https://github.com/ffromani) for early feedback on resource managers impact
- [alculquicondor](https://github.com/Alculquicondor) for feedback on addressing the version skew of the scheduler
- [wojtek-t](https://github.com/Wojtek-t) for PRR review of a KEP
- [ahg-g](https://github.com/ahg-g) for reviewing the scheduler portion of a KEP
- [adisky](https://github.com/Adisky) for the Job completion issue
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/mrunalp/&#34;&gt;mrunalp&lt;/a&gt; 对于设计的探讨和评论&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/thockin/&#34;&gt;thockin&lt;/a&gt; 多年来对于 API 的讨论和支持&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bobbypage&#34;&gt;bobbypage&lt;/a&gt; 的审查工作&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/smarterclayton&#34;&gt;smarterclayton&lt;/a&gt; 进行详细审查和反馈&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/howardjohn&#34;&gt;howardjohn&lt;/a&gt; 多年来进行的反馈以及在实施过程中的早期尝试&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/derekwaynecarr&#34;&gt;derekwaynecarr&lt;/a&gt; 和 &lt;a href=&#34;https://github.com/dchen1107&#34;&gt;dchen1107&lt;/a&gt; 的领导力&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Jpbetz&#34;&gt;jpbetz&lt;/a&gt; 对 API 和终止排序的设计以及代码审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Joseph-Irving&#34;&gt;Joseph-Irving&lt;/a&gt; 和 &lt;a href=&#34;https://github.com/rata&#34;&gt;rata&lt;/a&gt; 对于多年前的早期迭代设计和审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/swatisehgal&#34;&gt;swatisehgal&lt;/a&gt; 和 &lt;a href=&#34;https://github.com/ffromani&#34;&gt;ffromani&lt;/a&gt;
对于有关资源管理器影响的早期反馈&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Alculquicondor&#34;&gt;alculquicondor&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; 对于 KEP 的 PRR 进行审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ahg-g&#34;&gt;ahg-g&lt;/a&gt; 对于 KEP 的调度程序部分进行审查&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Adisky&#34;&gt;adisky&lt;/a&gt; 处理了 Job 完成问题&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## More Information
--&gt;
&lt;h2 id=&#34;more-information&#34;&gt;更多内容&lt;/h2&gt;
&lt;!--
- Read [API for sidecar containers](/docs/concepts/workloads/pods/init-containers/#api-for-sidecar-containers) in the Kubernetes documentation
- Read the [Sidecar KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/753-sidecar-containers/README.md)
--&gt;
&lt;ul&gt;
&lt;li&gt;阅读 Kubernetes 文档中的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/init-containers/#api-for-sidecar-containers&#34;&gt;边车容器 API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/753-sidecar-containers/README.md&#34;&gt;边车 KEP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.28：在 Linux 上使用交换内存的 Beta 支持</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/24/swap-linux-beta/</link>
      <pubDate>Thu, 24 Aug 2023 10:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/24/swap-linux-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.28: Beta support for using swap on Linux&#34;
date: 2023-08-24T10:00:00-08:00
slug: swap-linux-beta
--&gt;
&lt;!--
**Author:** Itamar Holder (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Itamar Holder (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
The 1.22 release [introduced Alpha support](/blog/2021/08/09/run-nodes-with-swap-alpha/) for configuring swap memory usage for Kubernetes workloads running on Linux on a per-node basis. Now, in release 1.28, support for swap on Linux nodes has graduated to Beta, along with many new improvements.
--&gt;
&lt;p&gt;Kubernetes 1.22 版本为交换内存&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2021/08/09/run-nodes-with-swap-alpha/&#34;&gt;引入了一项 Alpha 支持&lt;/a&gt;，
用于为在 Linux 节点上运行的 Kubernetes 工作负载逐个节点地配置交换内存使用。
现在，在 1.28 版中，对 Linux 节点上的交换内存的支持已升级为 Beta 版，并有许多新的改进。&lt;/p&gt;
&lt;!--
Prior to version 1.22, Kubernetes did not provide support for swap memory on Linux systems. This was due to the inherent difficulty in guaranteeing and accounting for pod memory utilization when swap memory was involved. As a result, swap support was deemed out of scope in the initial design of Kubernetes, and the default behavior of a kubelet was to fail to start if swap memory was detected on a node.
--&gt;
&lt;p&gt;在 1.22 版之前，Kubernetes 不提供对 Linux 系统上交换内存的支持。
这是由于在涉及交换内存时保证和计算 Pod 内存利用率的固有困难。
因此，交换内存支持被认为超出了 Kubernetes 的初始设计范围，并且如果在节点上检测到交换内存，
kubelet 的默认行为是无法启动。&lt;/p&gt;
&lt;!--
In version 1.22, the swap feature for Linux was initially introduced in its Alpha stage. This represented a significant advancement, providing Linux users with the opportunity to experiment with the swap feature for the first time. However, as an Alpha version, it was not fully developed and had several issues, including inadequate support for cgroup v2, insufficient metrics and summary API statistics, inadequate testing, and more.
--&gt;
&lt;p&gt;在 1.22 版中，Linux 的交换特性以 Alpha 阶段初次引入。
这代表着一项重大进步，首次为 Linux 用户提供了尝试交换内存特性的机会。
然而，作为 Alpha 版本，它尚未开发完成，并存在一些问题，
包括对 cgroup v2 支持的不足、指标和 API 统计摘要不足、测试不足等等。&lt;/p&gt;
&lt;!--
Swap in Kubernetes has numerous [use cases](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md#user-stories) for a wide range of users. As a result, the node special interest group within the Kubernetes project has invested significant effort into supporting swap on Linux nodes for beta. Compared to the alpha, the kubelet&#39;s support for running with swap enabled is more stable and robust, more user-friendly, and addresses many known shortcomings. This graduation to beta represents a crucial step towards achieving the goal of fully supporting swap in Kubernetes.
--&gt;
&lt;p&gt;Kubernetes 中的交换内存有许多&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md#user-stories&#34;&gt;用例&lt;/a&gt;，
并适用于大量用户。因此，Kubernetes 项目内的节点特别兴趣小组投入了大量精力来支持
Linux 节点上的交换内存特性的 Beta 版本。
与 Alpha 版本相比，启用交换内存后 kubelet 的运行更加稳定和健壮，更加用户友好，并且解决了许多已知缺陷。
这次升级到 Beta 版代表朝着实现在 Kubernetes 中完全支持交换内存的目标迈出了关键一步。&lt;/p&gt;
&lt;!--
## How do I use it?
--&gt;
&lt;h2 id=&#34;how-do-i-use-it&#34;&gt;如何使用此特性？&lt;/h2&gt;
&lt;!--
The utilization of swap memory on a node where it has already been provisioned can be facilitated by the activation of the `NodeSwap` feature gate on the kubelet. Additionally, you must disable the `failSwapOn` configuration setting, or the deprecated `--fail-swap-on` command line flag must be deactivated.
--&gt;
&lt;p&gt;通过激活 kubelet 上的 &lt;code&gt;NodeSwap&lt;/code&gt; 特性门控，可以在已配置交换内存的节点上使用此特性。
此外，你必须禁用 &lt;code&gt;failSwapOn&lt;/code&gt; 设置，或者停用已被弃用的 &lt;code&gt;--fail-swap-on&lt;/code&gt; 命令行标志。&lt;/p&gt;
&lt;!--
It is possible to configure the `memorySwap.swapBehavior` option to define the manner in which a node utilizes swap memory. For instance,
--&gt;
&lt;p&gt;可以配置 &lt;code&gt;memorySwap.swapBehavior&lt;/code&gt; 选项来定义节点使用交换内存的方式。例如：&lt;/p&gt;
&lt;!--
```yaml
# this fragment goes into the kubelet&#39;s configuration file
memorySwap:
  swapBehavior: UnlimitedSwap
```
--&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;# 将此段内容放入 kubelet 配置文件&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;memorySwap&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;swapBehavior&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;UnlimitedSwap&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 available configuration options for `swapBehavior` are:
--&gt;
&lt;p&gt;&lt;code&gt;swapBehavior&lt;/code&gt; 的可用配置选项有：&lt;/p&gt;
&lt;!--
- `UnlimitedSwap` (default): Kubernetes workloads can use as much swap memory as they request, up to the system limit.
- `LimitedSwap`: The utilization of swap memory by Kubernetes workloads is subject to limitations. Only Pods of [Burstable](docs/concepts/workloads/pods/pod-qos/#burstable) QoS are permitted to employ swap.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;UnlimitedSwap&lt;/code&gt;（默认）：Kubernetes 工作负载可以根据请求使用尽可能多的交换内存，最多可达到系统限制。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;LimitedSwap&lt;/code&gt;：Kubernetes 工作负载对交换内存的使用受到限制。
只有 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/pods/pod-qos/#burstable&#34;&gt;Burstable&lt;/a&gt; QoS Pod 才允许使用交换内存。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
If configuration for `memorySwap` is not specified and the feature gate is enabled, by default the kubelet will apply the same behaviour as the `UnlimitedSwap` setting.
--&gt;
&lt;p&gt;如果未指定 &lt;code&gt;memorySwap&lt;/code&gt; 的配置并且启用了特性门控，则默认情况下，
kubelet 将应用与 &lt;code&gt;UnlimitedSwap&lt;/code&gt; 设置相同的行为。&lt;/p&gt;
&lt;!--
Note that `NodeSwap` is supported for **cgroup v2** only. For Kubernetes v1.28, using swap along with cgroup v1 is no longer supported.
--&gt;
&lt;p&gt;请注意，仅 &lt;strong&gt;cgroup v2&lt;/strong&gt; 支持 &lt;code&gt;NodeSwap&lt;/code&gt;。针对 Kubernetes v1.28，不再支持将交换内存与 cgroup v1 一起使用。&lt;/p&gt;
&lt;!--
## Install a swap-enabled cluster with kubeadm
--&gt;
&lt;h2 id=&#34;install-a-swap-enabled-cluster-with-kubeadm&#34;&gt;使用 kubeadm 安装支持交换内存的集群&lt;/h2&gt;
&lt;!--
### Before you begin
--&gt;
&lt;h3 id=&#34;before-you-begin&#34;&gt;开始之前&lt;/h3&gt;
&lt;!--
It is required for this demo that the kubeadm tool be installed, following the steps outlined in the [kubeadm installation guide](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm). If swap is already enabled on the node, cluster creation may proceed. If swap is not enabled, please refer to the provided instructions for enabling swap.
--&gt;
&lt;p&gt;此演示需要安装 kubeadm 工具，
安装过程按照 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/product-environment/tools/kubeadm/create-cluster-kubeadm&#34;&gt;kubeadm 安装指南&lt;/a&gt;中描述的步骤进行操作。
如果节点上已启用交换内存，则可以继续创建集群。如果未启用交换内存，请参阅提供的启用交换内存说明。&lt;/p&gt;
&lt;!--
### Create a swap file and turn swap on
--&gt;
&lt;h3 id=&#34;create-a-swap-file-and-turn-swap-on&#34;&gt;创建交换内存文件并开启交换内存功能&lt;/h3&gt;
&lt;!--
I&#39;ll demonstrate creating 4GiB of unencrypted swap.
--&gt;
&lt;p&gt;我将演示创建 4GiB 的未加密交换内存。&lt;/p&gt;
&lt;!--
```bash
dd if=/dev/zero of=/swapfile bs=128M count=32
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s # enable the swap file only until this node is rebooted
```
--&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;dd &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/dev/zero &lt;span style=&#34;color:#b8860b&#34;&gt;of&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/swapfile &lt;span style=&#34;color:#b8860b&#34;&gt;bs&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;128M &lt;span style=&#34;color:#b8860b&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chmod &lt;span style=&#34;color:#666&#34;&gt;600&lt;/span&gt; /swapfile
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkswap /swapfile
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swapon /swapfile
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swapon -s &lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 仅在该节点被重新启动后启用该交换内存文件&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
To start the swap file at boot time, add line like `/swapfile swap swap defaults 0 0` to `/etc/fstab` file.
--&gt;
&lt;p&gt;要在引导时启动交换内存文件，请将诸如 &lt;code&gt;/swapfile swap swap defaults 0 0&lt;/code&gt; 的内容添加到 &lt;code&gt;/etc/fstab&lt;/code&gt; 文件中。&lt;/p&gt;
&lt;!--
### Set up a Kubernetes cluster that uses swap-enabled nodes
--&gt;
&lt;h3 id=&#34;set-up-a-kubernetes-cluster-that-uses-swap-enabled-nodes&#34;&gt;在 Kubernetes 集群中设置开启交换内存的节点 &lt;/h3&gt;
&lt;!--
To make things clearer, here is an example kubeadm configuration file `kubeadm-config.yaml` for the swap enabled cluster.
--&gt;
&lt;p&gt;清晰起见，这里给出启用交换内存特性的集群的 kubeadm 配置文件示例 &lt;code&gt;kubeadm-config.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:#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;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;kubeadm.k8s.io/v1beta3&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;kind&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;InitConfiguration&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#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;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;failSwapOn&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;featureGates&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;NodeSwap&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;memorySwap&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;swapBehavior&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;LimitedSwap&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then create a single-node cluster using `kubeadm init --config kubeadm-config.yaml`. During init, there is a warning that swap is enabled on the node and in case the kubelet `failSwapOn` is set to true. We plan to remove this warning in a future release.
--&gt;
&lt;p&gt;接下来使用 &lt;code&gt;kubeadm init --config kubeadm-config.yaml&lt;/code&gt; 创建单节点集群。
在初始化过程中，如果 kubelet &lt;code&gt;failSwapOn&lt;/code&gt; 设置为 true，则会出现一条警告，告知节点上启用了交换内存特性。
我们计划在未来的版本中删除此警告。&lt;/p&gt;
&lt;!--
## How is the swap limit being determined with LimitedSwap?
--&gt;
&lt;h2 id=&#34;how-is-the-swap-limit-being-determined-with-limitedswap&#34;&gt;如何通过 LimitedSwap 确定交换内存限额？&lt;/h2&gt;
&lt;!--
The configuration of swap memory, including its limitations, presents a significant challenge. Not only is it prone to misconfiguration, but as a system-level property, any misconfiguration could potentially compromise the entire node rather than just a specific workload. To mitigate this risk and ensure the health of the node, we have implemented Swap in Beta with automatic configuration of limitations.
--&gt;
&lt;p&gt;交换内存的配置（包括其局限性）是一项挑战。不仅容易出现配置错误，而且作为系统级属性，
任何错误配置都可能危及整个节点而不仅仅是特定的工作负载。
为了减轻这种风险并确保节点的健康，我们在交换内存的 Beta 版本中实现了对缺陷的自动配置。&lt;/p&gt;
&lt;!--
With `LimitedSwap`, Pods that do not fall under the Burstable QoS classification (i.e. `BestEffort`/`Guaranteed` Qos Pods) are prohibited from utilizing swap memory. `BestEffort` QoS Pods exhibit unpredictable memory consumption patterns and lack information regarding their memory usage, making it difficult to determine a safe allocation of swap memory. Conversely, `Guaranteed` QoS Pods are typically employed for applications that rely on the precise allocation of resources specified by the workload, with memory being immediately available. To maintain the aforementioned security and node health guarantees, these Pods are not permitted to use swap memory when `LimitedSwap` is in effect.
--&gt;
&lt;p&gt;使用 &lt;code&gt;LimitedSwap&lt;/code&gt;，不属于 Burstable QoS 类别的 Pod（即 &lt;code&gt;BestEffort&lt;/code&gt;/&lt;code&gt;Guaranteed&lt;/code&gt; QoS Pod）被禁止使用交换内存。
&lt;code&gt;BestEffort&lt;/code&gt; QoS Pod 表现出不可预测的内存消耗模式，并且缺乏有关其内存使用情况的信息，
因此很难完成交换内存的安全分配。相反，&lt;code&gt;Guaranteed&lt;/code&gt; QoS Pod 通常用于根据工作负载的设置精确分配资源的应用，
其中的内存资源立即可用。
为了维持上述安全和节点健康保证，当 &lt;code&gt;LimitedSwap&lt;/code&gt; 生效时，这些 Pod 将不允许使用交换内存。&lt;/p&gt;
&lt;!--
Prior to detailing the calculation of the swap limit, it is necessary to define the following terms:
--&gt;
&lt;p&gt;在详细计算交换内存限制之前，有必要定义以下术语：&lt;/p&gt;
&lt;!--
* `nodeTotalMemory`: The total amount of physical memory available on the node.
* `totalPodsSwapAvailable`: The total amount of swap memory on the node that is available for use by Pods (some swap memory may be reserved for system use).
* `containerMemoryRequest`: The container&#39;s memory request.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nodeTotalMemory&lt;/code&gt;：节点上可用的物理内存总量。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;totalPodsSwapAvailable&lt;/code&gt;：节点上可供 Pod 使用的交换内存总量（可以保留一些交换内存供系统使用）。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;containerMemoryRequest&lt;/code&gt;：容器的内存请求。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Swap limitation is configured as: `(containerMemoryRequest / nodeTotalMemory) × totalPodsSwapAvailable`
--&gt;
&lt;p&gt;交换内存限制配置为：&lt;code&gt;(containerMemoryRequest / nodeTotalMemory) × totalPodsSwapAvailable&lt;/code&gt;&lt;/p&gt;
&lt;!--
In other words, the amount of swap that a container is able to use is proportionate to its memory request, the node&#39;s total physical memory and the total amount of swap memory on the node that is available for use by Pods.
--&gt;
&lt;p&gt;换句话说，容器能够使用的交换内存量与其内存请求、节点的总物理内存以及节点上可供 Pod
使用的交换内存总量呈比例关系。&lt;/p&gt;
&lt;!--
It is important to note that, for containers within Burstable QoS Pods, it is possible to opt-out of swap usage by specifying memory requests that are equal to memory limits. Containers configured in this manner will not have access to swap memory.
--&gt;
&lt;p&gt;值得注意的是，对于 Burstable QoS Pod 中的容器，可以通过设置内存限制与内存请求相同来选择不使用交换内存。
以这种方式配置的容器将无法访问交换内存。&lt;/p&gt;
&lt;!--
## How does it work?
--&gt;
&lt;h2 id=&#34;how-does-it-work&#34;&gt;此特性如何工作？&lt;/h2&gt;
&lt;!--
There are a number of possible ways that one could envision swap use on a node. When swap is already provisioned and available on a node, SIG Node have [proposed](https://github.com/kubernetes/enhancements/blob/9d127347773ad19894ca488ee04f1cd3af5774fc/keps/sig-node/2400-node-swap/README.md#proposal) the kubelet should be able to be configured so that:
--&gt;
&lt;p&gt;我们可以想象可以在节点上使用交换内存的多种可能方式。当节点上提供了交换内存并可用时，
SIG 节点&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/9d127347773ad19894ca488ee04f1cd3af5774fc/keps/sig-node/2400-node-swap/README.md#proposal&#34;&gt;建议&lt;/a&gt;
kubelet 应该能够遵循如下的配置：&lt;/p&gt;
&lt;!--
- It can start with swap on.
- It will direct the Container Runtime Interface to allocate zero swap memory to Kubernetes workloads by default.
--&gt;
&lt;ul&gt;
&lt;li&gt;在交换内存特性被启用时能够启动。&lt;/li&gt;
&lt;li&gt;默认情况下，kubelet 将指示容器运行时接口（CRI）不为 Kubernetes 工作负载分配交换内存。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Swap configuration on a node is exposed to a cluster admin via the [`memorySwap` in the KubeletConfiguration](/docs/reference/config-api/kubelet-config.v1). As a cluster administrator, you can specify the node&#39;s behaviour in the presence of swap memory by setting `memorySwap.swapBehavior`.
--&gt;
&lt;p&gt;节点上的交换内存配置通过 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/config-api/kubelet-config.v1&#34;&gt;KubeletConfiguration 中的 &lt;code&gt;memorySwap&lt;/code&gt;&lt;/a&gt; 向集群管理员公开。
作为集群管理员，你可以通过设置 &lt;code&gt;memorySwap.swapBehavior&lt;/code&gt; 来指定存在交换内存时节点的行为。&lt;/p&gt;
&lt;!--
The kubelet [employs the CRI](https://kubernetes.io/docs/concepts/architecture/cri/) (container runtime interface) API to direct the CRI to configure specific cgroup v2 parameters (such as `memory.swap.max`) in a manner that will enable the desired swap configuration for a container. The CRI is then responsible to write these settings to the container-level cgroup.
--&gt;
&lt;p&gt;kubelet &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cri&#34;&gt;使用 CRI&lt;/a&gt;
（容器运行时接口）API 来指示 CRI 配置特定的 cgroup v2 参数（例如 &lt;code&gt;memory.swap.max&lt;/code&gt;），
配置方式要支持容器所期望的交换内存配置。接下来，CRI 负责将这些设置写入容器级的 cgroup。&lt;/p&gt;
&lt;!--
## How can I monitor swap?
--&gt;
&lt;h2 id=&#34;how-can-i-monitor-swap&#34;&gt;如何对交换内存进行监控？&lt;/h2&gt;
&lt;!--
A notable deficiency in the Alpha version was the inability to monitor and introspect swap usage. This issue has been addressed in the Beta version introduced in Kubernetes 1.28, which now provides the capability to monitor swap usage through several different methods.
--&gt;
&lt;p&gt;Alpha 版本的一个显著缺陷是无法监控或检视交换内存的使用情况。
这个问题已在 Kubernetes 1.28 引入的 Beta 版本中得到解决，该版本现在提供了通过多种不同方法监控交换内存使用情况的能力。&lt;/p&gt;
&lt;!--
The beta version of kubelet now collects [node-level metric statistics](/docs/reference/instrumentation/node-metrics/), which can be accessed at the `/metrics/resource` and `/stats/summary` kubelet HTTP endpoints. This allows clients who can directly interrogate the kubelet to monitor swap usage and remaining swap memory when using LimitedSwap. Additionally, a `machine_swap_bytes` metric has been added to cadvisor to show the total physical swap capacity of the machine.
--&gt;
&lt;p&gt;kubelet 的 Beta 版本现在支持收集&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/instrumentation/node-metrics/&#34;&gt;节点级指标统计信息&lt;/a&gt;，
可以通过 &lt;code&gt;/metrics/resource&lt;/code&gt; 和 &lt;code&gt;/stats/summary&lt;/code&gt; kubelet HTTP 端点进行访问。
这些信息使得客户端能够在使用 LimitedSwap 时直接访问 kubelet 来监控交换内存使用情况和剩余交换内存情况。
此外，cadvisor 中还添加了 &lt;code&gt;machine_swap_bytes&lt;/code&gt; 指标，以显示机器上总的物理交换内存容量。&lt;/p&gt;
&lt;!--
## Caveats
--&gt;
&lt;h2 id=&#34;caveats&#34;&gt;注意事项&lt;/h2&gt;
&lt;!--
Having swap available on a system reduces predictability. Swap&#39;s performance is worse than regular memory, sometimes by many orders of magnitude, which can cause unexpected performance regressions. Furthermore, swap changes a system&#39;s behaviour under memory pressure. Since enabling swap permits greater memory usage for workloads in Kubernetes that cannot be predictably accounted for, it also increases the risk of noisy neighbours and unexpected packing configurations, as the scheduler cannot account for swap memory usage.
--&gt;
&lt;p&gt;在系统上提供可用交换内存会降低可预测性。由于交换内存的性能比常规内存差，
有时差距甚至在多个数量级，因而可能会导致意外的性能下降。此外，交换内存会改变系统在内存压力下的行为。
由于启用交换内存允许 Kubernetes 中的工作负载使用更大的内存量，而这一用量是无法预测的，
因此也会增加嘈杂邻居和非预期的装箱配置的风险，因为调度程序无法考虑交换内存使用情况。&lt;/p&gt;
&lt;!--
The performance of a node with swap memory enabled depends on the underlying physical storage. When swap memory is in use, performance will be significantly worse in an I/O operations per second (IOPS) constrained environment, such as a cloud VM with I/O throttling, when compared to faster storage mediums like solid-state drives or NVMe.
--&gt;
&lt;p&gt;启用交换内存的节点的性能取决于底层物理存储。当使用交换内存时，与固态硬盘或 NVMe 等更较快的存储介质相比，
在每秒 I/O 操作数（IOPS）受限的环境（例如具有 I/O 限制的云虚拟机）中，性能会明显变差。&lt;/p&gt;
&lt;!--
As such, we do not advocate the utilization of swap memory for workloads or environments that are subject to performance constraints. Furthermore, it is recommended to employ `LimitedSwap`, as this significantly mitigates the risks posed to the node.
--&gt;
&lt;p&gt;因此，我们不提倡针对有性能约束的工作负载或环境使用交换内存。
此外，建议使用 &lt;code&gt;LimitedSwap&lt;/code&gt;，因为这可以显著减轻给节点带来的风险。&lt;/p&gt;
&lt;!--
Cluster administrators and developers should benchmark their nodes and applications before using swap in production scenarios, and [we need your help](#how-do-i-get-involved) with that!
--&gt;
&lt;p&gt;集群管理员和开发人员应该在生产场景中使用交换内存之前对其节点和应用进行基准测试，
&lt;a href=&#34;#how-do-i-get-involved&#34;&gt;我们需要你的帮助&lt;/a&gt;！&lt;/p&gt;
&lt;!--
### Security risk
--&gt;
&lt;h3 id=&#34;security-risk&#34;&gt;安全风险&lt;/h3&gt;
&lt;!--
Enabling swap on a system without encryption poses a security risk, as critical information, such as volumes that represent Kubernetes Secrets, [may be swapped out to the disk](/docs/concepts/configuration/secret/#information-security-for-secrets). If an unauthorized individual gains access to the disk, they could potentially obtain these confidential data. To mitigate this risk, the Kubernetes project strongly recommends that you encrypt your swap space. However, handling encrypted swap is not within the scope of kubelet; rather, it is a general OS configuration concern and should be addressed at that level. It is the administrator&#39;s responsibility to provision encrypted swap to mitigate this risk.
--&gt;
&lt;p&gt;在没有加密的系统上启用交换内存会带来安全风险，因为关键信息（例如代表 Kubernetes Secret 的卷）
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/configuration/secret/#information-security-for-secrets&#34;&gt;可能会被交换到磁盘&lt;/a&gt;。
如果未经授权的个人访问磁盘，他们就有可能获得这些机密数据。为了减轻这种风险，
Kubernetes 项目强烈建议你对交换内存空间进行加密。但是，处理加密交换内存不是 kubelet 的责任；
相反，它其实是操作系统配置通用问题，应在该级别解决。管理员有责任提供加密交换内存来减轻这种风险。&lt;/p&gt;
&lt;!--
Furthermore, as previously mentioned, with `LimitedSwap` the user has the option to completely disable swap usage for a container by specifying memory requests that are equal to memory limits. This will prevent the corresponding containers from accessing swap memory.
--&gt;
&lt;p&gt;此外，如前所述，启用 &lt;code&gt;LimitedSwap&lt;/code&gt; 模式时，用户可以选择通过设置内存限制与内存请求相同来完全禁止容器使用交换内存。
这种设置会阻止相应的容器访问交换内存。&lt;/p&gt;
&lt;!--
## Looking ahead
--&gt;
&lt;h2 id=&#34;looking-ahead&#34;&gt;展望未来&lt;/h2&gt;
&lt;!--
The Kubernetes 1.28 release introduced Beta support for swap memory on Linux nodes, and we will continue to work towards [general availability](/docs/reference/command-line-tools-reference/feature-gates/#feature-stages) for this feature. I hope that this will include:
--&gt;
&lt;p&gt;Kubernetes 1.28 版本引入了对 Linux 节点上交换内存的 Beta 支持，
我们将继续为这项特性的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/#feature-stages&#34;&gt;正式发布&lt;/a&gt;而努力。
我希望这将包括：&lt;/p&gt;
&lt;!--
* Add the ability to set a system-reserved quantity of swap from what kubelet detects on the host.
* Adding support for controlling swap consumption at the Pod level via cgroups.
  * This point is still under discussion.
* Collecting feedback from test user cases.
  * We will consider introducing new configuration modes for swap, such as a node-wide swap limit for workloads.
--&gt;
&lt;ul&gt;
&lt;li&gt;添加根据 kubelet 在主机上检测到的内容来设置系统预留交换内存量的功能。&lt;/li&gt;
&lt;li&gt;添加对通过 cgroup 在 Pod 级别控制交换内存用量的支持。
&lt;ul&gt;
&lt;li&gt;这一点仍在讨论中。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;收集测试用例的反馈。
&lt;ul&gt;
&lt;li&gt;我们将考虑引入新的交换内存配置模式，例如在节点层面为工作负载设置交换内存限制。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How can I learn more?
--&gt;
&lt;h2 id=&#34;how-can-i-learn-more&#34;&gt;如果进一步学习？&lt;/h2&gt;
&lt;!--
You can review the current [documentation](/docs/concepts/architecture/nodes/#swap-memory) for using swap with Kubernetes.
--&gt;
&lt;p&gt;你可以查看当前&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/nodes/#swap-memory&#34;&gt;文档&lt;/a&gt;以了解如何在 Kubernetes 中使用交换内存。&lt;/p&gt;
&lt;!--
For more information, and to assist with testing and provide feedback, please see [KEP-2400](https://github.com/kubernetes/enhancements/issues/4128) and its [design proposal](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md).
--&gt;
&lt;p&gt;如需了解更多信息，以及协助测试和提供反馈，请参阅 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/4128&#34;&gt;KEP-2400&lt;/a&gt;
及其&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md&#34;&gt;设计提案&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## How do I get involved?
--&gt;
&lt;h2 id=&#34;how-do-i-get-involved&#34;&gt;参与其中&lt;/h2&gt;
&lt;!--
Your feedback is always welcome! SIG Node [meets regularly](https://github.com/kubernetes/community/tree/master/sig-node#meetings) and [can be reached](https://github.com/kubernetes/community/tree/master/sig-node#contact) via [Slack](https://slack.k8s.io/) (channel **#sig-node**), or the SIG&#39;s [mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-node). A Slack channel dedicated to swap is also available at **#sig-node-swap**.
--&gt;
&lt;p&gt;随时欢迎你的反馈！SIG Node &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node#meetings&#34;&gt;定期举行会议&lt;/a&gt;并可以通过
&lt;a href=&#34;https://slack.k8s.io/&#34;&gt;Slack&lt;/a&gt;（&lt;strong&gt;#sig-node&lt;/strong&gt; 频道）
或 SIG 的 &lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-node&#34;&gt;邮件列表&lt;/a&gt;
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-node#contact&#34;&gt;进行联系&lt;/a&gt;。
Slack 还提供了专门讨论交换内存的 &lt;strong&gt;#sig-node-swap&lt;/strong&gt; 频道。&lt;/p&gt;
&lt;!--
Feel free to reach out to me, Itamar Holder (**@iholder101** on Slack and GitHub) if you&#39;d like to help or ask further questions.
--&gt;
&lt;p&gt;如果你想提供帮助或提出进一步的问题，请随时联系 Itamar Holder（Slack 和 GitHub 账号为 &lt;strong&gt;@iholder101&lt;/strong&gt;）。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.28：节点 podresources API 正式发布</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/23/kubelet-podresources-api-ga/</link>
      <pubDate>Wed, 23 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/23/kubelet-podresources-api-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.28: Node podresources API Graduates to GA&#39;
date: 2023-08-23
slug: kubelet-podresources-api-GA
--&gt;
&lt;!--
**Author:**
Francesco Romani (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Francesco Romani (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
The podresources API is an API served by the kubelet locally on the node, which exposes the compute resources exclusively allocated to containers. With the release of Kubernetes 1.28, that API is now Generally Available.
--&gt;
&lt;p&gt;podresources API 是由 kubelet 提供的节点本地 API，它用于公开专门分配给容器的计算资源。
随着 Kubernetes 1.28 的发布，该 API 现已正式发布。&lt;/p&gt;
&lt;!--
## What problem does it solve?
--&gt;
&lt;h2 id=&#34;what-problem-does-it-solve&#34;&gt;它解决了什么问题？&lt;/h2&gt;
&lt;!--
The kubelet can allocate exclusive resources to containers, like [CPUs, granting exclusive access to full cores](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/) or [memory, either regions or hugepages](https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/). Workloads which require high performance, or low latency (or both) leverage these features. The kubelet also can assign [devices to containers](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/). Collectively, these features which enable exclusive assignments are known as &#34;resource managers&#34;.
--&gt;
&lt;p&gt;kubelet 可以向容器分配独占资源，例如
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/cpu-management-policies/&#34;&gt;CPU，授予对完整核心的独占访问权限&lt;/a&gt;或&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/memory-manager/&#34;&gt;内存，包括内存区域或巨页&lt;/a&gt;。
需要高性能或低延迟（或者两者都需要）的工作负载可以利用这些特性。
kubelet 还可以将&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/&#34;&gt;设备分配给容器&lt;/a&gt;。
总的来说，这些支持独占分配的特性被称为“资源管理器（Resource Managers）”。&lt;/p&gt;
&lt;!--
Without an API like podresources, the only possible option to learn about resource assignment was to read the state files the resource managers use. While done out of necessity, the problem with this approach is the path and the format of these file are both internal implementation details. Albeit very stable, the project reserves the right to change them freely. Consuming the content of the state files is thus fragile and unsupported, and projects doing this are recommended to consider moving to podresources API or to other supported APIs.
--&gt;
&lt;p&gt;如果没有像 podresources 这样的 API，了解资源分配的唯一可能选择就是读取资源管理器使用的状态文件。
虽然这样做是出于必要，但这种方法的问题是这些文件的路径和格式都是内部实现细节。
尽管非常稳定，但项目保留自由更改它们的权利。因此，使用状态文件内容的做法是不可靠的且不受支持的，
建议这样做的项目考虑迁移到使用 podresources API 或其他受支持的 API。&lt;/p&gt;
&lt;!--
## Overview of the API
--&gt;
&lt;h2 id=&#34;overview-of-the-api&#34;&gt;API 概述&lt;/h2&gt;
&lt;!--
The podresources API was [initially proposed to enable device monitoring](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources). In order to enable monitoring agents, a key prerequisite is to enable introspection of device assignment, which is performed by the kubelet. Serving this purpose was the initial goal of the API. The first iteration of the API only had a single function implemented, `List`, to return information about the assignment of devices to containers. The API is used by [multus CNI](https://github.com/k8snetworkplumbingwg/multus-cni) and by [GPU monitoring tools](https://github.com/NVIDIA/dcgm-exporter).
--&gt;
&lt;p&gt;podresources API &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources&#34;&gt;最初被提出是为了实现设备监控&lt;/a&gt;。
为了支持监控代理，一个关键的先决条件是启用由 kubelet 执行的设备分配自省（Introspection）。
API 的最初目标就是服务于此目的。API 的第一次迭代仅实现了一个函数 &lt;code&gt;List&lt;/code&gt;，用于返回有关设备分配给容器的信息。
该 API 由 &lt;a href=&#34;https://github.com/k8snetworkplumbingwg/multus-cni&#34;&gt;multus CNI&lt;/a&gt;
和 &lt;a href=&#34;https://github.com/NVIDIA/dcgm-exporter&#34;&gt;GPU 监控工具&lt;/a&gt;使用。&lt;/p&gt;
&lt;!--
Since its inception, the podresources API increased its scope to cover other resource managers than device manager. Starting from Kubernetes 1.20, the `List` API reports also CPU cores and memory regions (including hugepages); the API also reports the NUMA locality of the devices, while the locality of CPUs and memory can be inferred from the system.
--&gt;
&lt;p&gt;自推出以来，podresources API 扩大了其范围，涵盖了设备管理器之外的其他资源管理器。
从 Kubernetes 1.20 开始，&lt;code&gt;List&lt;/code&gt; API 还报告 CPU 核心和内存区域（包括巨页）；
在能够从系统中推断 CPU 和内存的位置时，API 还报告设备的 NUMA 位置。&lt;/p&gt;
&lt;!--
In Kubernetes 1.21, the API [gained](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2403-pod-resources-allocatable-resources/README.md) the `GetAllocatableResources` function. This newer API complements the existing `List` API and enables monitoring agents to determine the unallocated resources, thus enabling new features built on top of the podresources API like a [NUMA-aware scheduler plugin](https://github.com/kubernetes-sigs/scheduler-plugins/blob/master/pkg/noderesourcetopology/README.md).
--&gt;
&lt;p&gt;在 Kubernetes 1.21 中，API &lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2403-pod-resources-allocatable-resources/README.md&#34;&gt;增加了&lt;/a&gt;
&lt;code&gt;GetAllocatableResources&lt;/code&gt; 函数。这个较新的 API 补充了现有的 &lt;code&gt;List&lt;/code&gt; API，
并使监控代理能够辨识尚未分配的资源，从而支持在 podresources API 之上构建新的特性，
例如 &lt;a href=&#34;https://github.com/kubernetes-sigs/scheduler-plugins/blob/master/pkg/noderesourcetopology/README.md&#34;&gt;NUMA 感知的调度器插件&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Finally, in Kubernetes 1.27, another function, `Get` was introduced to be more friendly with CNI meta-plugins, to make it simpler to access resources allocated to a specific pod, rather than having to filter through resources for all pods on the node. The `Get` function is currently alpha level.
--&gt;
&lt;p&gt;最后，在 Kubernetes 1.27 中，引入了另一个函数 &lt;code&gt;Get&lt;/code&gt;，以便对 CNI 元插件（Meta-Plugins）更加友好，
简化对已分配给特定 Pod 的资源的访问，而不必过滤节点上所有 Pod 的资源。&lt;code&gt;Get&lt;/code&gt; 函数目前处于 Alpha 级别。&lt;/p&gt;
&lt;!--
## Consuming the API
--&gt;
&lt;h2 id=&#34;consuming-the-api&#34;&gt;使用 API&lt;/h2&gt;
&lt;!--
The podresources API is served by the kubelet locally, on the same node on which is running. On unix flavors, the endpoint is served over a unix domain socket; the default path is `/var/lib/kubelet/pod-resources/kubelet.sock`. On windows, the endpoint is served over a named pipe; the default path is `npipe://\\.\pipe\kubelet-pod-resources`.
--&gt;
&lt;p&gt;podresources API 由本地 kubelet 提供，位于 kubelet 运行所在的同一节点上。
在 Unix 风格的系统上，通过 Unix 域套接字提供端点；默认路径是 &lt;code&gt;/var/lib/kubelet/pod-resources/kubelet.sock&lt;/code&gt;。
在 Windows 上，通过命名管道提供端点；默认路径是 &lt;code&gt;npipe://\\.\pipe\kubelet-pod-resources&lt;/code&gt;。&lt;/p&gt;
&lt;!--
In order for the containerized monitoring application consume the API, the socket should be mounted inside the container. A good practice is to mount the directory on which the podresources socket endpoint sits rather than the socket directly. This will ensure that after a kubelet restart, the containerized monitor application will be able to re-connect to the socket.
--&gt;
&lt;p&gt;为了让容器化监控应用使用 API，套接字应挂载到容器内。
一个好的做法是挂载 podresources 套接字端点所在的目录，而不是直接挂载套接字。
这种做法将确保 kubelet 重新启动后，容器化监视器应用能够重新连接到套接字。&lt;/p&gt;
&lt;!--
An example manifest for a hypothetical monitoring agent consuming the podresources API and deployed as a DaemonSet could look like:
--&gt;
&lt;p&gt;在下面的 DaemonSet 示例清单中，包含一个假想的使用 podresources API 的监控代理：&lt;/p&gt;
&lt;!--
```yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: podresources-monitoring-app
  namespace: monitoring
spec:
  selector:
    matchLabels:
      name: podresources-monitoring
  template:
    metadata:
      labels:
        name: podresources-monitoring
    spec:
      containers:
      - args:
        - --podresources-socket=unix:///host-podresources/kubelet.sock
        command:
        - /bin/podresources-monitor
        image: podresources-monitor:latest  # just for an example
        volumeMounts:
        - mountPath: /host-podresources
          name: host-podresources
      serviceAccountName: podresources-monitor
      volumes:
      - hostPath:
          path: /var/lib/kubelet/pod-resources
          type: Directory
        name: host-podresources
```
--&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;DaemonSet&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;podresources-monitoring-app&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;namespace&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;monitoring&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;podresources-monitoring&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;podresources-monitoring&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;args&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- --podresources-socket=unix:///host-podresources/kubelet.sock&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- /bin/podresources-monitor&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;podresources-monitor:latest &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;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;mountPath&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;/host-podresources&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;host-podresources&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;serviceAccountName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;podresources-monitor&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;/var/lib/kubelet/pod-resources&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;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;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;host-podresources&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
I hope you find it straightforward to consume the podresources API  programmatically. The kubelet API package provides the protocol file and the go type definitions; however, a client package is not yet available from the project, and the existing code should not be used directly. The [recommended](https://github.com/kubernetes/kubernetes/blob/v1.28.0-rc.0/pkg/kubelet/apis/podresources/client.go#L32) approach is to reimplement the client in your projects, copying and pasting the related functions like for example the multus project is [doing](https://github.com/k8snetworkplumbingwg/multus-cni/blob/v4.0.2/pkg/kubeletclient/kubeletclient.go).
--&gt;
&lt;p&gt;我希望你发现以编程方式使用 podresources API 很简单。kubelet API包提供了协议文件和 Go 类型定义；
但是，该项目尚未提供客户端包，并且你也不应直接使用现有代码。
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/v1.28.0-rc.0/pkg/kubelet/apis/podresources/client.go#L32&#34;&gt;推荐&lt;/a&gt;方法是在你自己的项目中重新实现客户端，
复制并粘贴相关功能，就像 multus 项目&lt;a href=&#34;https://github.com/k8snetworkplumbingwg/multus-cni/blob/v4.0.2/pkg/kubeletclient/kubeletclient.go&#34;&gt;所做的那样&lt;/a&gt;。&lt;/p&gt;
&lt;!--
When operating the containerized monitoring application consuming the podresources API, few points are worth highlighting to prevent &#34;gotcha&#34; moments:
--&gt;
&lt;p&gt;在操作使用 podresources API 的容器化监控应用程序时，有几点值得强调，以防止出现“陷阱”：&lt;/p&gt;
&lt;!--
- Even though the API only exposes data, and doesn&#39;t allow by design clients to mutate the kubelet state, the gRPC request/response model requires read-write access to the podresources API socket. In other words, it is not possible to limit the container mount to `ReadOnly`.
- Multiple clients are allowed to connect to the podresources socket and consume the API, since it is stateless.
- The kubelet has [built-in rate limits](https://github.com/kubernetes/kubernetes/pull/116459) to mitigate local Denial of Service attacks from misbehaving or malicious consumers. The consumers of the API must tolerate rate limit errors returned by the server. The rate limit is currently hardcoded and global, so misbehaving clients can consume all the quota and potentially starve correctly behaving clients.
--&gt;
&lt;ul&gt;
&lt;li&gt;尽管 API 仅公开数据，并且设计上不允许客户端改变 kubelet 状态，
但 gRPC 请求/响应模型要求能对 podresources API 套接字进行读写访问。
换句话说，将容器挂载限制为 &lt;code&gt;ReadOnly&lt;/code&gt; 是不可能的。&lt;/li&gt;
&lt;li&gt;让多个客户端连接到 podresources 套接字并使用此 API 是允许的，因为 API 是无状态的。&lt;/li&gt;
&lt;li&gt;kubelet 具有&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/116459&#34;&gt;内置限速机制&lt;/a&gt;，
用以缓解来自行为不当或恶意用户的本地拒绝服务攻击。API 的使用者必须容忍服务器返回的速率限制错误。
速率限制目前是硬编码的且作用于全局的，因此行为不当的客户端可能会耗光所有配额，进而导致行为正确的客户端挨饿。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Future enhancements
--&gt;
&lt;h2 id=&#34;future-enhancements&#34;&gt;未来的增强&lt;/h2&gt;
&lt;!--
For historical reasons, the podresources API has a less precise specification than typical kubernetes APIs (such as the Kubernetes HTTP API, or the container runtime interface). This leads to unspecified behavior in corner cases. An [effort](https://issues.k8s.io/119423) is ongoing to rectify this state and to have a more precise specification.
--&gt;
&lt;p&gt;由于历史原因，podresources API 的规范不如典型的 kubernetes API（例如 Kubernetes HTTP API 或容器运行时接口）精确。
这会导致在极端情况下出现未指定的行为。我们正在&lt;a href=&#34;https://issues.k8s.io/119423&#34;&gt;努力&lt;/a&gt;纠正这种状态并制定更精确的规范。&lt;/p&gt;
&lt;!--
The [Dynamic Resource Allocation (DRA)](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/3063-dynamic-resource-allocation) infrastructure is a major overhaul of the resource management. The [integration](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/3695-pod-resources-for-dra) with the podresources API is already ongoing.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/3063-dynamic-resource-allocation&#34;&gt;动态资源分配（DRA）&lt;/a&gt;基础设施是对资源管理的重大改革。
与 podresources API 的&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/3695-pod-resources-for-dra&#34;&gt;集成&lt;/a&gt;已经在进行中。&lt;/p&gt;
&lt;!--
An [effort](https://issues.k8s.io/119817) is ongoing to recommend or create a reference client package ready to be consumed.
--&gt;
&lt;p&gt;我们正在&lt;a href=&#34;https://issues.k8s.io/119817&#34;&gt;努力&lt;/a&gt;推荐或创建可供使用的参考客户端包。&lt;/p&gt;
&lt;!--
## Getting involved
--&gt;
&lt;h2 id=&#34;getting-involved&#34;&gt;参与其中&lt;/h2&gt;
&lt;!--
This feature is driven by [SIG Node](https://github.com/Kubernetes/community/blob/master/sig-node/README.md). 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;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 1.28：Job 失效处理的改进</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/21/kubernetes-1-28-jobapi-update/</link>
      <pubDate>Mon, 21 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/21/kubernetes-1-28-jobapi-update/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.28: Improved failure handling for Jobs&#34;
date: 2023-08-21
slug: kubernetes-1-28-jobapi-update
--&gt;
&lt;!--
**Authors:** Kevin Hannon (G-Research), Michał Woźniak (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Kevin Hannon (G-Research), Michał Woźniak (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
This blog discusses two new features in Kubernetes 1.28 to improve Jobs for batch
users: [Pod replacement policy](/docs/concepts/workloads/controllers/job/#pod-replacement-policy)
and [Backoff limit per index](/docs/concepts/workloads/controllers/job/#backoff-limit-per-index).
--&gt;
&lt;p&gt;本博客讨论 Kubernetes 1.28 中的两个新特性，用于为批处理用户改进 Job：
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-replacement-policy&#34;&gt;Pod 更换策略&lt;/a&gt;
和&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#backoff-limit-per-index&#34;&gt;基于索引的回退限制&lt;/a&gt;。&lt;/p&gt;
&lt;!--
These features continue the effort started by the
[Pod failure policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy)
to improve the handling of Pod failures in a Job.
--&gt;
&lt;p&gt;这些特性延续了 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失效策略&lt;/a&gt;
为开端的工作，用来改进对 Job 中 Pod 失效的处理。&lt;/p&gt;
&lt;!--
## Pod replacement policy {#pod-replacement-policy}

By default, when a pod enters a terminating state (e.g. due to preemption or
eviction), Kubernetes immediately creates a replacement Pod. Therefore, both Pods are running
at the same time. In API terms, a pod is considered terminating when it has a
`deletionTimestamp` and it has a phase `Pending` or `Running`.
--&gt;
&lt;h2 id=&#34;pod-replacement-policy&#34;&gt;Pod 更换策略 &lt;/h2&gt;
&lt;p&gt;默认情况下，当 Pod 进入终止（Terminating）状态（例如由于抢占或驱逐机制）时，Kubernetes
会立即创建一个替换的 Pod，因此这时会有两个 Pod 同时运行。就 API 而言，当 Pod 具有
&lt;code&gt;deletionTimestamp&lt;/code&gt; 字段并且处于 &lt;code&gt;Pending&lt;/code&gt; 或 &lt;code&gt;Running&lt;/code&gt; 阶段时会被视为终止。&lt;/p&gt;
&lt;!--
The scenario when two Pods are running at a given time is problematic for
some popular machine learning frameworks, such as
TensorFlow and [JAX](https://jax.readthedocs.io/en/latest/), which require at most one Pod running at the same time,
for a given index. 
Tensorflow gives the following error if two pods are running for a given index.
--&gt;
&lt;p&gt;对于一些流行的机器学习框架来说，在给定时间运行两个 Pod 的情况是有问题的，
例如 TensorFlow 和 &lt;a href=&#34;https://jax.readthedocs.io/en/latest/&#34;&gt;JAX&lt;/a&gt;，
对于给定的索引，它们最多同时运行一个 Pod。如果两个 Pod 使用同一个索引来运行，
Tensorflow 会抛出以下错误：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; /job:worker/task:4: Duplicate task registration with task_name=/job:worker/replica:0/task:4
&lt;/code&gt;&lt;/pre&gt;&lt;!--
See more details in the ([issue](https://github.com/kubernetes/kubernetes/issues/115844)).

Creating the replacement Pod before the previous one fully terminates can also
cause problems in clusters with scarce resources or with tight budgets, such as:
* cluster resources can be difficult to obtain for Pods pending to be scheduled,
  as Kubernetes might take a long time to find available nodes until the existing
  Pods are fully terminated.
* if cluster autoscaler is enabled, the replacement Pods might produce undesired
  scale ups.
--&gt;
&lt;p&gt;可参考&lt;a href=&#34;https://github.com/kubernetes/kubernetes/issues/115844&#34;&gt;问题报告&lt;/a&gt;进一步了解细节。&lt;/p&gt;
&lt;p&gt;在前一个 Pod 完全终止之前创建替换的 Pod 也可能会导致资源或预算紧张的集群出现问题，例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;对于待调度的 Pod 来说，很难分配到集群资源，导致 Kubernetes 需要很长时间才能找到可用节点，
直到现有 Pod 完全终止。&lt;/li&gt;
&lt;li&gt;如果启用了集群自动扩缩器（Cluster Autoscaler），可能会产生不必要的集群规模扩增。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### How can you use it? {#pod-replacement-policy-how-to-use}

This is an alpha feature, which you can enable by turning on `JobPodReplacementPolicy`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) in
your cluster.

Once the feature is enabled in your cluster, you can use it by creating a new Job that specifies a
`podReplacementPolicy` field as shown here:
--&gt;
&lt;h3 id=&#34;pod-replacement-policy-how-to-use&#34;&gt;如何使用？ &lt;/h3&gt;
&lt;p&gt;这是一项 Alpha 级别特性，你可以通过在集群中启用 &lt;code&gt;JobPodReplacementPolicy&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-57407--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;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;Job&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;new&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#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;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;podReplacementPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Failed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;...&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
In that Job, the Pods would only be replaced once they reached the `Failed` phase,
and not when they are terminating.

Additionally, you can inspect the `.status.terminating` field of a Job. The value
of the field is the number of Pods owned by the Job that are currently terminating.
--&gt;
&lt;p&gt;在此 Job 中，Pod 仅在达到 &lt;code&gt;Failed&lt;/code&gt; 阶段时才会被替换，而不是在它们处于终止过程中（Terminating）时被替换。&lt;/p&gt;
&lt;p&gt;此外，你可以检查 Job 的 &lt;code&gt;.status.termination&lt;/code&gt; 字段。该字段的值表示终止过程中的
Job 所关联的 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 get jobs/myjob -o&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&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;{.items[*].status.terminating}&amp;#39;&lt;/span&gt;
&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;3 # three Pods are terminating and have not yet reached the Failed phase
&lt;/code&gt;&lt;/pre&gt;&lt;!--
This can be particularly useful for external queueing controllers, such as
[Kueue](https://github.com/kubernetes-sigs/kueue), that tracks quota
from running Pods of a Job until the resources are reclaimed from
the currently terminating Job.

Note that the `podReplacementPolicy: Failed` is the default when using a custom
[Pod failure policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy).
--&gt;
&lt;p&gt;这一特性对于外部排队控制器（例如 &lt;a href=&#34;https://github.com/kubernetes-sigs/kueue&#34;&gt;Kueue&lt;/a&gt;）特别有用，
它跟踪作业的运行 Pod 的配额，直到从当前终止过程中的 Job 资源被回收为止。&lt;/p&gt;
&lt;p&gt;请注意，使用自定义 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失败策略&lt;/a&gt;时，
&lt;code&gt;podReplacementPolicy: Failed&lt;/code&gt; 是默认值。&lt;/p&gt;
&lt;!--
## Backoff limit per index {#backoff-limit-per-index}

By default, Pod failures for [Indexed Jobs](/docs/concepts/workloads/controllers/job/#completion-mode)
are counted towards the global limit of retries, represented by `.spec.backoffLimit`.
This means, that if there is a consistently failing index, it is restarted
repeatedly until it exhausts the limit. Once the limit is reached the entire
Job is marked failed and some indexes may never be even started.
--&gt;
&lt;h2 id=&#34;backoff-limit-per-index&#34;&gt;逐索引的回退限制 &lt;/h2&gt;
&lt;p&gt;默认情况下，&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#completion-mode&#34;&gt;带索引的 Job（Indexed Job）&lt;/a&gt;的
Pod 失败情况会被统计下来，受 &lt;code&gt;.spec.backoffLimit&lt;/code&gt; 字段所设置的全局重试次数限制。
这意味着，如果存在某个索引值的 Pod 一直持续失败，则会 Pod 会被重新启动，直到重试次数达到限制值。
一旦达到限制值，整个 Job 将被标记为失败，并且对应某些索引的 Pod 甚至可能从不曾被启动。&lt;/p&gt;
&lt;!--
This is problematic for use cases where you want to handle Pod failures for
every index independently. For example, if you use Indexed Jobs for running
integration tests where each index corresponds to a testing suite. In that case,
you may want to account for possible flake tests allowing for 1 or 2 retries per
suite. There might be some buggy suites, making the corresponding
indexes fail consistently. In that case you may prefer to limit retries for
the buggy suites, yet allowing other suites to complete.
--&gt;
&lt;p&gt;对于你想要独立处理不同索引值的 Pod 的失败的场景而言，这是有问题的。
例如，如果你使用带索引的 Job（Indexed Job）来运行集成测试，其中每个索引值对应一个测试套件。
在这种情况下，你可能需要考虑可能发生的脆弱测试（Flake Test），允许每个套件重试 1 次或 2 次。
可能存在一些有缺陷的套件，导致对应索引的 Pod 始终失败。在这种情况下，
你或许更希望限制有问题的套件的重试，而允许其他套件完成。&lt;/p&gt;
&lt;!--
The feature allows you to:
* complete execution of all indexes, despite some indexes failing.
* better utilize the computational resources by avoiding unnecessary retries of consistently failing indexes.
--&gt;
&lt;p&gt;此特性允许你：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;尽管某些索引值的 Pod 失败，但仍完成执行所有索引值的 Pod。&lt;/li&gt;
&lt;li&gt;通过避免对持续失败的、特定索引值的 Pod 进行不必要的重试，更好地利用计算资源。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### How can you use it? {#backoff-limit-per-index-how-to-use}

This is an alpha feature, which you can enable by turning on the
`JobBackoffLimitPerIndex`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
in your cluster.

Once the feature is enabled in your cluster, you can create an Indexed Job with the
`.spec.backoffLimitPerIndex` field specified.
--&gt;
&lt;h3 id=&#34;backoff-limit-per-index-how-to-use&#34;&gt;可以如何使用它？ &lt;/h3&gt;
&lt;p&gt;这是一个 Alpha 特性，你可以通过启用集群的 &lt;code&gt;JobBackoffLimitPerIndex&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-57407--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;p&gt;在集群中启用该特性后，你可以在创建带索引的 Job（Indexed Job）时指定 &lt;code&gt;.spec.backoffLimitPerIndex&lt;/code&gt; 字段。&lt;/p&gt;
&lt;!--
#### Example

The following example demonstrates how to use this feature to make sure the
Job executes all indexes (provided there is no other reason for the early Job
termination, such as reaching the `activeDeadlineSeconds` timeout, or being
manually deleted by the user), and the number of failures is controlled per index.
--&gt;
&lt;h4 id=&#34;示例&#34;&gt;示例&lt;/h4&gt;
&lt;p&gt;下面的示例演示如何使用此功能来确保 Job 执行所有索引值的 Pod（前提是没有其他原因导致 Job 提前终止，
例如达到 &lt;code&gt;activeDeadlineSeconds&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;batch/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;Job&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;job-backoff-limit-per-index-execute-all&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;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;completions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;parallelism&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;completionMode&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Indexed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;backoffLimitPerIndex&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;template&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;spec&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;restartPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Never&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 当此示例容器作为任何 Job 中的第二个或第三个索引运行时（即使在重试之后），它会返回错误并失败&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;image&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;python&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;command&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- python3&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- -c&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- |&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;          import os, sys, time
&lt;/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;          id = int(os.environ.get(&amp;#34;JOB_COMPLETION_INDEX&amp;#34;))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b44;font-style:italic&#34;&gt;          if id == 1 or id == 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:#b44;font-style:italic&#34;&gt;            sys.exit(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;font-style:italic&#34;&gt;          time.sleep(1)&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Now, inspect the Pods after the job is finished:
--&gt;
&lt;p&gt;现在，在 Job 完成后检查 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-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get pods -l job-name&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;job-backoff-limit-per-index-execute-all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Returns output similar to this:
--&gt;
&lt;p&gt;返回的输出类似与：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NAME                                              READY   STATUS      RESTARTS   AGE
job-backoff-limit-per-index-execute-all-0-b26vc   0/1     Completed   0          49s
job-backoff-limit-per-index-execute-all-1-6j5gd   0/1     Error       0          49s
job-backoff-limit-per-index-execute-all-1-6wd82   0/1     Error       0          37s
job-backoff-limit-per-index-execute-all-2-c66hg   0/1     Error       0          32s
job-backoff-limit-per-index-execute-all-2-nf982   0/1     Error       0          43s
job-backoff-limit-per-index-execute-all-3-cxmhf   0/1     Completed   0          33s
job-backoff-limit-per-index-execute-all-4-9q6kq   0/1     Completed   0          28s
job-backoff-limit-per-index-execute-all-5-z9hqf   0/1     Completed   0          28s
job-backoff-limit-per-index-execute-all-6-tbkr8   0/1     Completed   0          23s
job-backoff-limit-per-index-execute-all-7-hxjsq   0/1     Completed   0          22s
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Additionally, you can take a look at the status for that Job:
--&gt;
&lt;p&gt;此外，你可以查看该 Job 的状态：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get &lt;span style=&#34;color:#a2f&#34;&gt;jobs&lt;/span&gt; job-backoff-limit-per-index-fail-index -o yaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The output ends with a `status` similar to:
--&gt;
&lt;p&gt;输出内容以 &lt;code&gt;status&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:#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;completedIndexes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;,&lt;span style=&#34;color:#666&#34;&gt;3-7&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;failedIndexes&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;,&lt;span style=&#34;color:#666&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;succeeded&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;6&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;failed&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;conditions&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;Job has failed indexes&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;reason&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;FailedIndexes&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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 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;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Failed&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Here, indexes `1`  and `2` were both retried once. After the second failure,
in each of them, the specified `.spec.backoffLimitPerIndex` was exceeded, so
the retries were stopped. For comparison, if the per-index backoff was disabled,
then the buggy indexes would retry until the global `backoffLimit` was exceeded,
and then the entire Job would be marked failed, before some of the higher
indexes are started.
--&gt;
&lt;p&gt;这里，索引为 &lt;code&gt;1&lt;/code&gt; 和 &lt;code&gt;2&lt;/code&gt; 的 Pod 都被重试了一次。这两个 Pod 在第二次失败后都超出了指定的
&lt;code&gt;.spec.backoffLimitPerIndex&lt;/code&gt;，因此停止重试。相比之下，如果禁用了基于索引的回退，
那么有问题的、特定索引的 Pod 将被重试，直到超出全局 &lt;code&gt;backoffLimit&lt;/code&gt;，之后在启动一些索引值较高的 Pod 之前，
整个 Job 将被标记为失败。&lt;/p&gt;
&lt;!--
## How can you learn more?

- Read the user-facing documentation for [Pod replacement policy](/docs/concepts/workloads/controllers/job/#pod-replacement-policy),
[Backoff limit per index](/docs/concepts/workloads/controllers/job/#backoff-limit-per-index), and
[Pod failure policy](/docs/concepts/workloads/controllers/job/#pod-failure-policy)
- Read the KEPs for [Pod Replacement Policy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3939-allow-replacement-when-fully-terminated),
[Backoff limit per index](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3850-backoff-limits-per-index-for-indexed-jobs), and
[Pod failure policy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3329-retriable-and-non-retriable-failures).
--&gt;
&lt;h2 id=&#34;how-can-you-learn-more&#34;&gt;如何进一步了解&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;阅读面向用户的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-replacement-policy&#34;&gt;Pod 替换策略&lt;/a&gt;文档、
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#backoff-limit-per-index&#34;&gt;逐索引的回退限制&lt;/a&gt;和
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/job/#pod-failure-policy&#34;&gt;Pod 失效策略&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;阅读 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3939-allow-replacement-when-fully-terminated&#34;&gt;Pod 替换策略&lt;/a&gt;)、
&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3850-backoff-limits-per-index-for-indexed-jobs&#34;&gt;逐索引的回退限制&lt;/a&gt;和
&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;的 KEP。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Getting Involved

These features were sponsored by [SIG Apps](https://github.com/kubernetes/community/tree/master/sig-apps).  Batch use cases are actively
being improved for Kubernetes users in the
[batch working group](https://github.com/kubernetes/community/tree/master/wg-batch).
Working groups are relatively short-lived initiatives focused on specific goals.
The goal of the WG Batch is to improve experience for batch workload users, offer support for
batch processing use cases, and enhance the
Job API for common use cases.  If that interests you, please join the working
group either by subscriping to our
[mailing list](https://groups.google.com/a/kubernetes.io/g/wg-batch) or on
[Slack](https://kubernetes.slack.com/messages/wg-batch).
--&gt;
&lt;h2 id=&#34;getting-Involved&#34;&gt;参与其中&lt;/h2&gt;
&lt;p&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/wg-batch&#34;&gt;批处理工作组&lt;/a&gt;中的
Kubernetes 用户积极改进批处理场景。
工作组是相对短暂的举措，专注于特定目标。WG Batch 的目标是改善批处理工作负载的用户体验、
提供对批处理场景的支持并增强常见场景下的 Job API。
如果你对此感兴趣，请通过订阅我们的&lt;a href=&#34;https://groups.google.com/a/kubernetes.io/g/wg-batch&#34;&gt;邮件列表&lt;/a&gt;或通过
&lt;a href=&#34;https://kubernetes.slack.com/messages/wg-batch&#34;&gt;Slack&lt;/a&gt; 加入进来。&lt;/p&gt;
&lt;!--
## Acknowledgments

As with any Kubernetes feature, multiple people contributed to getting this
done, from testing and filing bugs to reviewing code.

We would not have been able to achieve either of these features without Aldo
Culquicondor (Google) providing excellent domain knowledge and expertise
throughout the Kubernetes ecosystem.
--&gt;
&lt;h2 id=&#34;acknowledgments&#34;&gt;致谢&lt;/h2&gt;
&lt;p&gt;与其他 Kubernetes 特性一样，从测试、报告缺陷到代码审查，很多人为此特性做出了贡献。&lt;/p&gt;
&lt;p&gt;如果没有 Aldo Culquicondor（Google）提供出色的领域知识和跨整个 Kubernetes 生态系统的知识，
我们可能无法实现这些特性。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes v1.28：可追溯的默认 StorageClass 进阶至 GA</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/18/retroactive-default-storage-class-ga/</link>
      <pubDate>Fri, 18 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/18/retroactive-default-storage-class-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes v1.28: Retroactive Default StorageClass move to GA&#34;
date: 2023-08-18
slug: retroactive-default-storage-class-ga
--&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; &lt;a href=&#34;https://github.com/windsonsea&#34;&gt;Michael Yao&lt;/a&gt; (DaoCloud)&lt;/p&gt;
&lt;!--
Announcing graduation to General Availability (GA) - Retroactive Default StorageClass Assignment
in Kubernetes v1.28!
--&gt;
&lt;p&gt;可追溯的默认 StorageClass 赋值（Retroactive Default StorageClass Assignment）在
Kubernetes v1.28 中宣布进阶至正式发布（GA）！&lt;/p&gt;
&lt;!--
Kubernetes SIG Storage team is thrilled to announce that the
&#34;Retroactive Default StorageClass Assignment&#34; feature,
introduced as an alpha in Kubernetes v1.25, has now graduated to GA
and is officially part of the Kubernetes v1.28 release.
This enhancement brings a significant improvement to how default
[StorageClasses](/docs/concepts/storage/storage-classes/) are assigned
to PersistentVolumeClaims (PVCs).
--&gt;
&lt;p&gt;Kubernetes SIG Storage 团队非常高兴地宣布，在 Kubernetes v1.25 中作为
Alpha 特性引入的 “可追溯默认 StorageClass 赋值” 现已进阶至 GA，
并正式成为 Kubernetes v1.28 发行版的一部分。
这项增强特性极大地改进了默认的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/storage-classes/&#34;&gt;StorageClasses&lt;/a&gt;
为 PersistentVolumeClaim (PVC) 赋值的方式。&lt;/p&gt;
&lt;!--
With this feature enabled, you no longer need to create a default StorageClass
first and then a PVC to assign the class. Instead, any PVCs without a StorageClass
assigned will now be retroactively updated to include the default StorageClass.
This enhancement ensures that PVCs no longer get stuck in an unbound state,
and storage provisioning works seamlessly,
even when a default StorageClass is not defined at the time of PVC creation.
--&gt;
&lt;p&gt;启用此特性后，你不再需要先创建默认的 StorageClass，再创建 PVC 来指定存储类。
现在，未分配 StorageClass 的所有 PVC 都将被自动更新为包含默认的 StorageClass。
此项增强特性确保即使默认的 StorageClass 在 PVC 创建时未被定义，
PVC 也不会再滞留在未绑定状态，存储制备工作可以无缝进行。&lt;/p&gt;
&lt;!--
## What changed?

The PersistentVolume (PV) controller has been modified to automatically assign
a default StorageClass to any unbound PersistentVolumeClaim with the `storageClassName` not set.
Additionally, the PersistentVolumeClaim admission validation mechanism within
the API server has been adjusted to allow changing values from an unset state
to an actual StorageClass name.
--&gt;
&lt;h2 id=&#34;what-changed&#34;&gt;有什么变化？  &lt;/h2&gt;
&lt;p&gt;PersistentVolume (PV) 控制器已修改为：当未设置 &lt;code&gt;storageClassName&lt;/code&gt; 时，自动向任何未绑定的
PersistentVolumeClaim 分配一个默认的 StorageClass。此外，API 服务器中的 PersistentVolumeClaim
准入验证机制也已调整为允许将值从未设置状态更改为实际的 StorageClass 名称。&lt;/p&gt;
&lt;!--
## How to use it?

As this feature has graduated to GA, there&#39;s no need to enable a feature gate anymore.
Simply make sure you are running Kubernetes v1.28 or later, and the feature will be
available for use.
--&gt;
&lt;h2 id=&#34;how-to-use-it&#34;&gt;如何使用？ &lt;/h2&gt;
&lt;p&gt;由于此特性已进阶至 GA，所以不再需要启用特性门控。
只需确保你运行的是 Kubernetes v1.28 或更高版本，此特性即可供使用。&lt;/p&gt;
&lt;!--
For more details, read about
[default StorageClass assignment](/docs/concepts/storage/persistent-volumes/#retroactive-default-storageclass-assignment)
in the Kubernetes documentation. You can also read the previous
[blog post](/blog/2023/01/05/retroactive-default-storage-class/)
announcing beta graduation in v1.26.
--&gt;
&lt;p&gt;有关更多细节，可以查阅 Kubernetes
文档中的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#retroactive-default-storageclass-assignment&#34;&gt;默认 StorageClass 赋值&lt;/a&gt;。
你也可以阅读以前在 v1.26 中宣布进阶至 Beta
的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/01/05/retroactive-default-storage-class/&#34;&gt;博客文章&lt;/a&gt;。&lt;/p&gt;
&lt;!--
To provide feedback, join our [Kubernetes Storage Special-Interest-Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG)
or participate in discussions on our [public Slack channel](https://app.slack.com/client/T09NY5SBT/C09QZFCE5).
--&gt;
&lt;p&gt;要提供反馈，请加入我们的
&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes 存储特别兴趣小组&lt;/a&gt; (SIG)
或参与&lt;a href=&#34;https://app.slack.com/client/T09NY5SBT/C09QZFCE5&#34;&gt;公共 Slack 频道&lt;/a&gt;上的讨论。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.28: 节点非体面关闭进入 GA 阶段（正式发布）</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/16/kubernetes-1-28-non-graceful-node-shutdown-ga/</link>
      <pubDate>Wed, 16 Aug 2023 10:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/16/kubernetes-1-28-non-graceful-node-shutdown-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.28: Non-Graceful Node Shutdown Moves to GA&#34;
date: 2023-08-16T10:00:00-08:00
slug: kubernetes-1-28-non-graceful-node-shutdown-GA
--&gt;
&lt;!--
**Authors:** Xing Yang (VMware) and Ashutosh Kumar (Elastic)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Xing Yang (VMware) 和 Ashutosh Kumar (Elastic)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
The Kubernetes Non-Graceful Node Shutdown feature is now GA in Kubernetes v1.28.
It was introduced as
[alpha](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2268-non-graceful-shutdown)
in Kubernetes v1.24, and promoted to
[beta](https://kubernetes.io/blog/2022/12/16/kubernetes-1-26-non-graceful-node-shutdown-beta/)
in Kubernetes v1.26.
This feature allows stateful workloads to restart on a different node if the
original node is shutdown unexpectedly or ends up in a non-recoverable state
such as the hardware failure or unresponsive OS.
--&gt;
&lt;p&gt;Kubernetes 节点非体面关闭特性现已在 Kubernetes v1.28 中正式发布。&lt;/p&gt;
&lt;p&gt;此特性在 Kubernetes v1.24 中作为 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2268-non-graceful-shutdown&#34;&gt;Alpha&lt;/a&gt;
特性引入，并在 Kubernetes v1.26 中转入 &lt;a href=&#34;https://kubernetes.io/blog/2022/12/16/kubernetes-1-26-non-graceful-node-shutdown-beta/&#34;&gt;Beta&lt;/a&gt;
阶段。如果原始节点意外关闭或最终处于不可恢复状态（例如硬件故障或操作系统无响应），
此特性允许有状态工作负载在不同节点上重新启动。&lt;/p&gt;
&lt;!--
## What is a Non-Graceful Node Shutdown

In a Kubernetes cluster, a node can be shutdown in a planned graceful way or
unexpectedly because of reasons such as power outage or something else external.
A node shutdown could lead to workload failure if the node is not drained
before the shutdown. A node shutdown can be either graceful or non-graceful.
--&gt;
&lt;h2 id=&#34;什么是节点非体面关闭&#34;&gt;什么是节点非体面关闭&lt;/h2&gt;
&lt;p&gt;在 Kubernetes 集群中，节点可能会按计划正常关闭，也可能由于断电或其他外部原因而意外关闭。
如果节点在关闭之前未腾空，则节点关闭可能会导致工作负载失败。节点关闭可以是正常关闭，也可以是非正常关闭。&lt;/p&gt;
&lt;!--
The [Graceful Node Shutdown](https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta/)
feature allows Kubelet to detect a node shutdown event, properly terminate the pods,
and release resources, before the actual shutdown.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta/&#34;&gt;节点体面关闭&lt;/a&gt;特性允许
kubelet 在实际关闭之前检测节点关闭事件、正确终止该节点上的 Pod 并释放资源。&lt;/p&gt;
&lt;!--
When a node is shutdown but not detected by Kubelet&#39;s Node Shutdown Manager,
this becomes a non-graceful node shutdown.
Non-graceful node shutdown is usually not a problem for stateless apps, however,
it is a problem for stateful apps.
The stateful application cannot function properly if the pods are stuck on the
shutdown node and are not restarting on a running node.
--&gt;
&lt;p&gt;当节点关闭但 kubelet 的节点关闭管理器未检测到时，将造成节点非体面关闭。
对于无状态应用程序来说，节点非体面关闭通常不是问题，但是对于有状态应用程序来说，这是一个问题。
如果 Pod 停留在关闭节点上并且未在正在运行的节点上重新启动，则有状态应用程序将无法正常运行。&lt;/p&gt;
&lt;!--
In the case of a non-graceful node shutdown, you can manually add an `out-of-service` taint on the Node.
--&gt;
&lt;p&gt;在节点非体面关闭的情况下，你可以在 Node 上手动添加 &lt;code&gt;out-of-service&lt;/code&gt; 污点。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl taint nodes &amp;lt;node-name&amp;gt; node.kubernetes.io/out-of-service=nodeshutdown:NoExecute
&lt;/code&gt;&lt;/pre&gt;&lt;!--
This taint triggers pods on the node to be forcefully deleted if there are no
matching tolerations on the pods. Persistent volumes attached to the shutdown node
will be detached, and new pods will be created successfully on a different running
node.
--&gt;
&lt;p&gt;如果 Pod 上没有与之匹配的容忍规则，则此污点会触发节点上的 Pod 被强制删除。
挂接到关闭中的节点的持久卷将被解除挂接，新的 Pod 将在不同的运行节点上成功创建。&lt;/p&gt;
&lt;!--
**Note:** Before applying the out-of-service taint, you must verify that a node is
already in shutdown or power-off state (not in the middle of restarting).

Once all the workload pods that are linked to the out-of-service node are moved to
a new running node, and the shutdown node has been recovered, you should remove that
taint on the affected node after the node is recovered.
--&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; 在应用 out-of-service 污点之前，你必须验证节点是否已经处于关闭或断电状态（而不是在重新启动中）。&lt;/p&gt;
&lt;p&gt;与 out-of-service 节点有关联的所有工作负载的 Pod 都被移动到新的运行节点，
并且所关闭的节点已恢复之后，你应该删除受影响节点上的污点。&lt;/p&gt;
&lt;!--
## What’s new in stable

With the promotion of the Non-Graceful Node Shutdown feature to stable, the
feature gate  `NodeOutOfServiceVolumeDetach` is locked to true on
`kube-controller-manager` and cannot be disabled.
--&gt;
&lt;h2 id=&#34;稳定版中有哪些新内容&#34;&gt;稳定版中有哪些新内容&lt;/h2&gt;
&lt;p&gt;随着非正常节点关闭功能提升到稳定状态，特性门控
&lt;code&gt;NodeOutOfServiceVolumeDetach&lt;/code&gt; 在 &lt;code&gt;kube-controller-manager&lt;/code&gt; 上被锁定为 true，并且无法禁用。&lt;/p&gt;
&lt;!--
Metrics `force_delete_pods_total` and `force_delete_pod_errors_total` in the
Pod GC Controller are enhanced to account for all forceful pods deletion.
A reason is added to the metric to indicate whether the pod is forcefully deleted
because it is terminated, orphaned, terminating with the `out-of-service` taint,
or terminating and unscheduled.
--&gt;
&lt;p&gt;Pod GC 控制器中的指标 &lt;code&gt;force_delete_pods_total&lt;/code&gt; 和 &lt;code&gt;force_delete_pod_errors_total&lt;/code&gt;
得到增强，以考虑所有 Pod 的强制删除情况。
指标中会添加一个 &amp;quot;reason&amp;quot;，以指示 Pod 是否因终止、孤儿、因 &lt;code&gt;out-of-service&lt;/code&gt;
污点而终止或因未计划终止而被强制删除。&lt;/p&gt;
&lt;!--
A &#34;reason&#34; is also added to the metric `attachdetach_controller_forced_detaches`
in the Attach Detach Controller to indicate whether the force detach is caused by
the `out-of-service` taint or a timeout.
--&gt;
&lt;p&gt;Attach Detach Controller 中的指标 &lt;code&gt;attachdetach_controller_forced_detaches&lt;/code&gt;
中还会添加一个 &amp;quot;reason&amp;quot;，以指示强制解除挂接是由 &lt;code&gt;out-of-service&lt;/code&gt; 污点还是超时引起的。&lt;/p&gt;
&lt;!--
## What’s next?

This feature requires a user to manually add a taint to the node to trigger
workloads failover and remove the taint after the node is recovered.
In the future, we plan to find ways to automatically detect and fence nodes
that are shutdown/failed and automatically failover workloads to another node.
--&gt;
&lt;h2 id=&#34;接下来&#34;&gt;接下来&lt;/h2&gt;
&lt;p&gt;此特性要求用户手动向节点添加污点以触发工作负载故障转移，并在节点恢复后删除污点。
未来，我们计划找到方法来自动检测和隔离关闭/失败的节点，并自动将工作负载故障转移到另一个节点。&lt;/p&gt;
&lt;!--
## How can I learn more?

Check out additional documentation on this feature
[here](https://kubernetes.io/docs/concepts/architecture/nodes/#non-graceful-node-shutdown).
--&gt;
&lt;h2 id=&#34;如何了解更多&#34;&gt;如何了解更多？&lt;/h2&gt;
&lt;p&gt;在&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/nodes/#non-graceful-node-shutdown&#34;&gt;此处&lt;/a&gt;可以查看有关此特性的其他文档。&lt;/p&gt;
&lt;!--
## How to get involved?

We offer a huge thank you to all the contributors who helped with design,
implementation, and review of this feature and helped move it from alpha, beta, to stable:
--&gt;
&lt;p&gt;我们非常感谢所有帮助设计、实现和审查此功能并帮助其从 Alpha、Beta 到稳定版的贡献者：&lt;/p&gt;
&lt;ul&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;Derek Carr (&lt;a href=&#34;https://github.com/derekwaynecarr&#34;&gt;derekwaynecarr&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Danielle Endocrimes (&lt;a href=&#34;https://github.com/endocrimes&#34;&gt;endocrimes&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;Tim Hockin  (&lt;a href=&#34;https://github.com/thockin&#34;&gt;thockin&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ashutosh Kumar (&lt;a href=&#34;https://github.com/sonasingh46&#34;&gt;sonasingh46&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Hemant Kumar (&lt;a href=&#34;https://github.com/gnufied&#34;&gt;gnufied&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Yuiko Mouri (&lt;a href=&#34;https://github.com/YuikoTakada&#34;&gt;YuikoTakada&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Mrunal Patel (&lt;a href=&#34;https://github.com/mrunalp&#34;&gt;mrunalp&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;David Porter (&lt;a href=&#34;https://github.com/bobbypage&#34;&gt;bobbypage&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Yassine Tijani (&lt;a href=&#34;https://github.com/yastij&#34;&gt;yastij&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Jing Xu (&lt;a href=&#34;https://github.com/jingxu97&#34;&gt;jingxu97&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;
&lt;!--
This feature is a collaboration between SIG Storage and SIG Node.
For those interested in getting involved with the design and development of any
part of the Kubernetes Storage system, join the Kubernetes Storage Special
Interest Group (SIG).
For those interested in getting involved with the design and development of the
components that support the controlled interactions between pods and host
resources, join the Kubernetes Node SIG.
--&gt;
&lt;p&gt;此特性是 SIG Storage 和 SIG Node 之间的协作。对于那些有兴趣参与 Kubernetes
存储系统任何部分的设计和开发的人，请加入 Kubernetes 存储特别兴趣小组（SIG）。
对于那些有兴趣参与支持 Pod 和主机资源之间受控交互的组件的设计和开发，请加入 Kubernetes Node SIG。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>pkgs.k8s.io：介绍 Kubernetes 社区自有的包仓库</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/15/pkgs-k8s-io-introduction/</link>
      <pubDate>Tue, 15 Aug 2023 20:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/15/pkgs-k8s-io-introduction/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;pkgs.k8s.io: Introducing Kubernetes Community-Owned Package Repositories&#34;
date: 2023-08-15T20:00:00+0000
slug: pkgs-k8s-io-introduction
--&gt;
&lt;!--
**Author**: Marko Mudrinić (Kubermatic)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Marko Mudrinić (Kubermatic)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
On behalf of Kubernetes SIG Release, I am very excited to introduce the Kubernetes community-owned software repositories for Debian and RPM packages: `pkgs.k8s.io`! The new package repositories are replacement for the Google-hosted package repositories (`apt.kubernetes.io` and `yum.kubernetes.io`) that we&#39;ve been using since Kubernetes v1.5.
--&gt;
&lt;p&gt;我很高兴代表 Kubernetes SIG Release 介绍 Kubernetes
社区自有的 Debian 和 RPM 软件仓库：&lt;code&gt;pkgs.k8s.io&lt;/code&gt;！
这些全新的仓库取代了我们自 Kubernetes v1.5 以来一直使用的托管在
Google 的仓库（&lt;code&gt;apt.kubernetes.io&lt;/code&gt; 和 &lt;code&gt;yum.kubernetes.io&lt;/code&gt;）。&lt;/p&gt;
&lt;!--
This blog post contains information about these new package repositories, what does it mean to you as an end user, and how to migrate to the new repositories.
--&gt;
&lt;p&gt;这篇博文包含关于这些新的包仓库的信息、它对最终用户意味着什么以及如何迁移到新仓库。&lt;/p&gt;
&lt;!--
**ℹ️  Update (August 31, 2023):** the _**legacy Google-hosted repositories are deprecated and will be frozen starting with September 13, 2023.**_ Check out [the deprecation announcement](/blog/2023/08/31/legacy-package-repository-deprecation/) for more details about this change.
--&gt;
&lt;p&gt;&lt;strong&gt;ℹ️ 更新（2023 年 8 月 31 日）：旧版托管在 Google 的仓库已被弃用，并将于 2023 年 9 月 13 日开始被冻结。&lt;/strong&gt;
查看&lt;a href=&#34;https://deploy-preview-57407--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;!--
## What you need to know about the new package repositories?
--&gt;
&lt;h2 id=&#34;what-you-need-to-know-about-the-new-package-repositories&#34;&gt;关于新的包仓库，你需要了解哪些信息？&lt;/h2&gt;
&lt;!--
_(updated on August 31, 2023)_
--&gt;
&lt;p&gt;&lt;strong&gt;（更新于 2023 年 8 月 31 日）&lt;/strong&gt;&lt;/p&gt;
&lt;!--
- This is an **opt-in change**; you&#39;re required to manually migrate from the Google-hosted repository to the Kubernetes community-owned repositories. See [how to migrate](#how-to-migrate) later in this announcement for migration information and instructions.
--&gt;
&lt;ul&gt;
&lt;li&gt;这是一个&lt;strong&gt;明确同意的更改&lt;/strong&gt;；你需要手动从托管在 Google 的仓库迁移到
Kubernetes 社区自有的仓库。请参阅本公告后面的&lt;a href=&#34;#how-to-migrate&#34;&gt;如何迁移&lt;/a&gt;，
了解迁移信息和说明。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- The legacy Google-hosted repositories are **deprecated as of August 31, 2023**, and will be **frozen approximately as of September 13, 2023**. The freeze will happen immediately following the patch releases that are scheduled for September 2023. Freezing the legacy repositories means that we will publish packages for the Kubernetes project only to the community-owned repositories as of the September 13, 2023 cut-off point. Check out the [deprecation announcement](/blog/2023/08/31/legacy-package-repository-deprecation/) for more details about this change.
--&gt;
&lt;ul&gt;
&lt;li&gt;旧版托管在 Google 的仓库&lt;strong&gt;自 2023 年 8 月 31 日起被弃用&lt;/strong&gt;，
并将&lt;strong&gt;于 2023 年 9 月 13 日左右被冻结&lt;/strong&gt;。
冻结将在计划于 2023 年 9 月发布补丁之后立即发生。
冻结旧仓库意味着我们在 2023 年 9 月 13 日这个时间点之后仅将 Kubernetes
项目的包发布到社区自有的仓库。有关此更改的更多详细信息，
请查看&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/08/31/legacy-package-repository-deprecation/&#34;&gt;弃用公告&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- The existing packages in the legacy repositories will be available for the foreseeable future. However, the Kubernetes project can&#39;t provide any guarantees on how long is that going to be. The deprecated legacy repositories, and their contents, might be removed at any time in the future and without a further notice period.
--&gt;
&lt;ul&gt;
&lt;li&gt;旧仓库中的现有包将在可预见的未来一段时间内可用。
然而，Kubernetes 项目无法保证这会持续多久。
已弃用的旧仓库及其内容可能会在未来随时被删除，恕不另行通知。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Given that no new releases will be published to the legacy repositories after the September 13, 2023 cut-off point, you will not be able to upgrade to any patch or minor release made from that date onwards if you don&#39;t migrate to the new Kubernetes package repositories. That said, we recommend migrating to the new Kubernetes package repositories **as soon as possible**.
--&gt;
&lt;ul&gt;
&lt;li&gt;鉴于在 2023 年 9 月 13 日这个截止时间点之后不会向旧仓库发布任何新版本，
如果你不在该截止时间点迁移至新的 Kubernetes 仓库，
你将无法升级到该日期之后发布的任何补丁或次要版本。
也就是说，我们建议&lt;strong&gt;尽快&lt;/strong&gt;迁移到新的 Kubernetes 仓库。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- The new Kubernetes package repositories contain packages beginning with those Kubernetes versions that were still under support when the community took over the package builds. This means that anything before v1.24.0 will only be available in the Google-hosted repository.
--&gt;
&lt;ul&gt;
&lt;li&gt;新的 Kubernetes 仓库中包含社区开始接管包构建以来仍在支持的 Kubernetes 版本的包。
这意味着 v1.24.0 之前的任何内容都只存在于托管在 Google 的仓库中。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- There&#39;s a dedicated package repository for each Kubernetes minor version. When upgrading to a different minor release, you must bear in mind that the package repository details also change.
--&gt;
&lt;ul&gt;
&lt;li&gt;每个 Kubernetes 次要版本都有一个专用的仓库。
当升级到不同的次要版本时，你必须记住，仓库详细信息也会发生变化。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Why are we introducing new package repositories?
--&gt;
&lt;h2 id=&#34;why-are-we-introducing-new-package-repositories&#34;&gt;为什么我们要引入新的包仓库？&lt;/h2&gt;
&lt;!--
As the Kubernetes project is growing, we want to ensure the best possible experience for the end users. The Google-hosted repository has been serving us well for many years, but we started facing some problems that require significant changes to how we publish packages. Another goal that we have is to use community-owned infrastructure for all critical components and that includes package repositories.
--&gt;
&lt;p&gt;随着 Kubernetes 项目的不断发展，我们希望确保最终用户获得最佳体验。
托管在 Google 的仓库多年来一直为我们提供良好的服务，
但我们开始面临一些问题，需要对发布包的方式进行重大变更。
我们的另一个目标是对所有关键组件使用社区拥有的基础设施，其中包括仓库。&lt;/p&gt;
&lt;!--
Publishing packages to the Google-hosted repository is a manual process that can be done only by a team of Google employees called [Google Build Admins](/releases/release-managers/#build-admins). [The Kubernetes Release Managers team](/releases/release-managers/#release-managers) is a very diverse team especially in terms of timezones that we work in. Given this constraint, we have to do very careful planning for every release to ensure that we have both Release Manager and Google Build Admin available to carry out the release.
--&gt;
&lt;p&gt;将包发布到托管在 Google 的仓库是一个手动过程，
只能由名为 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/releases/release-managers/#build-admins&#34;&gt;Google 构建管理员&lt;/a&gt;的 Google 员工团队来完成。
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/releases/release-managers/#release-managers&#34;&gt;Kubernetes 发布管理员团队&lt;/a&gt;是一个非常多元化的团队，
尤其是在我们工作的时区方面。考虑到这一限制，我们必须对每个版本进行非常仔细的规划，
确保我们有发布经理和 Google 构建管理员来执行发布。&lt;/p&gt;
&lt;!--
Another problem is that we only have a single package repository. Because of this, we were not able to publish packages for prerelease versions (alpha, beta, and rc). This made testing Kubernetes prereleases harder for anyone who is interested to do so. The feedback that we receive from people testing these releases is critical to ensure the best quality of releases, so we want to make testing these releases as easy as possible. On top of that, having only one repository limited us when it comes to publishing dependencies like `cri-tools` and `kubernetes-cni`.
--&gt;
&lt;p&gt;另一个问题是由于我们只有一个包仓库。因此，我们无法发布预发行版本
（Alpha、Beta 和 RC）的包。这使得任何有兴趣测试的人都更难测试 Kubernetes 预发布版本。
我们从测试这些版本的人员那里收到的反馈对于确保版本的最佳质量至关重要，
因此我们希望尽可能轻松地测试这些版本。最重要的是，只有一个仓库限制了我们对
&lt;code&gt;cri-tools&lt;/code&gt; 和 &lt;code&gt;kubernetes-cni&lt;/code&gt; 等依赖进行发布，&lt;/p&gt;
&lt;!--
Regardless of all these issues, we&#39;re very thankful to Google and Google Build Admins for their involvement, support, and help all these years!
--&gt;
&lt;p&gt;尽管存在这些问题，我们仍非常感谢 Google 和 Google 构建管理员这些年来的参与、支持和帮助！&lt;/p&gt;
&lt;!--
## How the new package repositories work?
--&gt;
&lt;h2 id=&#34;how-the-new-package-repositories-work&#34;&gt;新的包仓库如何工作？&lt;/h2&gt;
&lt;!--
The new package repositories are hosted at `pkgs.k8s.io` for both Debian and RPM packages. At this time, this domain points to a CloudFront CDN backed by S3 bucket that contains repositories and packages. However, we plan on onboarding additional mirrors in the future, giving possibility for other companies to help us with serving packages.
--&gt;
&lt;p&gt;新的 Debian 和 RPM 仓库托管在 &lt;code&gt;pkgs.k8s.io&lt;/code&gt;。
目前，该域指向一个 CloudFront CDN，其后是包含仓库和包的 S3 存储桶。
然而，我们计划在未来添加更多的镜像站点，让其他公司有可能帮助我们提供软件包服务。&lt;/p&gt;
&lt;!--
Packages are built and published via the [OpenBuildService (OBS) platform](http://openbuildservice.org). After a long period of evaluating different solutions, we made a decision to use OpenBuildService as a platform to manage our repositories and packages. First of all, OpenBuildService is an open source platform used by a large number of open source projects and companies, like openSUSE, VideoLAN, Dell, Intel, and more. OpenBuildService has many features making it very flexible and easy to integrate with our existing release tooling. It also allows us to build packages in a similar way as for the Google-hosted repository making the migration process as seamless as possible.
--&gt;
&lt;p&gt;包通过 &lt;a href=&#34;http://openbuildservice.org&#34;&gt;OpenBuildService（OBS）平台&lt;/a&gt;构建和发布。
经过长时间评估不同的解决方案后，我们决定使用 OpenBuildService 作为管理仓库和包的平台。
首先，OpenBuildService 是一个开源平台，被大量开源项目和公司使用，
如 openSUSE、VideoLAN、Dell、Intel 等。OpenBuildService 具有许多功能，
使其非常灵活且易于与我们现有的发布工具集成。
它还允许我们以与托管在 Google 的仓库类似的方式构建包，从而使迁移过程尽可能无缝。&lt;/p&gt;
&lt;!--
SUSE sponsors the Kubernetes project with access to their reference OpenBuildService setup ([`build.opensuse.org`](http://build.opensuse.org)) and with technical support to integrate OBS with our release processes.
--&gt;
&lt;p&gt;SUSE 赞助 Kubernetes 项目并且支持访问其引入的 OpenBuildService 环境
（&lt;a href=&#34;http://build.opensuse.org&#34;&gt;&lt;code&gt;build.opensuse.org&lt;/code&gt;&lt;/a&gt;），
还提供将 OBS 与我们的发布流程集成的技术支持。&lt;/p&gt;
&lt;!--
We use SUSE&#39;s OBS instance for building and publishing packages. Upon building a new release, our tooling automatically pushes needed artifacts and package specifications to `build.opensuse.org`. That will trigger the build process that&#39;s going to build packages for all supported architectures (AMD64, ARM64, PPC64LE, S390X). At the end, generated packages will be automatically pushed to our community-owned S3 bucket making them available to all users.
--&gt;
&lt;p&gt;我们使用 SUSE 的 OBS 实例来构建和发布包。构建新版本后，
我们的工具会自动将所需的制品和包设置推送到 &lt;code&gt;build.opensuse.org&lt;/code&gt;。
这将触发构建过程，为所有支持的架构（AMD64、ARM64、PPC64LE、S390X）构建包。
最后，生成的包将自动推送到我们社区拥有的 S3 存储桶，以便所有用户都可以使用它们。&lt;/p&gt;
&lt;!--
We want to take this opportunity to thank SUSE for allowing us to use `build.opensuse.org` and their generous support to make this integration possible!
--&gt;
&lt;p&gt;我们想借此机会感谢 SUSE 允许我们使用 &lt;code&gt;build.opensuse.org&lt;/code&gt;
以及他们的慷慨支持，使这种集成成为可能！&lt;/p&gt;
&lt;!--
## What are significant differences between the Google-hosted and Kubernetes package repositories?
--&gt;
&lt;h2 id=&#34;what-are-significant-differences-between-the-google-hosted-and-kubernetes-package-repositories&#34;&gt;托管在 Google 的仓库和 Kubernetes 仓库之间有哪些显著差异？&lt;/h2&gt;
&lt;!--
There are three significant differences that you should be aware of:
--&gt;
&lt;p&gt;你应该注意三个显著差异：&lt;/p&gt;
&lt;!--
- There&#39;s a dedicated package repository for each Kubernetes minor release. For example, repository called `core:/stable:/v1.28` only hosts packages for stable Kubernetes v1.28 releases. This means you can install v1.28.0 from this repository, but you can&#39;t install v1.27.0 or any other minor release other than v1.28. Upon upgrading to another minor version, you have to add a new repository and optionally remove the old one
--&gt;
&lt;ul&gt;
&lt;li&gt;每个 Kubernetes 次要版本都有一个专用的仓库。例如，
名为 &lt;code&gt;core:/stable:/v1.28&lt;/code&gt; 的仓库仅托管稳定 Kubernetes v1.28 版本的包。
这意味着你可以从此仓库安装 v1.28.0，但无法安装 v1.27.0 或 v1.28 之外的任何其他次要版本。
升级到另一个次要版本后，你必须添加新的仓库并可以选择删除旧的仓库&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- There&#39;s a difference in what `cri-tools` and `kubernetes-cni` package versions are available in each Kubernetes repository
  - These two packages are dependencies for `kubelet` and `kubeadm`
  - Kubernetes repositories for v1.24 to v1.27 have same versions of these packages as the Google-hosted repository
  - Kubernetes repositories for v1.28 and onwards are going to have published only versions that are used by that Kubernetes minor release
    - Speaking of v1.28, only kubernetes-cni 1.2.0 and cri-tools v1.28 are going to be available in the repository for Kubernetes v1.28
    - Similar for v1.29, we only plan on publishing cri-tools v1.29 and whatever kubernetes-cni version is going to be used by Kubernetes v1.29
--&gt;
&lt;ul&gt;
&lt;li&gt;每个 Kubernetes 仓库中可用的 &lt;code&gt;cri-tools&lt;/code&gt; 和 &lt;code&gt;kubernetes-cni&lt;/code&gt; 包版本有所不同
&lt;ul&gt;
&lt;li&gt;这两个包是 &lt;code&gt;kubelet&lt;/code&gt; 和 &lt;code&gt;kubeadm&lt;/code&gt; 的依赖项&lt;/li&gt;
&lt;li&gt;v1.24 到 v1.27 的 Kubernetes 仓库与托管在 Google 的仓库具有这些包的相同版本&lt;/li&gt;
&lt;li&gt;v1.28 及更高版本的 Kubernetes 仓库将仅发布该 Kubernetes 次要版本
&lt;ul&gt;
&lt;li&gt;就 v1.28 而言，Kubernetes v1.28 的仓库中仅提供 kubernetes-cni 1.2.0 和 cri-tools v1.28&lt;/li&gt;
&lt;li&gt;与 v1.29 类似，我们只计划发布 cri-tools v1.29 以及 Kubernetes v1.29 将使用的 kubernetes-cni 版本&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- The revision part of the package version (the `-00` part in `1.28.0-00`) is  now autogenerated by the OpenBuildService platform and has a different format. The revision is now in the format of `-x.y`, e.g. `1.28.0-1.1`
--&gt;
&lt;ul&gt;
&lt;li&gt;包版本的修订部分（&lt;code&gt;1.28.0-00&lt;/code&gt; 中的 &lt;code&gt;-00&lt;/code&gt; 部分）现在由 OpenBuildService
平台自动生成，并具有不同的格式。修订版本现在采用 &lt;code&gt;-x.y&lt;/code&gt; 格式，例如 &lt;code&gt;1.28.0-1.1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Does this in any way affect existing Google-hosted repositories?
--&gt;
&lt;h2 id=&#34;does-this-in-any-way-affect-existing-google-hosted-repositories&#34;&gt;这是否会影响现有的托管在 Google 的仓库？&lt;/h2&gt;
&lt;!--
The Google-hosted repository and all packages published to it will continue working in the same way as before. There are no changes in how we build and publish packages to the Google-hosted repository, all newly-introduced changes are only affecting packages publish to the community-owned repositories.
--&gt;
&lt;p&gt;托管在 Google 的仓库以及发布到其中的所有包仍然可用，与之前一样。
我们构建包并将其发布到托管在 Google 仓库的方式没有变化，
所有新引入的更改仅影响发布到社区自有仓库的包。&lt;/p&gt;
&lt;!--
However, as mentioned at the beginning of this blog post, we plan to stop publishing packages to the Google-hosted repository in the future.
--&gt;
&lt;p&gt;然而，正如本文开头提到的，我们计划将来停止将包发布到托管在 Google 的仓库。&lt;/p&gt;
&lt;!--
## How to migrate to the Kubernetes community-owned repositories? {#how-to-migrate}
--&gt;
&lt;h2 id=&#34;how-to-migrate&#34;&gt;如何迁移到 Kubernetes 社区自有的仓库？&lt;/h2&gt;
&lt;!--
### Debian, Ubuntu, and operating systems using `apt`/`apt-get` {#how-to-migrate-deb}
--&gt;
&lt;h3 id=&#34;how-to-migrate-deb&#34;&gt;使用 &lt;code&gt;apt&lt;/code&gt;/&lt;code&gt;apt-get&lt;/code&gt; 的 Debian、Ubuntu 一起其他操作系统&lt;/h3&gt;
&lt;!--
1. Replace the `apt` repository definition so that `apt` points to the new repository instead of the Google-hosted repository. Make sure to replace the Kubernetes minor version in the command below with the minor version that you&#39;re currently using:
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;替换 &lt;code&gt;apt&lt;/code&gt; 仓库定义，以便 &lt;code&gt;apt&lt;/code&gt; 指向新仓库而不是托管在 Google 的仓库。
确保将以下命令中的 Kubernetes 次要版本替换为你当前使用的次要版本：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&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; | sudo tee /etc/apt/sources.list.d/kubernetes.list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories, so you can disregard the version in the URL:
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;下载 Kubernetes 仓库的公共签名密钥。所有仓库都使用相同的签名密钥，
因此你可以忽略 URL 中的版本：&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;curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Update the `apt` package index:
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;更新 &lt;code&gt;apt&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;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### CentOS, Fedora, RHEL, and operating systems using `rpm`/`dnf` {#how-to-migrate-rpm}
--&gt;
&lt;h3 id=&#34;how-to-migrate-rpm&#34;&gt;使用 &lt;code&gt;rpm&lt;/code&gt;/&lt;code&gt;dnf&lt;/code&gt; 的 CentOS、Fedora、RHEL 以及其他操作系统&lt;/h3&gt;
&lt;!--
1. Replace the `yum` repository definition so that `yum` points to the new  repository instead of the Google-hosted repository. Make sure to replace the Kubernetes minor version in the command below with the minor version that you&#39;re currently using:
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;替换 &lt;code&gt;yum&lt;/code&gt; 仓库定义，使 &lt;code&gt;yum&lt;/code&gt; 指向新仓库而不是托管在 Google 的仓库。
确保将以下命令中的 Kubernetes 次要版本替换为你当前使用的次要版本：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#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 | sudo 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;exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
&lt;/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;/li&gt;
&lt;/ol&gt;
&lt;!--
## Can I rollback to the Google-hosted repository after migrating to the Kubernetes repositories?
--&gt;
&lt;h2 id=&#34;can-i-rollback-to-the-google-hosted-repository-after-migrating-to-the-kubernetes-repositories&#34;&gt;迁移到 Kubernetes 仓库后是否可以回滚到托管在 Google 的仓库？&lt;/h2&gt;
&lt;!--
In general, yes. Just do the same steps as when migrating, but use parameters for the Google-hosted repository. You can find those parameters in a document like [&#34;Installing kubeadm&#34;](/docs/setup/production-environment/tools/kubeadm/install-kubeadm).
--&gt;
&lt;p&gt;一般来说，可以。只需执行与迁移时相同的步骤，但使用托管在 Google 的仓库参数。
你可以在&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm&#34;&gt;“安装 kubeadm”&lt;/a&gt;等文档中找到这些参数。&lt;/p&gt;
&lt;!--
## Why isn’t there a stable list of domains/IPs? Why can’t I restrict package downloads?
--&gt;
&lt;h2 id=&#34;why-isn-t-there-a-stable-list-of-domains-ips-why-can-t-i-restrict-package-downloads&#34;&gt;为什么没有固定的域名/IP 列表？为什么我无法限制包下载？&lt;/h2&gt;
&lt;!--
Our plan for `pkgs.k8s.io` is to make it work as a redirector to a set of backends (package mirrors) based on user&#39;s location. The nature of this change means that a user downloading a package could be redirected to any mirror at any time. Given the architecture and our plans to onboard additional mirrors in the near future, we can&#39;t provide a list of IP addresses or domains that you can add to an allow list.
--&gt;
&lt;p&gt;我们对 &lt;code&gt;pkgs.k8s.io&lt;/code&gt; 的计划是使其根据用户位置充当一组后端（包镜像）的重定向器。
此更改的本质意味着下载包的用户可以随时重定向到任何镜像。
鉴于架构和我们计划在不久的将来加入更多镜像，我们无法提供给你可以添加到允许列表中的
IP 地址或域名列表。&lt;/p&gt;
&lt;!--
Restrictive control mechanisms like man-in-the-middle proxies or network policies that restrict access to a specific list of IPs/domains will break with this change. For these scenarios, we encourage you to mirror the release packages to a local package repository that you have strict control over.
--&gt;
&lt;p&gt;限制性控制机制（例如限制访问特定 IP/域名列表的中间人代理或网络策略）将随着此更改而中断。
对于这些场景，我们鼓励你将包的发布版本与你可以严格控制的本地仓库建立镜像。&lt;/p&gt;
&lt;!--
## What should I do if I detect some abnormality with the new repositories?
--&gt;
&lt;h2 id=&#34;what-should-i-do-if-i-detect-some-abnormality-with-the-new-repositories&#34;&gt;如果我发现新的仓库有异常怎么办？&lt;/h2&gt;
&lt;!--
If you encounter any issue with new Kubernetes package repositories, please file an issue in the [`kubernetes/release` repository](https://github.com/kubernetes/release/issues/new/choose).
--&gt;
&lt;p&gt;如果你在新的 Kubernetes 仓库中遇到任何问题，
请在 &lt;a href=&#34;https://github.com/kubernetes/release/issues/new/choose&#34;&gt;&lt;code&gt;kubernetes/release&lt;/code&gt; 仓库&lt;/a&gt;中提交问题。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>聚焦 SIG CLI</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/07/20/sig-cli-spotlight-2023/</link>
      <pubDate>Thu, 20 Jul 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/07/20/sig-cli-spotlight-2023/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Spotlight on SIG CLI&#34;
date: 2023-07-20
slug: sig-cli-spotlight-2023
canonicalUrl: https://www.kubernetes.dev/blog/2023/07/13/sig-cli-spotlight-2023/
--&gt;
&lt;!--
**Author**: Arpit Agrawal
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Arpit Agrawal&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Xin Li (Daocloud)&lt;/p&gt;
&lt;!--
In the world of Kubernetes, managing containerized applications at
scale requires powerful and efficient tools. The command-line
interface (CLI) is an integral part of any developer or operator’s
toolkit, offering a convenient and flexible way to interact with a
Kubernetes cluster.
--&gt;
&lt;p&gt;在 Kubernetes 的世界中，大规模管理容器化应用程序需要强大而高效的工具。
命令行界面（CLI）是任何开发人员或操作人员工具包不可或缺的一部分，
其提供了一种方便灵活的方式与 Kubernetes 集群交互。&lt;/p&gt;
&lt;!--
SIG CLI plays a crucial role in improving the [Kubernetes
CLI](https://github.com/kubernetes/community/tree/master/sig-cli)
experience by focusing on the development and enhancement of
`kubectl`, the primary command-line tool for Kubernetes.
--&gt;
&lt;p&gt;SIG CLI 通过专注于 Kubernetes 主要命令行工具 &lt;code&gt;kubectl&lt;/code&gt; 的开发和增强，
在改善 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cli&#34;&gt;Kubernetes CLI&lt;/a&gt;
体验方面发挥着至关重要的作用。&lt;/p&gt;
&lt;!--
In this SIG CLI Spotlight, Arpit Agrawal, SIG ContribEx-Comms team
member, talked with [Katrina Verey](https://github.com/KnVerey), Tech
Lead &amp; Chair of SIG CLI,and [Maciej
Szulik](https://github.com/soltysh), SIG CLI Batch Lead, about SIG
CLI, current projects, challenges and how anyone can get involved.
--&gt;
&lt;p&gt;在本次 SIG CLI 聚焦中，SIG ContribEx-Comms 团队成员 Arpit Agrawal 与
SIG CLI 技术主管兼主席 &lt;a href=&#34;https://github.com/KnVerey&#34;&gt;Katrina Verey&lt;/a&gt;
和 SIG CLI Batch 主管 &lt;a href=&#34;https://github.com/soltysh&#34;&gt;Maciej Szulik&lt;/a&gt;
讨论了 SIG CLI 当前项目状态和挑战以及如何参与其中。&lt;/p&gt;
&lt;!--
So, whether you are a seasoned Kubernetes enthusiast or just getting
started, understanding the significance of SIG CLI will undoubtedly
enhance your Kubernetes journey.
--&gt;
&lt;p&gt;因此，无论你是经验丰富的 Kubernetes 爱好者还是刚刚入门，了解
SIG CLI 的重要性无疑将增强你的 Kubernetes 之旅。&lt;/p&gt;
&lt;!--
## Introductions

**Arpit**: Could you tell us a bit about yourself, your role, and how
you got involved in SIG CLI?
--&gt;
&lt;h2 id=&#34;简介&#34;&gt;简介&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：你们能否向我们介绍一下你自己、你的角色以及你是如何参与 SIG CLI 的？&lt;/p&gt;
&lt;!--
**Maciej**: I’m one of the technical leads for SIG-CLI. I was working
on Kubernetes in multiple areas since 2014, and in 2018 I got
appointed a lead.
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：我是 SIG-CLI 的技术负责人之一。自 2014 年以来，我一直在多个领域从事
Kubernetes 工作，并于 2018 年被任命为负责人。&lt;/p&gt;
&lt;!--
**Katrina**: I’ve been working with Kubernetes as an end-user since
2016, but it was only in late 2019 that I discovered how well SIG CLI
aligned with my experience from internal projects. I started regularly
attending meetings and made a few small PRs, and by 2021 I was working
more deeply with the
[Kustomize](https://github.com/kubernetes-sigs/kustomize) team
specifically. Later that year, I was appointed to my current roles as
subproject owner for Kustomize and KRM Functions, and as SIG CLI Tech
Lead and Chair.
--&gt;
&lt;p&gt;&lt;strong&gt;Katrina&lt;/strong&gt;：自 2016 年以来，我一直作为最终用户使用 Kubernetes，但直到 2019 年底，
我才发现 SIG CLI 与我在内部项目中的经验非常吻合。我开始定期参加会议并提交了一些小型 PR，
到 2021 年，我专门与 &lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize&#34;&gt;Kustomize&lt;/a&gt;
团队进行了更深入的合作。同年晚些时候，我被任命担任目前的职务，担任 Kustomize 和
KRM Functions 的子项目 owner 以及 SIG CLI 技术主管和负责人。&lt;/p&gt;
&lt;!--
## About SIG CLI

**Arpit**: Thank you! Could you share with us the purpose and goals of SIG CLI?
--&gt;
&lt;h2 id=&#34;关于-sig-cli&#34;&gt;关于 SIG CLI&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：谢谢！你们能否与我们分享一下 SIG CLI 的宗旨和目标？&lt;/p&gt;
&lt;!--
**Maciej**: Our
[charter](https://github.com/kubernetes/community/tree/master/sig-cli/)
has the most detailed description, but in few words, we handle all CLI
tooling that helps you manage your Kubernetes manifests and interact
with your Kubernetes clusters.
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：我们的&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cli/&#34;&gt;章程&lt;/a&gt;有最详细的描述，
但简而言之，我们处理所有 CLI 工具，帮助你管理 Kubernetes 资源清单以及与 Kubernetes 集群进行交互。&lt;/p&gt;
&lt;!--
**Arpit**: I see. And how does SIG CLI work to promote best-practices
for CLI development and usage in the cloud native ecosystem?
--&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：我明白了。请问 SIG CLI 如何致力于推广云原生生态系统中 CLI 开发和使用的最佳实践？&lt;/p&gt;
&lt;!--
**Maciej**: Within `kubectl`, we have several on-going efforts that
try to encourage new contributors to align existing commands to new
standards. We publish several libraries which hopefully make it easier
to write CLIs that interact with Kubernetes APIs, such as cli-runtime
and
[kyaml](https://github.com/kubernetes-sigs/kustomize/tree/master/kyaml).
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：在 &lt;code&gt;kubectl&lt;/code&gt; 中，我们正在进行多项努力，试图鼓励新的贡献者将现有命令与新标准保持一致。
我们发布了几个库，希望能够更轻松地编写与 Kubernetes API 交互的 CLI，例如 cli-runtime 和
&lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize/tree/master/kyaml&#34;&gt;kyaml&lt;/a&gt;。&lt;/p&gt;
&lt;!--
**Katrina**: We also maintain some interoperability specifications for
CLI tooling, such as the [KRM Functions
Specification](https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md)
(GA) and the new ApplySet
Specification
(alpha).
--&gt;
&lt;p&gt;&lt;strong&gt;Katrina&lt;/strong&gt;：我们还维护一些 CLI 工具的互操作性规范，例如
&lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md&#34;&gt;KRM 函数规范&lt;/a&gt;（GA）
和新的 ApplySet 规范（Alpha）。&lt;/p&gt;
&lt;!--
## Current projects and challenges

**Arpit**: Going through the README file, it’s clear SIG CLI has a
number of subprojects, could you highlight some important ones?
--&gt;
&lt;h2 id=&#34;当前的项目和挑战&#34;&gt;当前的项目和挑战&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：阅读了一遍 README 文件，发现 SIG CLI 有许多子项目，你能突出讲一些重要的子项目吗？&lt;/p&gt;
&lt;!--
**Maciej**: The four most active subprojects that are, in my opinion,
worthy of your time investment would be:

* [`kubectl`](https://github.com/kubernetes/kubectl):  the canonical Kubernetes CLI.
* [Kustomize](https://github.com/kubernetes-sigs/kustomize): a
  template-free customization tool for Kubernetes yaml manifest files.
* [KUI](https://kui.tools) - a GUI interface to Kubernetes, think
   `kubectl` on steroids.
* [`krew`](https://github.com/kubernetes-sigs/krew): a plugin manager for `kubectl`.
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：在我看来，值得你投入时间的四个最活跃的子项目是：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/kubectl&#34;&gt;&lt;code&gt;kubectl&lt;/code&gt;&lt;/a&gt;：规范的 Kubernetes CLI。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize&#34;&gt;Kustomize&lt;/a&gt;：Kubernetes yaml 清单文件的无模板定制工具。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kui.tools&#34;&gt;KUI&lt;/a&gt; - 一个针对 Kubernetes 的 GUI 界面，可以将其视为增强版的 &lt;code&gt;kubectl&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/krew&#34;&gt;&lt;code&gt;krew&lt;/code&gt;&lt;/a&gt;：&lt;code&gt;kubectl&lt;/code&gt; 的插件管理器。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
**Arpit**: Are there any upcoming initiatives or developments that SIG
CLI is working on?

**Maciej**: There are always several initiatives we’re working on at
any given point in time. It’s best to join [one of our
calls](https://github.com/kubernetes/community/tree/master/sig-cli/#meetings)
to learn about the current ones.
--&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：SIG CLI 是否有任何正在开展或即将开展的计划或开发工作？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：在任何给定的时间点，我们总是在开展多项举措。
最好加入&lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-cli/#meetings&#34;&gt;我们的一个电话会议&lt;/a&gt;来了解当前的情况。&lt;/p&gt;
&lt;!--
**Katrina**: For major features, you can check out [our open
KEPs](https://www.kubernetes.dev/resources/keps/). For instance, in
1.27 we introduced alphas for [a new pruning mode in kubectl
apply](https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning/),
and for kubectl create plugins. Exciting ideas that are currently
under discussion include an interactive mode for `kubectl` delete
([KEP
3895](https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning))
and the `kuberc` user preferences file ([KEP
3104](https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning)).
--&gt;
&lt;p&gt;对于主要功能，你可以查看&lt;a href=&#34;https://www.kubernetes.dev/resources/keps/&#34;&gt;我们的开放 KEP&lt;/a&gt;。
例如，在 1.27 中，我们为 &lt;a href=&#34;https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning/&#34;&gt;kubectl apply 中的新裁剪模式&lt;/a&gt;
引入了新的 Alpha 特性，并为 kubectl 添加了插件。
目前正在讨论的令人兴奋的想法包括 &lt;code&gt;kubectl&lt;/code&gt; 删除的交互模式（&lt;a href=&#34;https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning&#34;&gt;KEP 3895&lt;/a&gt;）和
&lt;code&gt;kuberc&lt;/code&gt; 用户首选项文件（&lt;a href=&#34;https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning&#34;&gt;KEP 3104&lt;/a&gt;）。&lt;/p&gt;
&lt;!--
**Arpit**: Could you discuss any challenges that SIG CLI faces in its
efforts to improve CLIs for cloud-native technologies? What are the
future efforts to solve them?
--&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：你们能否说说 SIG CLI 在改善云本地技术的 CLI 时面临的任何挑战？未来将采取哪些措施来解决这些问题？&lt;/p&gt;
&lt;!--
**Katrina**: The biggest challenge we’re facing with every decision is
backwards compatibility and ensuring we don’t break existing users. It
frequently happens that fixing what&#39;s on the surface may seem
straightforward, but even fixing a bug could constitute a breaking
change for some users, which means we need to go through an extended
deprecation process to change it, or in some cases we can’t change it
at all. Another challenge is the need to balance customization with
usability in the flag sets we expose on our tools. For example, we get
many proposals for new flags that would certainly be useful to some
users, but not a large enough subset to justify the increased
complexity having them in the tool entails for everyone. The `kuberc`
proposal may help with some of these problems by giving individual
users the ability to set or override default values we can’t change,
and even create custom subcommands via aliases
--&gt;
&lt;p&gt;&lt;strong&gt;Katrina&lt;/strong&gt;：我们每个决定面临的最大挑战是向后兼容性并确保我们不会影响现有用户。
经常发生的情况是，修复表面上的内容似乎很简单，但即使修复 bug 也可能对某些用户造成破坏性更改，
这意味着我们需要经历一个较长的弃用过程来更改它，或者在某些情况下我们不能完全改变它。
另一个挑战是我们需要在工具上公开 flag 的平衡定制和可用性。例如，我们收到了许多关于新标志的建议，
这些建议肯定对某些用户有用，但没有足够大的子集来证明，将它们添加到工具中对每个用户来说都会增加复杂性。
&lt;code&gt;kuberc&lt;/code&gt; 提案可能会帮助个人用户设置或覆盖我们无法更改的默认值，甚至通过别名创建自定义子命令，
从而帮助解决其中一些问题。&lt;/p&gt;
&lt;!--
**Arpit**: With every new version release of Kubernetes, maintaining
consistency and integrity is surely challenging: how does the SIG CLI
team tackle it?
--&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：随着 Kubernetes 的每个新版本的发布，保持一致性和完整性无疑是一项挑战：
SIG CLI 团队如何解决这个问题？&lt;/p&gt;
&lt;!--
**Maciej**: This is mostly similar to the topic mentioned in the
previous question: every new change, especially to existing commands
goes through a lot of scrutiny to ensure we don’t break existing
users. At any point in time we have to keep a reasonable balance
between features and not breaking users.
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：这与上一个问题中提到的主题非常相似：每一个新的更改，尤其是对现有命令的更改，
都会经过大量的审查，以确保我们不会影响现有用户。在任何时候我们都必须在功能和不影响用户之间保持合理的平衡。&lt;/p&gt;
&lt;!--
## Future plans and contribution

**Arpit**: How do you see the role of CLI tools in the cloud-native
ecosystem evolving in the future?
--&gt;
&lt;h2 id=&#34;未来计划及贡献&#34;&gt;未来计划及贡献&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：你们如何看待 CLI 工具在未来云原生生态系统中的作用？&lt;/p&gt;
&lt;!--
**Maciej**: I think that CLI tools were and will always be an
important piece of the ecosystem. Whether used by administrators on
remote machines that don’t have GUI or in every CI/CD pipeline, they
are irreplaceable.
--&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：我认为 CLI 工具曾经并将永远是生态系统的重要组成部分。
无论是管理员在没有 GUI 的远程计算机上还是在每个 CI/CD 管道中使用，它们都是不可替代的。&lt;/p&gt;
&lt;!--
**Arpit**: Kubernetes is a community-driven project. Any
recommendation for anyone looking into getting involved in SIG CLI
work? Where should they start? Are there any prerequisites?

**Maciej**: There are no prerequisites other than a little bit of free
time on your hands and willingness to learn something new :-)
--&gt;
&lt;p&gt;&lt;strong&gt;Arpit&lt;/strong&gt;：Kubernetes 是一个社区驱动的项目。对于想要参与 SIG CLI 工作的人有什么建议吗？
他们应该从哪里开始？有什么先决条件吗？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Maciej&lt;/strong&gt;：除了有一点空闲时间和学习新东西的意愿之外，没有任何先决条件 :-)&lt;/p&gt;
&lt;!--
**Katrina**: A working knowledge of [Go](https://go.dev/) often helps,
but we also have areas in need of non-code contributions, such as the
[Kustomize docs consolidation
project](https://github.com/kubernetes-sigs/kustomize/issues/4338).
--&gt;
&lt;p&gt;&lt;strong&gt;Katrina&lt;/strong&gt;：&lt;a href=&#34;https://go.dev/&#34;&gt;Go&lt;/a&gt; 的实用知识通常会有所帮助，但我们也有需要非代码贡献的领域，
例如 &lt;a href=&#34;https://github.com/kubernetes-sigs/kustomize/issues/4338&#34;&gt;Kustomize 文档整合项目&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 机密：使用机密虚拟机和安全区来增强你的集群安全性</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/07/06/confidential-kubernetes/</link>
      <pubDate>Thu, 06 Jul 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/07/06/confidential-kubernetes/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Confidential Kubernetes: Use Confidential Virtual Machines and Enclaves to improve your cluster security&#34;
date: 2023-07-06
slug: &#34;confidential-kubernetes&#34;
--&gt;
&lt;!--
**Authors:** Fabian Kammel (Edgeless Systems), Mikko Ylinen (Intel), Tobin Feldman-Fitzthum (IBM)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Fabian Kammel (Edgeless Systems), Mikko Ylinen (Intel), Tobin Feldman-Fitzthum (IBM)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/asa3311&#34;&gt;顾欣&lt;/a&gt;&lt;/p&gt;
&lt;!--
In this blog post, we will introduce the concept of Confidential Computing (CC) to improve any computing environment&#39;s security and privacy properties. Further, we will show how
the Cloud-Native ecosystem, particularly Kubernetes, can benefit from the new compute paradigm.

Confidential Computing is a concept that has been introduced previously in the cloud-native world. The
[Confidential Computing Consortium](https://confidentialcomputing.io/) (CCC) is a project community in the Linux Foundation
that already worked on
[Defining and Enabling Confidential Computing](https://confidentialcomputing.io/wp-content/uploads/sites/85/2019/12/CCC_Overview.pdf).
In the [Whitepaper](https://confidentialcomputing.io/wp-content/uploads/sites/85/2023/01/CCC-A-Technical-Analysis-of-Confidential-Computing-v1.3_Updated_November_2022.pdf),
they provide a great motivation for the use of Confidential Computing:

   &gt; Data exists in three states: in transit, at rest, and in use. …Protecting sensitive data
   &gt; in all of its states is more critical than ever. Cryptography is now commonly deployed
   &gt; to provide both data confidentiality (stopping unauthorized viewing) and data integrity
   &gt; (preventing or detecting unauthorized changes). While techniques to protect data in transit
   &gt; and at rest are now commonly deployed, the third state - protecting data in use - is the new frontier.

Confidential Computing aims to primarily solve the problem of **protecting data in use**
by introducing a hardware-enforced Trusted Execution Environment (TEE).
--&gt;
&lt;p&gt;在这篇博客文章中，我们将介绍机密计算（Confidential Computing，简称 CC）的概念，
以增强任何计算环境的安全和隐私属性。此外，我们将展示云原生生态系统，
特别是 Kubernetes，如何从新的计算范式中受益。&lt;/p&gt;
&lt;p&gt;机密计算是一个先前在云原生领域中引入的概念。
&lt;a href=&#34;https://confidentialcomputing.io/&#34;&gt;机密计算联盟&lt;/a&gt;(Confidential Computing Consortium，简称 CCC)
是 Linux 基金会中的一个项目社区，
致力于&lt;a href=&#34;https://confidentialcomputing.io/wp-content/uploads/sites/85/2019/12/CCC_Overview.pdf&#34;&gt;定义和启用机密计算&lt;/a&gt;。
在&lt;a href=&#34;https://confidentialcomputing.io/wp-content/uploads/sites/85/2023/01/CCC-A-Technical-Analysis-of-Confidential-Computing-v1.3_Updated_November_2022.pdf&#34;&gt;白皮书&lt;/a&gt;中，
他们为使用机密计算提供了很好的动机。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;数据存在于三种状态：传输中、静态存储和使用中。保护所有状态下的敏感数据比以往任何时候都更加关键。
现在加密技术常被部署以提供数据机密性（阻止未经授权的查看）和数据完整性（防止或检测未经授权的更改）。
虽然现在通常部署了保护传输中和静态存储中的数据的技术，但保护使用中的数据是新的前沿。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;机密计算主要通过引入硬件强制执行的可信执行环境（TEE）来解决&lt;strong&gt;保护使用中的数据&lt;/strong&gt;的问题。&lt;/p&gt;
&lt;!--
## Trusted Execution Environments

For more than a decade, Trusted Execution Environments (TEEs) have been available in commercial
computing hardware in the form of [Hardware Security Modules](https://en.wikipedia.org/wiki/Hardware_security_module)
(HSMs) and [Trusted Platform Modules](https://www.iso.org/standard/50970.html) (TPMs). These
technologies provide trusted environments for shielded computations. They can
store highly sensitive cryptographic keys and carry out critical cryptographic operations
such as signing or encrypting data.
--&gt;
&lt;h2 id=&#34;trusted-execution-environments&#34;&gt;可信执行环境 &lt;/h2&gt;
&lt;p&gt;在过去的十多年里，可信执行环境（Trusted Execution Environments，简称 TEEs）
以&lt;a href=&#34;https://zh.wikipedia.org/zh-cn/%E7%A1%AC%E4%BB%B6%E5%AE%89%E5%85%A8%E6%A8%A1%E5%9D%97&#34;&gt;硬件安全模块&lt;/a&gt;（Hardware Security Modules，简称 HSMs）
和&lt;a href=&#34;https://www.iso.org/standard/50970.html&#34;&gt;可信平台模块&lt;/a&gt;（Trusted Platform Modules，简称 TPMs）
的形式在商业计算硬件中得以应用。这些技术提供了可信的环境来进行受保护的计算。
它们可以存储高度敏感的加密密钥，并执行关键的加密操作，如签名或加密数据。&lt;/p&gt;
&lt;!--
TPMs are optimized for low cost, allowing them to be integrated into mainboards and act as a
system&#39;s physical root of trust. To keep the cost low, TPMs are limited in scope, i.e., they
provide storage for only a few keys and are capable of just a small subset of cryptographic operations.

In contrast, HSMs are optimized for high performance, providing secure storage for far
more keys and offering advanced physical attack detection mechanisms. Additionally, high-end HSMs
can be programmed so that arbitrary code can be compiled and executed. The downside
is that they are very costly. A managed CloudHSM from AWS costs
[around $1.50 / hour](https://aws.amazon.com/cloudhsm/pricing/) or ~$13,500 / year.
--&gt;
&lt;p&gt;TPMs 的优化为降低成本，使它们能够集成到主板中并充当系统的物理根信任。
为了保持低成本，TPMs 的范围受到限制，即它们只能存储少量的密钥，并且仅能执行一小部分的加密操作。&lt;/p&gt;
&lt;p&gt;相比之下，HSMs 的优化为提高性能，为更多的密钥提供安全存储，并提供高级物理攻击检测机制。
此外，高端 HSMs 可以编程，以便可以编译和执行任意代码。缺点是它们的成本非常高。
来自 AWS 的托管 CloudHSM 的费用大约是&lt;a href=&#34;https://aws.amazon.com/cloudhsm/pricing/&#34;&gt;每小时 1.50 美元&lt;/a&gt;，
或者约每年 13,500 美元。&lt;/p&gt;
&lt;!--
In recent years, a new kind of TEE has gained popularity. Technologies like
[AMD SEV](https://developer.amd.com/sev/),
[Intel SGX](https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html),
and [Intel TDX](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html)
provide TEEs that are closely integrated with userspace. Rather than low-power or high-performance
devices that support specific use cases, these TEEs shield normal processes or virtual machines
and can do so with relatively low overhead. These technologies each have different design goals,
advantages, and limitations, and they are available in different environments, including consumer
laptops, servers, and mobile devices.
--&gt;
&lt;p&gt;近年来，一种新型的 TEE 已经变得流行。
像 &lt;a href=&#34;https://developer.amd.com/sev/&#34;&gt;AMD SEV&lt;/a&gt;、
&lt;a href=&#34;https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html&#34;&gt;Intel SGX&lt;/a&gt;
和 &lt;a href=&#34;https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html&#34;&gt;Intel TDX&lt;/a&gt;
这样的技术提供了与用户空间紧密集成的 TEE。与支持特定的低功耗或高性能设备不同，
这些 TEE 保护普通进程或虚拟机，并且可以以相对较低的开销执行此操作。
这些技术各有不同的设计目标、优点和局限性，
并且在不同的环境中可用，包括消费者笔记本电脑、服务器和移动设备。&lt;/p&gt;
&lt;!--
Additionally, we should mention
[ARM TrustZone](https://www.arm.com/technologies/trustzone-for-cortex-a), which is optimized
for embedded devices such as smartphones, tablets, and smart TVs, as well as
[AWS Nitro Enclaves](https://aws.amazon.com/ec2/nitro/nitro-enclaves/), which are only available
on [Amazon Web Services](https://aws.amazon.com/) and have a different threat model compared
to the CPU-based solutions by Intel and AMD.
--&gt;
&lt;p&gt;此外，我们应该提及 &lt;a href=&#34;https://www.arm.com/technologies/trustzone-for-cortex-a&#34;&gt;ARM TrustZone&lt;/a&gt;，
它针对智能手机、平板电脑和智能电视等嵌入式设备进行了优化，
以及 &lt;a href=&#34;https://aws.amazon.com/ec2/nitro/nitro-enclaves/&#34;&gt;AWS Nitro Enclaves&lt;/a&gt;，
它们只在 &lt;a href=&#34;https://aws.amazon.com/&#34;&gt;Amazon Web Services&lt;/a&gt; 上可用，
并且与 Intel 和 AMD 的基于 CPU 的解决方案相比，具有不同的威胁模型。&lt;/p&gt;
&lt;!--
[IBM Secure Execution for Linux](https://www.ibm.com/docs/en/linux-on-systems?topic=virtualization-secure-execution)
lets you run your Kubernetes cluster&#39;s nodes as KVM guests within a trusted execution environment on
IBM Z series hardware. You can use this hardware-enhanced virtual machine isolation to
provide strong isolation between tenants in a cluster, with hardware attestation about the (virtual) node&#39;s integrity.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://www.ibm.com/docs/en/linux-on-systems?topic=virtualization-secure-execution&#34;&gt;IBM Secure Execution for Linux&lt;/a&gt;
允许你在 IBM Z 系列硬件的可信执行环境内以 KVM 客户端的形式运行 Kubernetes 集群的节点。
你可以使用这种硬件增强的虚拟机隔离机制为集群中的租户之间提供稳固的隔离，
并通过硬件验证提供关于（虚拟）节点完整性的信息。&lt;/p&gt;
&lt;!--
### Security properties and feature set

In the following sections, we will review the security properties and additional features
these new technologies bring to the table. Only some solutions will provide all properties;
we will discuss each technology in further detail in their respective section.
--&gt;
&lt;h3 id=&#34;security-properties-and-feature-set&#34;&gt;安全属性和特性功能 &lt;/h3&gt;
&lt;p&gt;下文将回顾这些新技术所带来的安全属性和额外功能。
只有部分解决方案会提供所有属性；我们将在各自的小节中更详细地讨论每项技术。&lt;/p&gt;
&lt;!--
The **Confidentiality** property ensures that information cannot be viewed while it is
in use in the TEE. This provides us with the highly desired feature to secure
**data in use**. Depending on the specific TEE used, both code and data may be protected
from outside viewers. The differences in TEE architectures and how their use
in a cloud native context are important considerations when designing end-to-end security
for sensitive workloads with a minimal **Trusted Computing Base** (TCB) in mind. CCC has recently
worked on a [common vocabulary and supporting material](https://confidentialcomputing.io/wp-content/uploads/sites/85/2023/01/Common-Terminology-for-Confidential-Computing.pdf)
that helps to explain where confidentiality boundaries are drawn with the different TEE
architectures and how that impacts the TCB size.
--&gt;
&lt;p&gt;&lt;strong&gt;机密性&lt;/strong&gt;属性确保在使用 TEE 时信息无法被查看。这为我们提供了非常需要的的功能以保护&lt;strong&gt;使用中的数据&lt;/strong&gt;。
根据使用的特定 TEE，代码和数据都可能受到外部查看者的保护。
TEE 架构的差异以及它们在云原生环境中的使用是在设计端到端安全性时的重要考虑因素，
目的是为敏感工作负载提供最小的&lt;strong&gt;可信计算基础&lt;/strong&gt;（Trusted Computing Base, 简称 TCB）。
CCC 最近致力于&lt;strong&gt;通用术语和支持材料&lt;/strong&gt;，以帮助解释在不同的 TEE 架构下机密性边界的划分，
以及这如何影响 TCB 的大小。&lt;/p&gt;
&lt;!--
Confidentiality is a great feature, but an attacker can still manipulate
or inject arbitrary code and data for the TEE to execute and, therefore, easily leak critical
information. **Integrity** guarantees a TEE owner that neither code nor data can be
tampered with while running critical computations.
--&gt;
&lt;p&gt;机密性是一个很好的特性，但攻击者仍然可以操纵或注入任意代码和数据供 TEE 执行，
因此，很容易泄露关键信息。&lt;strong&gt;完整性&lt;/strong&gt;保证 TEE 拥有者在运行关键计算时，代码和数据都不能被篡改。&lt;/p&gt;
&lt;!--
**Availability** is a basic property often discussed in the context of information
security. However, this property is outside the scope of most TEEs. Usually, they can be controlled
(shut down, restarted, …) by some higher level abstraction. This could be the CPU itself, the
hypervisor, or the kernel. This is to preserve the overall system&#39;s availability,
not the TEE itself. When running in the cloud, availability is usually guaranteed by
the cloud provider in terms of Service Level Agreements (SLAs) and is not cryptographically enforceable.
--&gt;
&lt;p&gt;&lt;strong&gt;可用性&lt;/strong&gt;是在信息安全背景下经常讨论的一项基本属性。然而，这一属性超出了大多数 TEE 的范围。
通常，它们可以被一些更高级别的抽象控制（关闭、重启...）。这可以是 CPU 本身、虚拟机监视器或内核。
这是为了保持整个系统的可用性，而不是 TEE 本身。在云环境中运行时，
可用性通常由云提供商以服务级别协议（Service Level Agreements，简称 SLAs）的形式保证，
并且不能通过加密强制执行。&lt;/p&gt;
&lt;!--
Confidentiality and Integrity by themselves are only helpful in some cases. For example,
consider a TEE running in a remote cloud. How would you know the TEE is genuine and running
your intended software? It could be an imposter stealing your data as soon as you send it over.
This fundamental problem is addressed by **Attestability**. Attestation allows us to verify
the identity, confidentiality, and integrity of TEEs based on cryptographic certificates issued
from the hardware itself. This feature can also be made available to clients outside of the
confidential computing hardware in the form of remote attestation.
--&gt;
&lt;p&gt;仅凭机密性和完整性在某些情况下是有帮助的。例如，考虑一个在远程云中运行的 TEE。
你如何知道 TEE 是真实的并且正在运行你预期的软件？一旦你发送数据，
它可能是一个冒名顶替者窃取你的数据。这个根本问题通过&lt;strong&gt;可验证性&lt;/strong&gt;得到解决。
验证允许我们基于硬件本身签发的加密证书来验证 TEE 的身份、机密性和完整性。
这个功能也可以以远程验证的形式提供给机密计算硬件之外的客户端使用。&lt;/p&gt;
&lt;!--
TEEs can hold and process information that predates or outlives the trusted environment. That
could mean across restarts, different versions, or platform migrations. Therefore **Recoverability**
is an important feature. Data and the state of a TEE need to be sealed before they are written
to persistent storage to maintain confidentiality and integrity guarantees. The access to such
sealed data needs to be well-defined. In most cases, the unsealing is bound to a TEE&#39;s identity.
Hence, making sure the recovery can only happen in the same confidential context.
--&gt;
&lt;p&gt;TEEs 可以保存和处理早于或超出可信环境存在时间的信息。这可能意味着重启、跨不同版本或平台迁移的信息。
因此，&lt;strong&gt;可恢复性&lt;/strong&gt;是一个重要的特性。在将数据和 TEE 的状态写入持久性存储之前，需要对它们进行封装，
以维护保证机密性和完整性。对这种封装数据的访问需要明确定义。在大多数情况下，
解封过程与 TEE 绑定的身份有关。因此，确保恢复只能在相同的机密环境中进行。&lt;/p&gt;
&lt;!--
This does not have to limit the flexibility of the overall system.
[AMD SEV-SNP&#39;s migration agent (MA)](https://www.amd.com/system/files/TechDocs/SEV-SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf)
allows users to migrate a confidential virtual machine to a different host system
while keeping the security properties of the TEE intact.
--&gt;
&lt;p&gt;这不必限制整个系统的灵活性。
&lt;a href=&#34;https://www.amd.com/system/files/TechDocs/SEV-SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf&#34;&gt;AMD SEV-SNP 的迁移代理 (MA)&lt;/a&gt;
允许用户将机密虚拟机迁移到不同的主机系统，同时保持 TEE 的安全属性不变。&lt;/p&gt;
&lt;!--
## Feature comparison

These sections of the article will dive a little bit deeper into the specific implementations,
compare supported features and analyze their security properties.
--&gt;
&lt;h2 id=&#34;feature-comparison&#34;&gt;功能比较 &lt;/h2&gt;
&lt;p&gt;本文的这部分将更深入地探讨具体的实现，比较支持的功能并分析它们的安全属性。&lt;/p&gt;
&lt;!--
### AMD SEV

AMD&#39;s [Secure Encrypted Virtualization (SEV)](https://developer.amd.com/sev/) technologies
are a set of features to enhance the security of virtual machines on AMD&#39;s server CPUs. SEV
transparently encrypts the memory of each VM with a unique key. SEV can also calculate a
signature of the memory contents, which can be sent to the VM&#39;s owner as an attestation that
the initial guest memory was not manipulated.
--&gt;
&lt;h3 id=&#34;amd-sev&#34;&gt;AMD SEV &lt;/h3&gt;
&lt;p&gt;AMD 的&lt;a href=&#34;https://developer.amd.com/sev/&#34;&gt;安全加密虚拟化 (SEV)&lt;/a&gt;技术是一组功能，
用于增强 AMD 服务器 CPU 上虚拟机的安全性。SEV 透明地用唯一密钥加密每个 VM 的内存。
SEV 还可以计算内存内容的签名，该签名可以作为证明初始客户机内存没有被篡改的依据发送给 VM 的所有者。&lt;/p&gt;
&lt;!--
The second generation of SEV, known as
[Encrypted State](https://www.amd.com/content/dam/amd/en/documents/epyc-business-docs/white-papers/Protecting-VM-Register-State-with-SEV-ES.pdf)
or SEV-ES, provides additional protection from the hypervisor by encrypting all
CPU register contents when a context switch occurs.
--&gt;
&lt;p&gt;SEV 的第二代，称为&lt;a href=&#34;https://www.amd.com/content/dam/amd/en/documents/epyc-business-docs/white-papers/Protecting-VM-Register-State-with-SEV-ES.pdf&#34;&gt;加密状态&lt;/a&gt;
或 SEV-ES，通过在发生上下文切换时加密所有 CPU 寄存器内容，提供了对虚拟机管理程序的额外保护。&lt;/p&gt;
&lt;!--
The third generation of SEV,
[Secure Nested Paging](https://www.amd.com/system/files/TechDocs/SEV-SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf)
or SEV-SNP, is designed to prevent software-based integrity attacks and reduce the risk associated with
compromised memory integrity. The basic principle of SEV-SNP integrity is that if a VM can read
a private (encrypted) memory page, it must always read the value it last wrote.

Additionally, by allowing the guest to obtain remote attestation statements dynamically,
SNP enhances the remote attestation capabilities of SEV.
--&gt;
&lt;p&gt;SEV 的第三代，&lt;a href=&#34;https://www.amd.com/system/files/TechDocs/SEV-SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf&#34;&gt;安全嵌套分页&lt;/a&gt;
或 SEV-SNP，旨在防止基于软件的完整性攻击并降低受损内存完整性相关的风险。
SEV-SNP 完整性的基本原则是，如果虚拟机可以读取私有（加密）内存页，
那么它必须始终读取它最后写入的值。&lt;/p&gt;
&lt;p&gt;此外，通过允许客户端动态获取远程验证声明，SNP 增强了 SEV 的远程验证能力。&lt;/p&gt;
&lt;!--
AMD SEV has been implemented incrementally. New features and improvements have been added with
each new CPU generation. The Linux community makes these features available as part of the KVM hypervisor
and for host and guest kernels. The first SEV features were discussed and implemented in 2016 - see
[AMD x86 Memory Encryption Technologies](https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/kaplan)
from the 2016 Usenix Security Symposium. The latest big addition was
[SEV-SNP guest support in Linux 5.19](https://www.phoronix.com/news/AMD-SEV-SNP-Arrives-Linux-5.19).

[Confidential VMs based on AMD SEV-SNP](https://azure.microsoft.com/en-us/updates/azureconfidentialvm/)
are available in Microsoft Azure since July 2022. Similarly, Google Cloud Platform (GCP) offers
[confidential VMs based on AMD SEV-ES](https://cloud.google.com/compute/confidential-vm/docs/about-cvm).
--&gt;
&lt;p&gt;AMD SEV 是以增量方式实施的。每个新的 CPU 代都增加了新功能和改进。
Linux 社区将这些功能作为 KVM 虚拟机管理程序的一部分提供，适用于主机和客户机内核。
第一批 SEV 功能在 2016 年被讨论并实施 - 参见 2016 年 Usenix 安全研讨会的
&lt;a href=&#34;https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/kaplan&#34;&gt;AMD x86 内存加密技术&lt;/a&gt;。
最新的重大补充是 &lt;a href=&#34;https://cloud.google.com/compute/confidential-vm/docs/about-cvm&#34;&gt;Linux 5.19 中的 SEV-SNP 客户端支持&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;自 2022 年 7 月以来，Microsoft Azure 提供基于
&lt;a href=&#34;https://azure.microsoft.com/en-us/updates/azureconfidentialvm/&#34;&gt;AMD SEV-SNP 的机密虚拟机&lt;/a&gt;。
类似地，Google Cloud Platform (GCP) 提供基于
&lt;a href=&#34;https://cloud.google.com/compute/confidential-vm/docs/about-cvm&#34;&gt;AMD SEV-ES 的机密虚拟机&lt;/a&gt;。&lt;/p&gt;
&lt;!--
### Intel SGX

Intel&#39;s
[Software Guard Extensions](https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html)
has been available since 2015 and were introduced with the Skylake architecture.
--&gt;
&lt;h3 id=&#34;intel-sgx&#34;&gt;Intel SGX &lt;/h3&gt;
&lt;p&gt;Intel 的&lt;a href=&#34;https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html&#34;&gt;软件防护扩展&lt;/a&gt;
自 2015 年起便已推出，并在 Skylake 架构中首次亮相。&lt;/p&gt;
&lt;!--
SGX is an instruction set that enables users to create a protected and isolated process called
an *enclave*. It provides a reverse sandbox that protects enclaves from the operating system,
firmware, and any other privileged execution context.
--&gt;
&lt;p&gt;SGX 是一套指令集，它使用户能够创建一个叫做 &lt;em&gt;Enclave&lt;/em&gt; 的受保护且隔离的进程。
它提供了一个反沙箱机制，保护 Enclave 不受操作系统、固件以及任何其他特权执行上下文的影响。&lt;/p&gt;
&lt;!--
The enclave memory cannot be read or written from outside the enclave, regardless of
the current privilege level and CPU mode. The only way to call an enclave function is
through a new instruction that performs several protection checks. Its memory is encrypted.
Tapping the memory or connecting the DRAM modules to another system will yield only encrypted
data. The memory encryption key randomly changes every power cycle. The key is stored
within the CPU and is not accessible.
--&gt;
&lt;p&gt;Enclave 内存无法从 Enclave 外部读取或写入，无论当前的权限级别和 CPU 模式如何。
调用 Enclave 功能的唯一方式是通过一条执行多个保护检查的新指令。Enclave 的内存是加密的。
窃听内存或将 DRAM 模块连接到另一个系统只会得到加密数据。内存加密密钥在每次上电周期时随机更改。
密钥存储在 CPU 内部，无法访问。&lt;/p&gt;
&lt;!--
Since the enclaves are process isolated, the operating system&#39;s libraries are not usable as is;
therefore, SGX enclave SDKs are required to compile programs for SGX. This also implies applications
need to be designed and implemented to consider the trusted/untrusted isolation boundaries.
On the other hand, applications get built with very minimal TCB.
--&gt;
&lt;p&gt;由于 Enclave 是进程隔离的，操作系统的库不能直接使用；
因此，需要 SGX Enclave SDK 来编译针对 SGX 的程序。
这也意味着应用程序需要在设计和实现时考虑受信任/不受信任的隔离边界。
另一方面，应用程序的构建具有非常小的 TCB。&lt;/p&gt;
&lt;!--
An emerging approach to easily transition to process-based confidential computing
and avoid the need to build custom applications is to utilize library OSes. These OSes
facilitate running native, unmodified Linux applications inside SGX enclaves.
A library OS intercepts all application requests to the host OS and processes them securely
without the application knowing it&#39;s running a TEE.
--&gt;
&lt;p&gt;一种新兴的方法，利用库操作系统（library OSes）来轻松过渡到基于进程的机密计算并避免需要构建自定义应用程序。
这些操作系统有助于在 SGX 安全 Enclave 内运行原生的、未经修改的 Linux 应用程序。
操作系统库会拦截应用对宿主机操作系统的所有请求，并在应用不知情的情况下安全地处理它们，
而应用实际上是在一个受信执行环境（TEE）中运行。&lt;/p&gt;
&lt;!--
The 3rd generation Xeon CPUs (aka Ice Lake Server - &#34;ICX&#34;) and later generations did switch to using a technology called
[Total Memory Encryption - Multi-Key](https://www.intel.com/content/www/us/en/developer/articles/news/runtime-encryption-of-memory-with-intel-tme-mk.html)
(TME-MK) that uses AES-XTS, moving away from the
[Memory Encryption Engine](https://eprint.iacr.org/2016/204.pdf)
that the consumer and Xeon E CPUs used. This increased the possible
[enclave page cache](https://sgx101.gitbook.io/sgx101/sgx-bootstrap/enclave#enclave-page-cache-epc)
(EPC) size (up to 512GB/CPU) and improved performance. More info
about SGX on multi-socket platforms can be found in the
[Whitepaper](https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/supporting-intel-sgx-on-mulit-socket-platforms.pdf).
--&gt;
&lt;p&gt;第三代 Xeon 处理器（又称为 Ice Lake 服务器 - &amp;quot;ICX&amp;quot;）及其后续版本采用了一种名为
&lt;a href=&#34;https://www.intel.com/content/www/us/en/developer/articles/news/runtime-encryption-of-memory-with-intel-tme-mk.html&#34;&gt;全内存加密 - 多密钥&lt;/a&gt;（TME-MK）的技术，
该技术使用 AES-XTS，从消费者和 Xeon E 处理器使用的&lt;a href=&#34;https://eprint.iacr.org/2016/204.pdf&#34;&gt;内存加密引擎&lt;/a&gt;中脱离出来。
这可能增加了 &lt;a href=&#34;https://sgx101.gitbook.io/sgx101/sgx-bootstrap/enclave#enclave-page-cache-epc&#34;&gt;Enclave 页面缓存&lt;/a&gt;
（EPC）大小（每个 CPU 高达 512 GB）并提高了性能。关于多插槽平台上的 SGX 的更多信息可以在
&lt;a href=&#34;https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/supporting-intel-sgx-on-mulit-socket-platforms.pdf&#34;&gt;白皮书&lt;/a&gt;中找到。&lt;/p&gt;
&lt;!--
A [list of supported platforms](https://ark.intel.com/content/www/us/en/ark/search/featurefilter.html?productType=873)
is available from Intel.

SGX is available on
[Azure](https://azure.microsoft.com/de-de/updates/intel-sgx-based-confidential-computing-vms-now-available-on-azure-dedicated-hosts/),
[Alibaba Cloud](https://www.alibabacloud.com/help/en/elastic-compute-service/latest/build-an-sgx-encrypted-computing-environment),
[IBM](https://cloud.ibm.com/docs/bare-metal?topic=bare-metal-bm-server-provision-sgx), and many more.
--&gt;
&lt;p&gt;可以从 Intel 获取&lt;a href=&#34;https://ark.intel.com/content/www/us/en/ark/search/featurefilter.html?productType=873&#34;&gt;支持的平台列表&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;SGX 在 &lt;a href=&#34;https://azure.microsoft.com/de-de/updates/intel-sgx-based-confidential-computing-vms-now-available-on-azure-dedicated-hosts/&#34;&gt;Azure&lt;/a&gt;、
&lt;a href=&#34;https://www.alibabacloud.com/help/en/elastic-compute-service/latest/build-an-sgx-encrypted-computing-environment&#34;&gt;阿里云&lt;/a&gt;、
&lt;a href=&#34;https://cloud.ibm.com/docs/bare-metal?topic=bare-metal-bm-server-provision-sgx&#34;&gt;IBM&lt;/a&gt; 以及更多平台上可用。&lt;/p&gt;
&lt;!--
### Intel TDX

Where Intel SGX aims to protect the context of a single process,
[Intel&#39;s Trusted Domain Extensions](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html)
protect a full virtual machine and are, therefore, most closely comparable to AMD SEV.
--&gt;
&lt;h3 id=&#34;intel-tdx&#34;&gt;Intel TDX &lt;/h3&gt;
&lt;p&gt;Intel SGX 旨在保护单个进程的上下文，而
&lt;a href=&#34;https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html&#34;&gt;Intel 的可信域扩展&lt;/a&gt;保护整个虚拟机，
因此，它与 AMD SEV 最为相似。&lt;/p&gt;
&lt;!--
As with SEV-SNP, guest support for TDX was [merged in Linux Kernel 5.19](https://www.phoronix.com/news/Intel-TDX-For-Linux-5.19).
However, hardware support will land with [Sapphire Rapids](https://en.wikipedia.org/wiki/Sapphire_Rapids) during 2023:
[Alibaba Cloud provides](https://www.alibabacloud.com/help/en/elastic-compute-service/latest/build-a-tdx-confidential-computing-environment)
invitational preview instances, and
[Azure has announced](https://techcommunity.microsoft.com/t5/azure-confidential-computing/preview-introducing-dcesv5-and-ecesv5-series-confidential-vms/ba-p/3800718)
its TDX preview opportunity.
--&gt;
&lt;p&gt;与 SEV-SNP 一样，对 TDX 的客户端支持已经在
&lt;a href=&#34;https://www.phoronix.com/news/Intel-TDX-For-Linux-5.19&#34;&gt;Linux Kernel 5.19版本中合并&lt;/a&gt;。
然而，硬件支持将在 2023 年与 &lt;a href=&#34;https://en.wikipedia.org/wiki/Sapphire_Rapids&#34;&gt;Sapphire Rapids&lt;/a&gt; 一同发布：
&lt;a href=&#34;https://www.alibabacloud.com/help/en/elastic-compute-service/latest/build-a-tdx-confidential-computing-environment&#34;&gt;阿里云提供&lt;/a&gt;
邀请预览实例，同时，&lt;a href=&#34;https://techcommunity.microsoft.com/t5/azure-confidential-computing/preview-introducing-dcesv5-and-ecesv5-series-confidential-vms/ba-p/3800718&#34;&gt;Azure 已经宣布&lt;/a&gt;
其 TDX 预览机会。&lt;/p&gt;
&lt;!--
## Overhead analysis

The benefits that Confidential Computing technologies provide via strong isolation and enhanced
security to customer data and workloads are not for free. Quantifying this impact is challenging and
depends on many factors: The TEE technology, the benchmark, the metrics, and the type of workload
all have a huge impact on the expected performance overhead.
--&gt;
&lt;h2 id=&#34;overhead-analysis&#34;&gt;开销分析 &lt;/h2&gt;
&lt;p&gt;通过强隔离和增强的安全性，机密计算技术为客户数据和工作负载提供的好处并非免费。
量化这种影响是具有挑战性的，并且取决于许多因素：TEE 技术，基准测试，
度量标准以及工作负载的类型都对预期的性能开销有巨大的影响。&lt;/p&gt;
&lt;!--
Intel SGX-based TEEs are hard to benchmark, as [shown](https://arxiv.org/pdf/2205.06415.pdf)
[by](https://www.ibr.cs.tu-bs.de/users/mahhouk/papers/eurosec2021.pdf)
[different papers](https://dl.acm.org/doi/fullHtml/10.1145/3533737.3535098). The chosen SDK/library
OS, the application itself, as well as the resource requirements (especially large memory requirements)
have a huge impact on performance. A single-digit percentage overhead can be expected if an application
is well suited to run inside an enclave.
--&gt;
&lt;p&gt;基于 Intel SGX 的 TEE 很难进行基准测试，
正如&lt;a href=&#34;https://dl.acm.org/doi/fullHtml/10.1145/3533737.3535098&#34;&gt;不同的论文&lt;/a&gt;所
&lt;a href=&#34;https://arxiv.org/pdf/2205.06415.pdf&#34;&gt;展示&lt;/a&gt;的&lt;a href=&#34;https://www.ibr.cs.tu-bs.de/users/mahhouk/papers/eurosec2021.pdf&#34;&gt;一样&lt;/a&gt;。
所选择的 SDK/操作系统库，应用程序本身以及资源需求（特别是大内存需求）对性能有巨大的影响。
如果应用程序非常适合在 Enclave 内运行，那么通常可以预期会有一个个位数的百分比的开销。&lt;/p&gt;
&lt;!--
Confidential virtual machines based on AMD SEV-SNP require no changes to the executed program
and operating system and are a lot easier to benchmark. A
[benchmark from Azure and AMD](https://community.amd.com/t5/business/microsoft-azure-confidential-computing-powered-by-3rd-gen-epyc/ba-p/497796)
shows that SEV-SNP VM overhead is &lt;10%, sometimes as low as 2%.
--&gt;
&lt;p&gt;基于 AMD SEV-SNP 的机密虚拟机不需要对执行的程序和操作系统进行任何更改，
因此更容易进行基准测试。一个来自
&lt;a href=&#34;https://community.amd.com/t5/business/microsoft-azure-confidential-computing-powered-by-3rd-gen-epyc/ba-p/497796&#34;&gt;Azure 和 AMD 的基准测试&lt;/a&gt;显示，
SEV-SNP VM 的开销 &amp;lt; 10%，有时甚至低至 2%。&lt;/p&gt;
&lt;!--
Although there is a performance overhead, it should be low enough to enable real-world workloads
to run in these protected environments and improve the security and privacy of our data.
--&gt;
&lt;p&gt;尽管存在性能开销，但它应该足够低，以便使真实世界的工作负载能够在这些受保护的环境中运行，
并提高我们数据的安全性和隐私性。&lt;/p&gt;
&lt;!--
## Confidential Computing compared to FHE, ZKP, and MPC

Fully Homomorphic Encryption (FHE), Zero Knowledge Proof/Protocol (ZKP), and Multi-Party
Computations (MPC) are all a form of encryption or cryptographic protocols that offer
similar security guarantees to Confidential Computing but do not require hardware support.
--&gt;
&lt;h2 id=&#34;confidential-computing-compared-to-fhe-zkp-and-mpc&#34;&gt;机密计算与 FHE、ZKP 和 MPC 的比较 &lt;/h2&gt;
&lt;p&gt;全同态加密（FHE），零知识证明/协议（ZKP）和多方计算（MPC）都是加密或密码学协议的形式，
提供与机密计算类似的安全保证，但不需要硬件支持。&lt;/p&gt;
&lt;!--
Fully (also partially and somewhat) homomorphic encryption allows one to perform
computations, such as addition or multiplication, on encrypted data. This provides
the property of encryption in use but does not provide integrity protection or attestation
like confidential computing does. Therefore, these two technologies can [complement to each other](https://confidentialcomputing.io/2023/03/29/confidential-computing-and-homomorphic-encryption/).
--&gt;
&lt;p&gt;全同态加密（也包括部分和有限同态加密）允许在加密数据上执行计算，例如加法或乘法。
这提供了在使用中加密的属性，但不像机密计算那样提供完整性保护或认证。因此，这两种技术可以
&lt;a href=&#34;https://confidentialcomputing.io/2023/03/29/confidential-computing-and-homomorphic-encryption/&#34;&gt;互为补充&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Zero Knowledge Proofs or Protocols are a privacy-preserving technique (PPT) that
allows one party to prove facts about their data without revealing anything else about
the data. ZKP can be used instead of or in addition to Confidential Computing to protect
the privacy of the involved parties and their data. Similarly, Multi-Party Computation
enables multiple parties to work together on a computation, i.e., each party provides
their data to the result without leaking it to any other parties.
--&gt;
&lt;p&gt;零知识证明或协议是一种隐私保护技术（PPT），它允许一方证明其数据的事实而不泄露关于数据的任何其他信息。
ZKP 可以替代或与机密计算一起使用，以保护相关方及其数据的隐私。同样，
多方计算使多个参与方能够共同进行计算，即每个参与方提供其数据以得出结果，
但不会泄露给任何其他参与方。&lt;/p&gt;
&lt;!--
## Use cases of Confidential Computing

The presented Confidential Computing platforms show that both the isolation of a single container
process and, therefore, minimization of the trusted computing base and the isolation of a
``
full virtual machine are possible. This has already enabled a lot of interesting and secure
projects to emerge:
--&gt;
&lt;h2 id=&#34;use-cases-of-confidential-computing&#34;&gt;机密计算的应用场景 &lt;/h2&gt;
&lt;p&gt;前面介绍的机密计算平台表明，既可以实现单个容器进程的隔离，从而最小化可信计算单元，
也可以实现整个虚拟机的隔离。这已经促使很多有趣且安全的项目涌现：&lt;/p&gt;
&lt;!--
### Confidential Containers

[Confidential Containers](https://github.com/confidential-containers) (CoCo) is a
CNCF sandbox project that isolates Kubernetes pods inside of confidential virtual machines.
--&gt;
&lt;h3 id=&#34;confidential-containers&#34;&gt;机密容器 &lt;/h3&gt;
&lt;p&gt;机密容器 (CoCo) 是一个 CNCF 沙箱项目，它在机密虚拟机内隔离 Kubernetes Pod。&lt;/p&gt;
&lt;!--
CoCo can be installed on a Kubernetes cluster with an operator.
The operator will create a set of runtime classes that can be used to deploy
pods inside an enclave on several different platforms, including
AMD SEV, Intel TDX, Secure Execution for IBM Z, and Intel SGX.
--&gt;
&lt;p&gt;CoCo 可以通过 operator 安装在 Kubernetes 集群上。operator 将创建一组运行时类，
这些类可以用于在多个不同的平台上的 Enclave 内部署 Pod，
包括 AMD SEV，Intel TDX，IBM Z 的安全执行和 Intel SGX。&lt;/p&gt;
&lt;!--
CoCo is typically used with signed and/or encrypted container images
which are pulled, verified, and decrypted inside the enclave.
Secrets, such as image decryption keys, are conditionally provisioned
to the enclave by a trusted Key Broker Service that validates the
hardware evidence of the TEE prior to releasing any sensitive information.
--&gt;
&lt;p&gt;CoCo 通常与签名和/或加密的容器镜像一起使用，这些镜像在 Enclave 内部被拉取、验证和解密。
密钥信息，比如镜像解密密钥，经由受信任的 Key Broker 服务有条件地提供给 Enclave，
这个服务在释放任何敏感信息之前验证 TEE 的硬件认证。&lt;/p&gt;
&lt;!--
CoCo has several deployment models. Since the Kubernetes control plane
is outside the TCB, CoCo is suitable for managed environments. CoCo can
be run in virtual environments that don&#39;t support nesting with the help of an
API adaptor that starts pod VMs in the cloud. CoCo can also be run on
bare metal, providing strong isolation even in multi-tenant environments.
--&gt;
&lt;p&gt;CoCo 有几种部署模型。由于 Kubernetes 控制平面在 TCB 之外，因此 CoCo 适合于受管理的环境。
在不支持嵌套的虚拟环境中，CoCo 可以借助 API 适配器运行，该适配器在云中启动 Pod VM。
CoCo 还可以在裸机上运行，在多租户环境中提供强大的隔离。&lt;/p&gt;
&lt;!--
### Managed confidential Kubernetes

[Azure](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-node-pool-aks) and
[GCP](https://cloud.google.com/blog/products/identity-security/announcing-general-availability-of-confidential-gke-nodes)
both support the use of confidential virtual machines as worker nodes for their managed Kubernetes offerings.
--&gt;
&lt;h3 id=&#34;managed-confidential-kubernetes&#34;&gt;受管理的机密 Kubernetes &lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-node-pool-aks&#34;&gt;Azure&lt;/a&gt;
和 &lt;a href=&#34;https://cloud.google.com/blog/products/identity-security/announcing-general-availability-of-confidential-gke-nodes&#34;&gt;GCP&lt;/a&gt;
都支持将机密虚拟机用作其受管理的 Kubernetes 的工作节点。&lt;/p&gt;
&lt;!--
Both services aim for better workload protection and security guarantees by enabling memory encryption
for container workloads. However, they don&#39;t seek to fully isolate the cluster or workloads against
the service provider or infrastructure. Specifically, they don&#39;t offer a dedicated confidential control
plane or expose attestation capabilities for the confidential cluster/nodes.
--&gt;
&lt;p&gt;这两项服务通过启用容器工作负载的内存加密，旨在提供更好的工作负载保护和安全保证。
然而，它们并没有寻求完全隔离集群或工作负载以防止服务提供者或基础设施的访问。
具体来说，它们不提供专用的机密控制平面，也不为机密集群/节点提供可验证的能力。&lt;/p&gt;
&lt;!--
Azure also enables
[Confidential Containers](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-nodes-aks-overview)
in their managed Kubernetes offering. They support the creation based on
[Intel SGX enclaves](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-containers-enclaves)
and [AMD SEV-based VMs](https://techcommunity.microsoft.com/t5/azure-confidential-computing/microsoft-introduces-preview-of-confidential-containers-on-azure/ba-p/3410394).
--&gt;
&lt;p&gt;Azure 在其托管的 Kubernetes 服务中也启用了
&lt;a href=&#34;https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-nodes-aks-overview&#34;&gt;机密容器&lt;/a&gt;。
他们支持基于 &lt;a href=&#34;https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-containers-enclaves&#34;&gt;Intel SGX Enclave&lt;/a&gt;
和基于 &lt;a href=&#34;https://techcommunity.microsoft.com/t5/azure-confidential-computing/microsoft-introduces-preview-of-confidential-containers-on-azure/ba-p/3410394&#34;&gt;AMD SEV 虚拟机&lt;/a&gt;
创建的机密容器。&lt;/p&gt;
&lt;!--
### Constellation

[Constellation](https://github.com/edgelesssys/constellation) is a Kubernetes engine that aims to
provide the best possible data security. Constellation wraps your entire Kubernetes cluster into
a single confidential context that is shielded from the underlying cloud infrastructure. Everything
inside is always encrypted, including at runtime in memory. It shields both the worker and control
plane nodes. In addition, it already integrates with popular CNCF software such as Cilium for
secure networking and provides extended CSI drivers to write data securely.
--&gt;
&lt;h3 id=&#34;constellation&#34;&gt;Constellation &lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/edgelesssys/constellation&#34;&gt;Constellation&lt;/a&gt;
是一个旨在提供最佳数据安全的 Kubernetes 引擎。
Constellation 将整个 Kubernetes 集群包装到一个机密上下文中，使其免受底层云基础设施的影响。
其中的所有内容始终是加密的，包括在内存中的运行时数据。它保护工作节点和控制平面节点。
此外，它已经与流行的 CNCF 软件（如 Cilium，用于安全网络）集成，
并提供扩展的 CSI 动程序来安全地写入数据。&lt;/p&gt;
&lt;!--
### Occlum and Gramine

[Occlum](https://occlum.io/) and [Gramine](https://gramineproject.io/) are examples of open source
library OS projects that can be used to run unmodified applications in SGX enclaves. They
are member projects under the CCC, but similar projects and products maintained by companies
also exist. With these libOS projects, existing containerized applications can be
easily converted into confidential computing enabled containers. Many curated prebuilt
containers are also available.
--&gt;
&lt;h3 id=&#34;occlum-and-gramine&#34;&gt;Occlum 和 Gramine &lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://occlum.io/&#34;&gt;Occlum&lt;/a&gt; 和 &lt;a href=&#34;https://gramineproject.io/&#34;&gt;Gramine&lt;/a&gt;
是两个开源的操作系统库项目，它们允许在 SGX 信任执行环境（Enclave）中运行未经修改的应用程序。
它们是 CCC（Confidential Computing Consortium）下的成员项目，
但也存在由公司维护的类似项目和产品。通过使用这些操作系统库项目，
现有的容器化应用可以轻松转换为支持机密计算的容器。还有许多经过筛选的预构建容器可供使用。&lt;/p&gt;
&lt;!--
## Where are we today? Vendors, limitations, and FOSS landscape

As we hope you have seen from the previous sections, Confidential Computing is a powerful new concept
to improve security, but we are still in the (early) adoption phase. New products are
starting to emerge to take advantage of the unique properties.
--&gt;
&lt;h2 id=&#34;where-are-we-today-vendors-limitations-and-foss-landscape&#34;&gt;我们现在处于哪个阶段？供应商、局限性和开源软件生态 &lt;/h2&gt;
&lt;p&gt;正如我们希望你从前面的章节中看到的，机密计算是一种强大的新概念，
用于提高安全性，但我们仍处于（早期）阶段。新产品开始涌现，以利用这些独特的属性。&lt;/p&gt;
&lt;!--
Google and Microsoft are the first major cloud providers to have confidential offerings that
can run unmodified applications inside a protected boundary.
Still, these offerings are limited to compute, while end-to-end solutions for confidential
databases, cluster networking, and load balancers have to be self-managed.
--&gt;
&lt;p&gt;谷歌和微软是首批能够让客户在一个受保护的环境内运行未经修改的应用程序的机密计算服务的主要云提供商。
然而，这些服务仅限于计算，而对于机密数据库、集群网络和负载均衡器的端到端解决方案则需要自行管理。&lt;/p&gt;
&lt;!--
These technologies provide opportunities to bring even the most
sensitive workloads into the cloud and enables them to leverage all the
tools in the CNCF landscape.
--&gt;
&lt;p&gt;这些技术为极其敏感的工作负载部署到云中提供了可能，并使其能够充分利用 CNCF 领域中的各种工具。&lt;/p&gt;
&lt;!--
## Call to action

If you are currently working on a high-security product that struggles to run in the
public cloud due to legal requirements or are looking to bring the privacy and security
of your cloud-native project to the next level: Reach out to all the great projects
we have highlighted! Everyone is keen to improve the security of our ecosystem, and you can
play a vital role in that journey.
--&gt;
&lt;h2 id=&#34;call-to-action&#34;&gt;号召行动 &lt;/h2&gt;
&lt;p&gt;如果你目前正在开发一个高安全性的产品，但由于法律要求在公共云上运行面临困难，
或者你希望提升你的云原生项目的隐私和安全性：请联系我们强调的所有出色项目！
每个人都渴望提高我们生态系统的安全性，而你可以在这个过程中扮演至关重要的角色。&lt;/p&gt;
&lt;!--
* [Confidential Containers](https://github.com/confidential-containers)
* [Constellation: Always Encrypted Kubernetes](https://github.com/edgelesssys/constellation)
* [Occlum](https://occlum.io/)
* [Gramine](https://gramineproject.io/)
* CCC also maintains a [list of projects](https://confidentialcomputing.io/projects/)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/confidential-containers&#34;&gt;机密容器&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/edgelesssys/constellation&#34;&gt;Constellation：始终加密的 Kubernetes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://occlum.io/&#34;&gt;Occlum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gramineproject.io/&#34;&gt;Gramine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;CCC 还维护了一个&lt;a href=&#34;https://confidentialcomputing.io/projects/&#34;&gt;项目列表&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>在 CRI 运行时内验证容器镜像签名</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/06/29/container-image-signature-verification/</link>
      <pubDate>Thu, 29 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/06/29/container-image-signature-verification/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Verifying Container Image Signatures Within CRI Runtimes&#34;
date: 2023-06-29
slug: container-image-signature-verification
--&gt;
&lt;!--
**Author**: Sascha Grunert
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Sascha Grunert&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;!--
The Kubernetes community has been signing their container image-based artifacts
since release v1.24. While the graduation of the [corresponding enhancement][kep]
from `alpha` to `beta` in v1.26 introduced signatures for the binary artifacts,
other projects followed the approach by providing image signatures for their
releases, too. This means that they either create the signatures within their
own CI/CD pipelines, for example by using GitHub actions, or rely on the
Kubernetes [image promotion][promo] process to automatically sign the images by
proposing pull requests to the [k/k8s.io][k8s.io] repository. A requirement for
using this process is that the project is part of the `kubernetes` or
`kubernetes-sigs` GitHub organization, so that they can utilize the community
infrastructure for pushing images into staging buckets.
--&gt;
&lt;p&gt;Kubernetes 社区自 v1.24 版本开始对基于容器镜像的工件进行签名。在 v1.26 中，
&lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/3031&#34;&gt;相应的增强特性&lt;/a&gt;从 &lt;code&gt;alpha&lt;/code&gt; 进阶至 &lt;code&gt;beta&lt;/code&gt;，引入了针对二进制工件的签名。
其他项目也采用了类似的方法，为其发布版本提供镜像签名。这意味着这些项目要么使用 GitHub actions
在自己的 CI/CD 流程中创建签名，要么依赖于 Kubernetes 的&lt;a href=&#34;https://github.com/kubernetes-sigs/promo-tools/blob/e2b96dd/docs/image-promotion.md&#34;&gt;镜像推广&lt;/a&gt;流程，
通过向 &lt;a href=&#34;https://github.com/kubernetes/k8s.io/tree/4b95cc2/k8s.gcr.io&#34;&gt;k/k8s.io&lt;/a&gt; 仓库提交 PR 来自动签名镜像。
使用此流程的前提要求是项目必须属于 &lt;code&gt;kubernetes&lt;/code&gt; 或 &lt;code&gt;kubernetes-sigs&lt;/code&gt; GitHub 组织，
这样能够利用社区基础设施将镜像推送到暂存桶中。&lt;/p&gt;
&lt;!--
Assuming that a project now produces signed container image artifacts, how can
one actually verify the signatures? It is possible to do it manually like
outlined in the [official Kubernetes documentation][docs]. The problem with this
approach is that it involves no automation at all and should be only done for
testing purposes. In production environments, tools like the [sigstore
policy-controller][policy-controller] can help with the automation. These tools
provide a higher level API by using [Custom Resource Definitions (CRD)][crd] as
well as an integrated [admission controller and webhook][admission] to verify
the signatures.
--&gt;
&lt;p&gt;假设一个项目现在生成了已签名的容器镜像工件，那么如何实际验证这些签名呢？
你可以按照 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/verify-signed-artifacts/#verifying-image-signatures&#34;&gt;Kubernetes 官方文档&lt;/a&gt;所述来手动验证。但是这种方式的问题在于完全没有自动化，
应仅用于测试目的。在生产环境中，&lt;a href=&#34;https://docs.sigstore.dev/policy-controller/overview&#34;&gt;sigstore policy-controller&lt;/a&gt;
这样的工具有助于进行自动化处理。这些工具使用&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources&#34;&gt;自定义资源定义（CRD）&lt;/a&gt;提供了更高级别的 API，
并且利用集成的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/access-authn-authz/admission-controllers&#34;&gt;准入控制器和 Webhook&lt;/a&gt;来验证签名。&lt;/p&gt;
&lt;!--
The general usage flow for an admission controller based verification is:
--&gt;
&lt;p&gt;基于准入控制器的验证的一般使用流程如下：&lt;/p&gt;
&lt;!--

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/06/29/container-image-signature-verification/flow.svg&#34;
         alt=&#34;Create an instance of the policy and annotate the namespace to validate the signatures. Then create the pod. The controller evaluates the policy and if it passes, then it does the image pull if necessary. If the policy evaluation fails, then it will not admit the pod.&#34;/&gt; 
&lt;/figure&gt;

--&gt;

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/06/29/container-image-signature-verification/flow.svg&#34;
         alt=&#34;创建一个策略的实例，并对命名空间添加注解以验证签名。然后创建 Pod。控制器会评估策略，如果评估通过，则根据需要执行镜像拉取。如果策略评估失败，则不允许该 Pod 运行。&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
A key benefit of this architecture is simplicity: A single instance within the
cluster validates the signatures before any image pull can happen in the
container runtime on the nodes, which gets initiated by the kubelet. This
benefit also brings along the issue of separation: The node which should pull
the container image is not necessarily the same node that performs the admission. This
means that if the controller is compromised, then a cluster-wide policy
enforcement can no longer be possible.

One way to solve this issue is doing the policy evaluation directly within the
[Container Runtime Interface (CRI)][cri] compatible container runtime. The
runtime is directly connected to the [kubelet][kubelet] on a node and does all
the tasks like pulling images. [CRI-O][cri-o] is one of those available runtimes
and will feature full support for container image signature verification in v1.28.
--&gt;
&lt;p&gt;这种架构的一个主要优点是简单：集群中的单个实例会先验证签名，然后才在节点上的容器运行时中执行镜像拉取操作，
镜像拉取是由 kubelet 触发的。这个优点也带来了分离的问题：应拉取容器镜像的节点不一定是执行准入控制的节点。
这意味着如果控制器受到攻击，那么无法在整个集群范围内强制执行策略。&lt;/p&gt;
&lt;p&gt;解决此问题的一种方式是直接在与&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/docs/concepts/architecture/cri&#34;&gt;容器运行时接口（CRI）&lt;/a&gt;兼容的容器运行时中进行策略评估。
这种运行时直接连接到节点上的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/docs/reference/command-line-tools-reference/kubelet&#34;&gt;kubelet&lt;/a&gt;，执行拉取镜像等所有任务。
&lt;a href=&#34;https://github.com/cri-o/cri-o&#34;&gt;CRI-O&lt;/a&gt; 是可用的运行时之一，将在 v1.28 中完全支持容器镜像签名验证。&lt;/p&gt;
&lt;!--
How does it work? CRI-O reads a file called [`policy.json`][policy.json], which
contains all the rules defined for container images. For example, you can define a
policy which only allows signed images `quay.io/crio/signed` for any tag or
digest like this:
--&gt;
&lt;p&gt;容器运行时是如何工作的呢？CRI-O 会读取一个名为 &lt;a href=&#34;https://github.com/containers/image/blob/b3e0ba2/docs/containers-policy.json.5.md#sigstoresigned&#34;&gt;&lt;code&gt;policy.json&lt;/code&gt;&lt;/a&gt; 的文件，
其中包含了为容器镜像定义的所有规则。例如，你可以定义一个策略，
只允许带有以下标记或摘要的已签名镜像 &lt;code&gt;quay.io/crio/signed&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-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;default&amp;#34;&lt;/span&gt;: [{ &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;reject&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;transports&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;docker&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;quay.io/crio/signed&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;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sigstoreSigned&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;signedIdentity&amp;#34;&lt;/span&gt;: { &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;matchRepository&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;fulcio&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;oidcIssuer&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://github.com/login/oauth&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;subjectEmail&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;sgrunert@redhat.com&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;caData&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUI5ekNDQVh5Z0F3SUJBZ0lVQUxaTkFQRmR4SFB3amVEbG9Ed3lZQ2hBTy80d0NnWUlLb1pJemowRUF3TXcKS2pFVk1CTUdBMVVFQ2hNTWMybG5jM1J2Y21VdVpHVjJNUkV3RHdZRFZRUURFd2h6YVdkemRHOXlaVEFlRncweQpNVEV3TURjeE16VTJOVGxhRncwek1URXdNRFV4TXpVMk5UaGFNQ294RlRBVEJnTlZCQW9UREhOcFozTjBiM0psCkxtUmxkakVSTUE4R0ExVUVBeE1JYzJsbmMzUnZjbVV3ZGpBUUJnY3Foa2pPUFFJQkJnVXJnUVFBSWdOaUFBVDcKWGVGVDRyYjNQUUd3UzRJYWp0TGszL09sbnBnYW5nYUJjbFlwc1lCcjVpKzR5bkIwN2NlYjNMUDBPSU9aZHhleApYNjljNWlWdXlKUlErSHowNXlpK1VGM3VCV0FsSHBpUzVzaDArSDJHSEU3U1hyazFFQzVtMVRyMTlMOWdnOTJqCll6QmhNQTRHQTFVZER3RUIvd1FFQXdJQkJqQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01CMEdBMVVkRGdRV0JCUlkKd0I1ZmtVV2xacWw2ekpDaGt5TFFLc1hGK2pBZkJnTlZIU01FR0RBV2dCUll3QjVma1VXbFpxbDZ6SkNoa3lMUQpLc1hGK2pBS0JnZ3Foa2pPUFFRREF3TnBBREJtQWpFQWoxbkhlWFpwKzEzTldCTmErRURzRFA4RzFXV2cxdENNCldQL1dIUHFwYVZvMGpoc3dlTkZaZ1NzMGVFN3dZSTRxQWpFQTJXQjlvdDk4c0lrb0YzdlpZZGQzL1Z0V0I1YjkKVE5NZWE3SXgvc3RKNVRmY0xMZUFCTEU0Qk5KT3NRNHZuQkhKCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=&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;rekorPublicKeyData&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFMkcyWSsydGFiZFRWNUJjR2lCSXgwYTlmQUZ3cgprQmJtTFNHdGtzNEwzcVg2eVlZMHp1ZkJuaEM4VXIvaXk1NUdoV1AvOUEvYlkyTGhDMzBNOStSWXR3PT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==&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;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;!--
CRI-O has to be started to use that policy as the global source of truth:
--&gt;
&lt;p&gt;CRI-O 必须被启动才能将策略用作全局的可信源：&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;&amp;gt;&lt;/span&gt; sudo crio --log-level debug --signature-policy ./policy.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
CRI-O is now able to pull the image while verifying its signatures. This can be
done by using [`crictl` (cri-tools)][cri-tools], for example:
--&gt;
&lt;p&gt;CRI-O 现在可以在验证镜像签名的同时拉取镜像。例如，可以使用 &lt;a href=&#34;https://github.com/kubernetes-sigs/cri-tools&#34;&gt;&lt;code&gt;crictl&lt;/code&gt;（cri-tools）&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-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;&amp;gt;&lt;/span&gt; sudo crictl -D pull quay.io/crio/signed
&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;DEBU[…] get image connection
&lt;/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;DEBU[…] PullImageRequest: &amp;amp;PullImageRequest{Image:&amp;amp;ImageSpec{Image:quay.io/crio/signed,Annotations:map[string]string{},},Auth:nil,SandboxConfig:nil,}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;DEBU[…] PullImageResponse: &amp;amp;PullImageResponse{ImageRef:quay.io/crio/signed@sha256:18b42e8ea347780f35d979a829affa178593a8e31d90644466396e1187a07f3a,}
&lt;/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;Image is up to date for quay.io/crio/signed@sha256:18b42e8ea347780f35d979a829affa178593a8e31d90644466396e1187a07f3a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The CRI-O debug logs will also indicate that the signature got successfully
validated:
--&gt;
&lt;p&gt;CRI-O 的调试日志也会表明签名已成功验证：&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;DEBU[…] IsRunningImageAllowed for image docker:quay.io/crio/signed:latest
&lt;/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;DEBU[…]  Using transport &amp;#34;docker&amp;#34; specific policy section quay.io/crio/signed
&lt;/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;DEBU[…] Reading /var/lib/containers/sigstore/crio/signed@sha256=18b42e8ea347780f35d979a829affa178593a8e31d90644466396e1187a07f3a/signature-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:#888&#34;&gt;DEBU[…] Looking for sigstore attachments in quay.io/crio/signed:sha256-18b42e8ea347780f35d979a829affa178593a8e31d90644466396e1187a07f3a.sig
&lt;/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;DEBU[…] GET https://quay.io/v2/crio/signed/manifests/sha256-18b42e8ea347780f35d979a829affa178593a8e31d90644466396e1187a07f3a.sig
&lt;/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;DEBU[…] Content-Type from manifest GET is &amp;#34;application/vnd.oci.image.manifest.v1+json&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;DEBU[…] Found a sigstore attachment manifest with 1 layers
&lt;/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;DEBU[…] Fetching sigstore attachment 1/1: sha256:8276724a208087e73ae5d9d6e8f872f67808c08b0acdfdc73019278807197c45
&lt;/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;DEBU[…] Downloading /v2/crio/signed/blobs/sha256:8276724a208087e73ae5d9d6e8f872f67808c08b0acdfdc73019278807197c45
&lt;/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;DEBU[…] GET https://quay.io/v2/crio/signed/blobs/sha256:8276724a208087e73ae5d9d6e8f872f67808c08b0acdfdc73019278807197c45
&lt;/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;DEBU[…]  Requirement 0: allowed
&lt;/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;DEBU[…] Overall: allowed
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
All of the defined fields like `oidcIssuer` and `subjectEmail` in the policy
have to match, while `fulcio.caData` and `rekorPublicKeyData` are the public
keys from the upstream [fulcio (OIDC PKI)][fulcio] and [rekor
(transparency log)][rekor] instances.
--&gt;
&lt;p&gt;策略中定义的 &lt;code&gt;oidcIssuer&lt;/code&gt; 和 &lt;code&gt;subjectEmail&lt;/code&gt; 等所有字段都必须匹配，
而 &lt;code&gt;fulcio.caData&lt;/code&gt; 和 &lt;code&gt;rekorPublicKeyData&lt;/code&gt; 是来自上游 &lt;a href=&#34;https://github.com/sigstore/fulcio&#34;&gt;fulcio（OIDC PKI）&lt;/a&gt;
和 &lt;a href=&#34;https://github.com/sigstore/rekor&#34;&gt;rekor（透明日志）&lt;/a&gt; 实例的公钥。&lt;/p&gt;
&lt;!--
This means that if you now invalidate the `subjectEmail` of the policy, for example to
`wrong@mail.com`:
--&gt;
&lt;p&gt;这意味着如果你现在将策略中的 &lt;code&gt;subjectEmail&lt;/code&gt; 作废，例如更改为 &lt;code&gt;wrong@mail.com&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;&amp;gt;&lt;/span&gt; jq &lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;.transports.docker.&amp;#34;quay.io/crio/signed&amp;#34;[0].fulcio.subjectEmail = &amp;#34;wrong@mail.com&amp;#34;&amp;#39;&lt;/span&gt; policy.json &amp;gt; new-policy.json
&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;&amp;gt;&lt;/span&gt; mv new-policy.json policy.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then remove the image, since it already exists locally:
--&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:#000080;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; sudo crictl rmi quay.io/crio/signed
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Now when you pull the image, CRI-O complains that the required email is wrong:
--&gt;
&lt;p&gt;现在当你拉取镜像时，CRI-O 将报错所需的 email 是错的：&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;&amp;gt;&lt;/span&gt; sudo crictl pull quay.io/crio/signed
&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;FATA[…] pulling image: rpc error: code = Unknown desc = Source image rejected: Required email wrong@mail.com not found (got []string{&amp;#34;sgrunert@redhat.com&amp;#34;})
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
It is also possible to test an unsigned image against the policy. For that you
have to modify the key `quay.io/crio/signed` to something like
`quay.io/crio/unsigned`:
--&gt;
&lt;p&gt;你还可以对未签名的镜像进行策略测试。为此，你需要将键 &lt;code&gt;quay.io/crio/signed&lt;/code&gt;
修改为类似 &lt;code&gt;quay.io/crio/unsigned&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;&amp;gt;&lt;/span&gt; sed -i &lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;s;quay.io/crio/signed;quay.io/crio/unsigned;&amp;#39;&lt;/span&gt; policy.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
If you now pull the container image, CRI-O will complain that no signature exists
for it:
--&gt;
&lt;p&gt;如果你现在拉取容器镜像，CRI-O 将报错此镜像不存在签名：&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;&amp;gt;&lt;/span&gt; sudo crictl pull quay.io/crio/unsigned
&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;FATA[…] pulling image: rpc error: code = Unknown desc = SignatureValidationFailed: Source image rejected: A signature was required, but no signature exists
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
It is important to mention that CRI-O will match the
`.critical.identity.docker-reference` field within the signature to match with
the image repository. For example, if you verify the image
`registry.k8s.io/kube-apiserver-amd64:v1.28.0-alpha.3`, then the corresponding
`docker-reference` should be `registry.k8s.io/kube-apiserver-amd64`:
--&gt;
&lt;p&gt;需要强调的是，CRI-O 将签名中的 &lt;code&gt;.critical.identity.docker-reference&lt;/code&gt; 字段与镜像仓库进行匹配。
例如，如果你要验证镜像 &lt;code&gt;registry.k8s.io/kube-apiserver-amd64:v1.28.0-alpha.3&lt;/code&gt;，
则相应的 &lt;code&gt;docker-reference&lt;/code&gt; 须是 &lt;code&gt;registry.k8s.io/kube-apiserver-amd64&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;&amp;gt;&lt;/span&gt; cosign verify registry.k8s.io/kube-apiserver-amd64:v1.28.0-alpha.3 &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;&lt;span style=&#34;color:#888&#34;&gt;    --certificate-identity krel-trust@k8s-releng-prod.iam.gserviceaccount.com \
&lt;/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;    --certificate-oidc-issuer https://accounts.google.com \
&lt;/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;    | jq -r &amp;#39;.[0].critical.identity.&amp;#34;docker-reference&amp;#34;&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:#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;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;registry.k8s.io/kubernetes/kube-apiserver-amd64
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The Kubernetes community introduced `registry.k8s.io` as proxy mirror for
various registries. Before the release of [kpromo v4.0.2][kpromo], images
had been signed with the actual mirror rather than `registry.k8s.io`:
--&gt;
&lt;p&gt;Kubernetes 社区引入了 &lt;code&gt;registry.k8s.io&lt;/code&gt; 作为各种镜像仓库的代理镜像。
在 &lt;a href=&#34;https://github.com/kubernetes-sigs/promo-tools/releases/tag/v4.0.2&#34;&gt;kpromo v4.0.2&lt;/a&gt; 版本发布之前，镜像已使用实际镜像签名而不是使用
&lt;code&gt;registry.k8s.io&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;&amp;gt;&lt;/span&gt; cosign verify registry.k8s.io/kube-apiserver-amd64:v1.28.0-alpha.2 &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;&lt;span style=&#34;color:#888&#34;&gt;    --certificate-identity krel-trust@k8s-releng-prod.iam.gserviceaccount.com \
&lt;/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;    --certificate-oidc-issuer https://accounts.google.com \
&lt;/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;    | jq -r &amp;#39;.[0].critical.identity.&amp;#34;docker-reference&amp;#34;&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:#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;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;asia-northeast2-docker.pkg.dev/k8s-artifacts-prod/images/kubernetes/kube-apiserver-amd64
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The change of the `docker-reference` to `registry.k8s.io` makes it easier for
end users to validate the signatures, because they cannot know anything about the
underlying infrastructure being used. The feature to set the identity on image
signing has been added to [cosign][cosign-pr] via the flag `sign
--sign-container-identity` as well and will be part of its upcoming release.
--&gt;
&lt;p&gt;将 &lt;code&gt;docker-reference&lt;/code&gt; 更改为 &lt;code&gt;registry.k8s.io&lt;/code&gt; 使最终用户更容易验证签名，
因为他们不需要知道所使用的底层基础设施的详细信息。设置镜像签名身份的特性已通过
&lt;code&gt;sign --sign-container-identity&lt;/code&gt; 标志添加到 &lt;code&gt;cosign&lt;/code&gt;，并将成为即将发布的版本的一部分。&lt;/p&gt;
&lt;!--
The Kubernetes image pull error code `SignatureValidationFailed` got [recently added to
Kubernetes][pr-117717] and will be available from v1.28. This error code allows
end-users to understand image pull failures directly from the kubectl CLI. For
example, if you run CRI-O together with Kubernetes using the policy which requires
`quay.io/crio/unsigned` to be signed, then a pod definition like this:
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/117717&#34;&gt;最近在 Kubernetes 中添加了&lt;/a&gt;镜像拉取错误码 &lt;code&gt;SignatureValidationFailed&lt;/code&gt;，
将从 v1.28 版本开始可用。这个错误码允许最终用户直接从 kubectl CLI 了解镜像拉取失败的原因。
例如，如果你使用要求对 &lt;code&gt;quay.io/crio/unsigned&lt;/code&gt; 进行签名的策略同时运行 CRI-O 和 Kubernetes，
那么 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;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;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;quay.io/crio/unsigned&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;!--
Will cause the `SignatureValidationFailed` error when applying the pod manifest:
--&gt;
&lt;p&gt;将在应用 Pod 清单时造成 &lt;code&gt;SignatureValidationFailed&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;&amp;gt;&lt;/span&gt; kubectl apply -f pod.yaml
&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;pod/pod created
&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-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;&amp;gt;&lt;/span&gt; kubectl get pods
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;NAME   READY   STATUS                      RESTARTS   AGE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;pod    0/1     SignatureValidationFailed   0          4s
&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-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;&amp;gt;&lt;/span&gt; kubectl describe pod pod | tail -n8
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Type     Reason     Age                From               Message
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  ----     ------     ----               ----               -------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Scheduled  58s                default-scheduler  Successfully assigned default/pod to 127.0.0.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:#888&#34;&gt;  Normal   BackOff    22s (x2 over 55s)  kubelet            Back-off pulling image &amp;#34;quay.io/crio/unsigned&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Warning  Failed     22s (x2 over 55s)  kubelet            Error: ImagePullBackOff
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Normal   Pulling    9s (x3 over 58s)   kubelet            Pulling image &amp;#34;quay.io/crio/unsigned&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Warning  Failed     6s (x3 over 55s)   kubelet            Failed to pull image &amp;#34;quay.io/crio/unsigned&amp;#34;: SignatureValidationFailed: Source image rejected: A signature was required, but no signature exists
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;  Warning  Failed     6s (x3 over 55s)   kubelet            Error: SignatureValidationFailed
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
This overall behavior provides a more Kubernetes native experience and does not
rely on third party software to be installed in the cluster.
--&gt;
&lt;p&gt;这种整体行为提供了更符合 Kubernetes 原生体验的方式，并且不依赖于在集群中安装的第三方软件。&lt;/p&gt;
&lt;!--
There are still a few corner cases to consider: For example, what if you want to
allow policies per namespace in the same way the policy-controller supports it?
Well, there is an upcoming CRI-O feature in v1.28 for that! CRI-O will support
the `--signature-policy-dir` / `signature_policy_dir` option, which defines the
root path for pod namespace-separated signature policies. This means that CRI-O
will lookup that path and assemble a policy like `&lt;SIGNATURE_POLICY_DIR&gt;/&lt;NAMESPACE&gt;.json`,
which will be used on image pull if existing. If no pod namespace is
provided on image pull ([via the sandbox config][sandbox-config]), or the
concatenated path is non-existent, then CRI-O&#39;s global policy will be used as
fallback.
--&gt;
&lt;p&gt;还有一些特殊情况需要考虑：例如，如果你希望像策略控制器那样允许按命名空间设置策略，怎么办？
好消息是，CRI-O 在 v1.28 版本中即将推出这个特性！CRI-O 将支持 &lt;code&gt;--signature-policy-dir&lt;/code&gt; /
&lt;code&gt;signature_policy_dir&lt;/code&gt; 选项，为命名空间隔离的签名策略的 Pod 定义根路径。
这意味着 CRI-O 将查找该路径，并组装一个类似 &lt;code&gt;&amp;lt;SIGNATURE_POLICY_DIR&amp;gt;/&amp;lt;NAMESPACE&amp;gt;.json&lt;/code&gt;
的策略，在镜像拉取时如果存在则使用该策略。如果（&lt;a href=&#34;https://github.com/kubernetes/cri-api/blob/e5515a5/pkg/apis/runtime/v1/api.proto#L1448&#34;&gt;通过沙盒配置&lt;/a&gt;）
在镜像拉取时未提供 Pod 命名空间，或者串接的路径不存在，则 CRI-O 的全局策略将用作后备。&lt;/p&gt;
&lt;!--
Another corner case to consider is critical for the correct signature
verification within container runtimes: The kubelet only invokes container image
pulls if the image does not already exist on disk. This means that an
unrestricted policy from Kubernetes namespace A can allow pulling an image,
while namespace B is not able to enforce the policy because it already exits on
the node. Finally, CRI-O has to verify the policy not only on image pull, but
also on container creation. This fact makes things even a bit more complicated,
because the CRI does not really pass down the user specified image reference on
container creation, but an already resolved image ID, or digest. A [small
change to the CRI][pr-118652] can help with that.
--&gt;
&lt;p&gt;另一个需要考虑的特殊情况对于容器运行时中正确的签名验证至关重要：kubelet
仅在磁盘上不存在镜像时才调用容器镜像拉取。这意味着来自 Kubernetes 命名空间 A
的不受限策略可以允许拉取一个镜像，而命名空间 B 则无法强制执行该策略，
因为它已经存在于节点上了。最后，CRI-O 必须在容器创建时验证策略，而不仅仅是在镜像拉取时。
这一事实使情况变得更加复杂，因为 CRI 在容器创建时并没有真正传递用户指定的镜像引用，
而是传递已经解析过的镜像 ID 或摘要。&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/118652&#34;&gt;对 CRI 进行小改动&lt;/a&gt; 有助于解决这个问题。&lt;/p&gt;
&lt;!--
Now that everything happens within the container runtime, someone has to
maintain and define the policies to provide a good user experience around that
feature. The CRDs of the policy-controller are great, while we could imagine that
a daemon within the cluster can write the policies for CRI-O per namespace. This
would make any additional hook obsolete and moves the responsibility of
verifying the image signature to the actual instance which pulls the image. [I
evaluated][thread] other possible paths toward a better container image
signature verification within plain Kubernetes, but I could not find a great fit
for a native API. This means that I believe that a CRD is the way to go, but
users still need an instance which actually serves it.
--&gt;
&lt;p&gt;现在一切都发生在容器运行时中，大家必须维护和定义策略以提供良好的用户体验。
策略控制器的 CRD 非常出色，我们可以想象集群中的一个守护进程可以按命名空间为 CRI-O 编写策略。
这将使任何额外的回调过时，并将验证镜像签名的责任移交给实际拉取镜像的实例。
我已经评估了在纯 Kubernetes 中实现更好的容器镜像签名验证的其他可能途径，
但我没有找到一个很好的原生 API 解决方案。这意味着我相信 CRD 是正确的方法，
但用户仍然需要一个实际有作用的实例。&lt;/p&gt;
&lt;!--
Thank you for reading this blog post! If you&#39;re interested in more, providing
feedback or asking for help, then feel free to get in touch with me directly via
[Slack (#crio)][slack] or the [SIG Node mailing list][mail].
--&gt;
&lt;p&gt;感谢阅读这篇博文！如果你对更多内容感兴趣，想提供反馈或寻求帮助，请随时通过
&lt;a href=&#34;https://kubernetes.slack.com/messages/crio&#34;&gt;Slack (#crio)&lt;/a&gt; 或 &lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-sig-node&#34;&gt;SIG Node 邮件列表&lt;/a&gt;直接联系我。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>dl.k8s.io 采用内容分发网络（CDN）</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/06/09/dl-adopt-cdn/</link>
      <pubDate>Fri, 09 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/06/09/dl-adopt-cdn/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;dl.k8s.io to adopt a Content Delivery Network&#34;
date: 2023-06-09
slug: dl-adopt-cdn
--&gt;
&lt;!--
**Authors**: Arnaud Meukam (VMware), Hannah Aubry (Fast Forward), Frederico
Muñoz (SAS Institute)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Arnaud Meukam (VMware), Hannah Aubry (Fast Forward), Frederico Muñoz (SAS Institute)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/my-git9&#34;&gt;Xin Li&lt;/a&gt; (Daocloud)&lt;/p&gt;
&lt;!--
We&#39;re happy to announce that dl.k8s.io, home of the official Kubernetes
binaries, will soon be powered by [Fastly](https://www.fastly.com).

Fastly is known for its high-performance content delivery network (CDN) designed
to deliver content quickly and reliably around the world. With its powerful
network, Fastly will help us deliver official Kubernetes binaries to users
faster and more reliably than ever before.
--&gt;
&lt;p&gt;我们很高兴地宣布，官方 Kubernetes 二进制文件的主页 dl.k8s.io 很快将由
&lt;a href=&#34;https://www.fastly.com&#34;&gt;Fastly&lt;/a&gt; 提供支持。&lt;/p&gt;
&lt;p&gt;Fastly 以其高性能内容分发网络（CDN）而闻名，
该网络旨在全球范围内快速可靠地分发内容。凭借其强大的网络，Fastly
将帮助我们实现比以往更快、更可靠地向用户分发官方 Kubernetes 二进制文件。&lt;/p&gt;
&lt;!--
The decision to use Fastly was made after an extensive evaluation process in
which we carefully evaluated several potential content delivery network
providers. Ultimately, we chose Fastly because of their commitment to the open
internet and proven track record of delivering fast and secure digital
experiences to some of the most known open source projects (through their [Fast
Forward](https://www.fastly.com/fast-forward) program).
--&gt;
&lt;p&gt;使用 Fastly 是在经过广泛的评估过程后做出的决定，
在该过程中我们仔细评估了几个潜在的内容分发网络提供商。最终，我们选择
Fastly 是因为他们对开放互联网的承诺以及在为一些著名的开源项目（通过他们的
&lt;a href=&#34;https://www.fastly.com/fast-forward&#34;&gt;Fast Forward&lt;/a&gt;
计划）提供快速和安全的数字体验方面的良好记录。&lt;/p&gt;
&lt;!--
## What you need to know about this change

- On Monday, July 24th, the IP addresses and backend storage associated with the
  dl.k8s.io domain name will change.
- The change will not impact the vast majority of users since the domain
  name will remain the same.
- If you restrict access to specific IP ranges, access to the dl.k8s.io domain
  could stop working.
--&gt;
&lt;h2 id=&#34;关于本次更改你需要了解的信息&#34;&gt;关于本次更改你需要了解的信息&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;7 月 24 日星期一，与 dl.k8s.io 域名关联的 IP 地址和后端存储将发生变化。&lt;/li&gt;
&lt;li&gt;由于域名将保持不变，因此更改不会影响绝大多数用户。&lt;/li&gt;
&lt;li&gt;如果你限制对特定 IP 范围的访问，则对 dl.k8s.io 域的访问可能会停止工作。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
If you think you may be impacted or want to know more about this change,
please keep reading.
--&gt;
&lt;p&gt;如果你认为你可能会受到影响或想了解有关此次更改的更多信息，请继续阅读。&lt;/p&gt;
&lt;!--
## Why are we making this change

The official Kubernetes binaries site, dl.k8s.io, is used by thousands of users
all over the world, and currently serves _more than 5 petabytes of binaries each
month_. This change will allow us to improve access to those resources by
leveraging a world-wide CDN.
--&gt;
&lt;h2 id=&#34;我们为什么要进行此更改&#34;&gt;我们为什么要进行此更改&lt;/h2&gt;
&lt;p&gt;官方 Kubernetes 二进制文件网站 dl.k8s.io 被全世界成千上万的用户使用，
目前&lt;strong&gt;每月提供超过 5 PB 的二进制文件服务&lt;/strong&gt;。本次更改将通过充分利用全球
CDN 来改善对这些资源的访问。&lt;/p&gt;
&lt;!--
## Does this affect dl.k8s.io only, or are other domains also affected?

Only dl.k8s.io will be affected by this change.
--&gt;
&lt;h2 id=&#34;这只影响-dl-k8s-io-还是其他域也受到影响&#34;&gt;这只影响 dl.k8s.io，还是其他域也受到影响？&lt;/h2&gt;
&lt;p&gt;只有 dl.k8s.io 会受到本次变更的影响。&lt;/p&gt;
&lt;!--
## My company specifies the domain names that we are allowed to be accessed. Will this change affect the domain name?

No, the domain name (`dl.k8s.io`) will remain the same: no change will be
necessary, and access to the Kubernetes release binaries site should not be
affected.
--&gt;
&lt;h2 id=&#34;我公司规定了允许我们访问的域名-此更改会影响域名吗&#34;&gt;我公司规定了允许我们访问的域名，此更改会影响域名吗？&lt;/h2&gt;
&lt;p&gt;不，域名（&lt;code&gt;dl.k8s.io&lt;/code&gt;）将保持不变：无需更改，不会影响对 Kubernetes
发布二进制文件站点的访问。&lt;/p&gt;
&lt;!--
## My company uses some form of IP filtering. Will this change affect access to the site?

If IP-based filtering is in place, it’s possible that access to the site will be
affected when the new IP addresses become active.
--&gt;
&lt;h2 id=&#34;我的公司使用某种形式的-ip-过滤-此更改会影响对站点的访问吗&#34;&gt;我的公司使用某种形式的 IP 过滤，此更改会影响对站点的访问吗？&lt;/h2&gt;
&lt;p&gt;如果已经存在基于 IP 的过滤，则当新 IP 地址变为活动状态时，对站点的访问可能会受到影响。&lt;/p&gt;
&lt;!--
## If my company doesn’t use IP addresses to restrict network traffic, do we need to do anything?

No, the switch to the CDN should be transparent.
--&gt;
&lt;h2 id=&#34;如果我的公司不使用-ip-地址来限制网络流量-我们需要做些什么吗&#34;&gt;如果我的公司不使用 IP 地址来限制网络流量，我们需要做些什么吗？&lt;/h2&gt;
&lt;p&gt;不，切换到 CDN 的过程应该是透明的。&lt;/p&gt;
&lt;!--
## Will there be a dual running period?

**No, it is a cutover.** You can, however, test your networks right now to check
if they can route to the new public IP addresses from Fastly.  You should add
the new IPs to your network&#39;s `allowlist` before July 24th. Once the transfer is
complete, ensure your networks use the new IP addresses to connect to
the `dl.k8s.io` service.
--&gt;
&lt;h2 id=&#34;会有双运行期吗&#34;&gt;会有双运行期吗？&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;不，这是切换。&lt;/strong&gt; 但是，你现在可以测试你的网络，检查它们是否可以从 Fastly
路由到新的公共 IP 地址。 你应该在 7 月 24 日之前将新 IP 添加到你网络的 &lt;code&gt;allowlist&lt;/code&gt;（白名单）中。
切换完成后，确保你的网络使用新的 IP 地址连接到 &lt;code&gt;dl.k8s.io&lt;/code&gt; 服务。&lt;/p&gt;
&lt;!--
## What are the new IP addresses?

If you need to manage an allow list for downloads, you can get the ranges to
match from the Fastly API, in JSON: [public IP address
ranges](https://api.fastly.com/public-ip-list).  You don&#39;t need any credentials
to download that list of ranges.
--&gt;
&lt;h2 id=&#34;新-ip-地址是什么&#34;&gt;新 IP 地址是什么？&lt;/h2&gt;
&lt;p&gt;如果你需要管理下载允许列表，你可以从 Fastly API 中获取需要匹配的范围，
JSON 格式地址：&lt;a href=&#34;https://api.fastly.com/public-ip-list&#34;&gt;公共 IP 地址范围&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;你不需要任何凭据即可下载该范围列表。&lt;/p&gt;
&lt;!--
## What next steps would you recommend?

If you have IP-based filtering in place, we recommend the following course of
action **before July, 24th**:
--&gt;
&lt;h2 id=&#34;推荐哪些后续操作&#34;&gt;推荐哪些后续操作？&lt;/h2&gt;
&lt;p&gt;如果你已经有了基于 IP 的过滤，我们建议你&lt;strong&gt;在 7 月 24 日&lt;/strong&gt;之前采取以下行动：&lt;/p&gt;
&lt;!--
- Add the new IP addresses to your allowlist.
- Conduct tests with your networks/firewall to ensure your networks can route to
  the new IP addresses.

After the change is made, we recommend double-checking that HTTP calls are
accessing dl.k8s.io with the new IP addresses.
--&gt;
&lt;ul&gt;
&lt;li&gt;将新的 IP 地址添加到你的白名单。&lt;/li&gt;
&lt;li&gt;对你的网络/防火墙进行测试，以确保你的网络可以路由到新的 IP 地址。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;进行更改后，我们建议仔细检查 HTTP 调用是否正在使用新 IP 地址访问 dl.k8s.io。&lt;/p&gt;
&lt;!--
## What should I do if I detect some abnormality after the cutover date?

If you encounter any weirdness during binaries download, please [open an
issue](https://github.com/kubernetes/k8s.io/issues/new/choose).
--&gt;
&lt;h2 id=&#34;切换后发现异常怎么办&#34;&gt;切换后发现异常怎么办？&lt;/h2&gt;
&lt;p&gt;如果你在二进制文件下载过程中遇到任何异常，
请&lt;a href=&#34;https://github.com/kubernetes/k8s.io/issues/new/choose&#34;&gt;提交 Issue&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>使用 OCI 工件为 seccomp、SELinux 和 AppArmor 分发安全配置文件</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/24/oci-security-profiles/</link>
      <pubDate>Wed, 24 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/24/oci-security-profiles/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Using OCI artifacts to distribute security profiles for seccomp, SELinux and AppArmor&#34;
date: 2023-05-24
slug: oci-security-profiles
--&gt;
&lt;!--
**Author**: Sascha Grunert
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;: Sascha Grunert&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;!--
The [Security Profiles Operator (SPO)][spo] makes managing seccomp, SELinux and
AppArmor profiles within Kubernetes easier than ever. It allows cluster
administrators to define the profiles in a predefined custom resource YAML,
which then gets distributed by the SPO into the whole cluster. Modification and
removal of the security profiles are managed by the operator in the same way,
but that’s a small subset of its capabilities.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator&#34;&gt;Security Profiles Operator (SPO)&lt;/a&gt; 使得在 Kubernetes 中管理
seccomp、SELinux 和 AppArmor 配置文件变得更加容易。
它允许集群管理员在预定义的自定义资源 YAML 中定义配置文件，然后由 SPO 分发到整个集群中。
安全配置文件的修改和移除也由 Operator 以同样的方式进行管理，但这只是其能力的一小部分。&lt;/p&gt;
&lt;!--
Another core feature of the SPO is being able to stack seccomp profiles. This
means that users can define a `baseProfileName` in the YAML specification, which
then gets automatically resolved by the operator and combines the syscall rules.
If a base profile has another `baseProfileName`, then the operator will
recursively resolve the profiles up to a certain depth. A common use case is to
define base profiles for low level container runtimes (like [runc][runc] or
[crun][crun]) which then contain syscalls which are required in any case to run
the container. Alternatively, application developers can define seccomp base
profiles for their standard distribution containers and stack dedicated profiles
for the application logic on top. This way developers can focus on maintaining
seccomp profiles which are way simpler and scoped to the application logic,
without having a need to take the whole infrastructure setup into account.
--&gt;
&lt;p&gt;SPO 的另一个核心特性是能够组合 seccomp 配置文件。这意味着用户可以在 YAML
规约中定义 &lt;code&gt;baseProfileName&lt;/code&gt;，然后 Operator 会自动解析并组合系统调用规则。
如果基本配置文件有另一个 &lt;code&gt;baseProfileName&lt;/code&gt;，那么 Operator 将以递归方式解析配置文件到一定深度。
常见的使用场景是为低级容器运行时（例如 &lt;a href=&#34;https://github.com/opencontainers/runc&#34;&gt;runc&lt;/a&gt; 或 &lt;a href=&#34;https://github.com/containers/crun&#34;&gt;crun&lt;/a&gt;）定义基本配置文件，
在这些配置文件中包含各种情况下运行容器所需的系统调用。另外，应用开发人员可以为其标准分发容器定义
seccomp 基本配置文件，并在其上组合针对应用逻辑的专用配置文件。
这样开发人员就可以专注于维护更简单且范围限制为应用逻辑的 seccomp 配置文件，
而不需要考虑整个基础设施的设置。&lt;/p&gt;
&lt;!--
But how to maintain those base profiles? For example, the amount of required
syscalls for a runtime can change over its release cycle in the same way it can
change for the main application. Base profiles have to be available in the same
cluster, otherwise the main seccomp profile will fail to deploy. This means that
they’re tightly coupled to the main application profiles, which acts against the
main idea of base profiles. Distributing and managing them as plain files feels
like an additional burden to solve.
--&gt;
&lt;p&gt;但是如何维护这些基本配置文件呢？
例如，运行时所需的系统调用数量可能会像主应用一样在其发布周期内发生变化。
基本配置文件必须在同一集群中可用，否则主 seccomp 配置文件将无法部署。
这意味着这些基本配置文件与主应用配置文件紧密耦合，因此违背了基本配置文件的核心理念。
将基本配置文件作为普通文件分发和管理感觉像是需要解决的额外负担。&lt;/p&gt;
&lt;!--
## OCI artifacts to the rescue

The [v0.8.0][spo-latest] release of the Security Profiles Operator supports
managing base profiles as OCI artifacts! Imagine OCI artifacts as lightweight
container images, storing files in layers in the same way images do, but without
a process to be executed. Those artifacts can be used to store security profiles
like regular container images in compatible registries. This means they can be
versioned, namespaced and annotated similar to regular container images.
--&gt;
&lt;h2 id=&#34;oci-artifacts-to-rescue&#34;&gt;OCI 工件成为救命良方  &lt;/h2&gt;
&lt;p&gt;Security Profiles Operator 的 &lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator/releases/v0.8.0&#34;&gt;v0.8.0&lt;/a&gt; 版本支持将基本配置文件作为
OCI 工件进行管理！将 OCI 工件假想为轻量级容器镜像，采用与镜像相同的方式在各层中存储文件，
但没有要执行的进程。这些工件可以用于像普通容器镜像一样在兼容的镜像仓库中存储安全配置文件。
这意味着这些工件可以被版本化、作用于命名空间并类似常规容器镜像一样添加注解。&lt;/p&gt;
&lt;!--
To see how that works in action, specify a `baseProfileName` prefixed with
`oci://` within a seccomp profile CRD, for example:
--&gt;
&lt;p&gt;若要查看具体的工作方式，可以在 seccomp 配置文件 CRD 内以前缀 &lt;code&gt;oci://&lt;/code&gt;
指定 &lt;code&gt;baseProfileName&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;security-profiles-operator.x-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;SeccompProfile&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;defaultAction&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;SCMP_ACT_ERRNO&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;baseProfileName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;oci://ghcr.io/security-profiles/runc:v1.1.5&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;syscalls&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;SCMP_ACT_ALLOW&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;names&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- uname&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 operator will take care of pulling the content by using [oras][oras], as
well as verifying the [sigstore (cosign)][cosign] signatures of the artifact. If
the artifacts are not signed, then the SPO will reject them. The resulting
profile `test` will then contain all base syscalls from the remote `runc`
profile plus the additional allowed `uname` one. It is also possible to
reference the base profile by its digest (SHA256) making the artifact to be
pulled more specific, for example by referencing
`oci://ghcr.io/security-profiles/runc@sha256:380…`.
--&gt;
&lt;p&gt;Operator 将负责使用 &lt;a href=&#34;https://oras.land&#34;&gt;oras&lt;/a&gt; 拉取内容，并验证工件的 &lt;a href=&#34;https://github.com/sigstore/cosign&#34;&gt;sigstore (cosign)&lt;/a&gt; 签名。
如果某些工件未经签名，则 SPO 将拒绝它们。随后生成的配置文件 &lt;code&gt;test&lt;/code&gt; 将包含来自远程
&lt;code&gt;runc&lt;/code&gt; 配置文件的所有基本系统调用加上额外允许的 &lt;code&gt;uname&lt;/code&gt; 系统调用。
你还可以通过摘要（SHA256）来引用基本配置文件，使要被拉取的工件更为确定，
例如通过引用 &lt;code&gt;oci：//ghcr.io/security-profiles/runc@sha256: 380…&lt;/code&gt;。&lt;/p&gt;
&lt;!--
The operator internally caches pulled artifacts up to 24 hours for 1000
profiles, meaning that they will be refreshed after that time period, if the
cache is full or the operator daemon gets restarted.
--&gt;
&lt;p&gt;Operator 在内部缓存已拉取的工件，最多可缓存 1000 个配置文件 24 小时，
这意味着如果缓存已满、Operator 守护进程重启或超出给定时段后这些工件将被刷新。&lt;/p&gt;
&lt;!--
Because the overall resulting syscalls are hidden from the user (I only have the
`baseProfileName` listed in the SeccompProfile, and not the syscalls themselves), I&#39;ll additionally
annotate that SeccompProfile with the final `syscalls`.

Here&#39;s how the SeccompProfile looks after I annotate it:
--&gt;
&lt;p&gt;因为总体生成的系统调用对用户不可见
（我只列出了 SeccompProfile 中的 &lt;code&gt;baseProfileName&lt;/code&gt;，而没有列出系统调用本身），
所以我为该 SeccompProfile 的最终 &lt;code&gt;syscalls&lt;/code&gt; 添加了额外的注解。&lt;/p&gt;
&lt;p&gt;以下是我注解后的 SeccompProfile：&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;&amp;gt;&lt;/span&gt; kubectl describe seccompprofile &lt;span style=&#34;color:#a2f&#34;&gt;test&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Name:         test
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;Namespace:    security-profiles-operator
&lt;/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;Labels:       spo.x-k8s.io/profile-id=SeccompProfile-test
&lt;/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;Annotations:  syscalls:
&lt;/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;                [{&amp;#34;names&amp;#34;:[&amp;#34;arch_prctl&amp;#34;,&amp;#34;brk&amp;#34;,&amp;#34;capget&amp;#34;,&amp;#34;capset&amp;#34;,&amp;#34;chdir&amp;#34;,&amp;#34;clone&amp;#34;,&amp;#34;close&amp;#34;,...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;API Version:  security-profiles-operator.x-k8s.io/v1beta1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The SPO maintainers provide all public base profiles as part of the [“Security
Profiles” GitHub organization][org].
--&gt;
&lt;p&gt;SPO 维护者们作为 &lt;a href=&#34;https://github.com/orgs/security-profiles/packages&#34;&gt;“Security Profiles” GitHub 组织&lt;/a&gt; 的成员提供所有公开的基本配置文件。&lt;/p&gt;
&lt;!--
## Managing OCI security profiles

Alright, now the official SPO provides a bunch of base profiles, but how can I
define my own? Well, first of all we have to choose a working registry. There
are a bunch of registries that already supports OCI artifacts:
--&gt;
&lt;h2 id=&#34;managing-oci-security-profiles&#34;&gt;管理 OCI 安全配置文件  &lt;/h2&gt;
&lt;p&gt;好的，官方的 SPO 提供了许多基本配置文件，但是我如何定义自己的配置文件呢？
首先，我们必须选择一个可用的镜像仓库。有许多镜像仓库都已支持 OCI 工件：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/distribution/distribution&#34;&gt;CNCF Distribution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://aka.ms/acr&#34;&gt;Azure Container Registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://aws.amazon.com/ecr&#34;&gt;Amazon Elastic Container Registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cloud.google.com/artifact-registry&#34;&gt;Google Artifact Registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.github.com/en/packages/guides/about-github-container-registry&#34;&gt;GitHub Packages container registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://zotregistry.io&#34;&gt;Zot Registry&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The Security Profiles Operator ships a new command line interface called `spoc`,
which is a little helper tool for managing OCI profiles among doing various other
things which are out of scope of this blog post. But, the command `spoc push`
can be used to push a security profile to a registry:
--&gt;
&lt;p&gt;Security Profiles Operator 交付一个新的名为 &lt;code&gt;spoc&lt;/code&gt; 的命令行界面，
这是一个用于管理 OCI 配置文件的小型辅助工具，该工具提供的各项能力不在这篇博文的讨论范围内。
但 &lt;code&gt;spoc push&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;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#b8860b&#34;&gt;USERNAME&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;my-user
&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;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a2f&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#b8860b&#34;&gt;PASSWORD&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;my-pass
&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;&amp;gt;&lt;/span&gt; spoc push -f ./examples/baseprofile-crun.yaml ghcr.io/security-profiles/crun:v1.8.3
&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;16:35:43.899886 Pushing profile ./examples/baseprofile-crun.yaml to: ghcr.io/security-profiles/crun:v1.8.3
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:35:43.899939 Creating file store in: /tmp/push-3618165827
&lt;/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;16:35:43.899947 Adding profile to store: ./examples/baseprofile-crun.yaml
&lt;/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;16:35:43.900061 Packing files
&lt;/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;16:35:43.900282 Verifying reference: ghcr.io/security-profiles/crun:v1.8.3
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:35:43.900310 Using tag: v1.8.3
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:35:43.900313 Creating repository for ghcr.io/security-profiles/crun
&lt;/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;16:35:43.900319 Using username and password
&lt;/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;16:35:43.900321 Copying profile to repository
&lt;/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;16:35:46.976108 Signing container image
&lt;/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;Generating ephemeral keys...
&lt;/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;Retrieving signed certificate...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;        Note that there may be personally identifiable information associated with this signed artifact.
&lt;/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;        This may include the email address associated with the account with which you authenticate.
&lt;/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;        This information will be used for signing this artifact and will be stored in public transparency logs and cannot be removed later.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;By typing &amp;#39;y&amp;#39;, you attest that you grant (or have permission to grant) and agree to have this information stored permanently in transparency logs.
&lt;/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;Your browser will now be opened to:
&lt;/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;https://oauth2.sigstore.dev/auth/auth?access_type=…
&lt;/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;Successfully verified SCT...
&lt;/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;tlog entry created with index: 16520520
&lt;/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;Pushing signature to: ghcr.io/security-profiles/crun
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can see that the tool automatically signs the artifact and pushes the
`./examples/baseprofile-crun.yaml` to the registry, which is then directly ready
for usage within the SPO. If username and password authentication is required,
either use the `--username`, `-u` flag or export the `USERNAME` environment
variable. To set the password, export the `PASSWORD` environment variable.
--&gt;
&lt;p&gt;你可以看到该工具自动签署工件并将 &lt;code&gt;./examples/baseprofile-crun.yaml&lt;/code&gt; 推送到镜像仓库中，
然后直接可以在 SPO 中使用此文件。如果需要验证用户名和密码，则可以使用 &lt;code&gt;--username&lt;/code&gt;、
&lt;code&gt;-u&lt;/code&gt; 标志或导出 &lt;code&gt;USERNAME&lt;/code&gt; 环境变量。要设置密码，可以导出 &lt;code&gt;PASSWORD&lt;/code&gt; 环境变量。&lt;/p&gt;
&lt;!--
It is possible to add custom annotations to the security profile by using the
`--annotations` / `-a` flag multiple times in `KEY:VALUE` format. Those have no
effect for now, but at some later point additional features of the operator may
rely them.

The `spoc` client is also able to pull security profiles from OCI artifact
compatible registries. To do that, just run `spoc pull`:
--&gt;
&lt;p&gt;采用 &lt;code&gt;KEY:VALUE&lt;/code&gt; 的格式多次使用 &lt;code&gt;--annotations&lt;/code&gt; / &lt;code&gt;-a&lt;/code&gt; 标志，
可以为安全配置文件添加自定义注解。目前这些对安全配置文件没有影响，
但是在后续某个阶段，Operator 的其他特性可能会依赖于它们。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;spoc&lt;/code&gt; 客户端还可以从兼容 OCI 工件的镜像仓库中拉取安全配置文件。
要执行此操作，只需运行 &lt;code&gt;spoc pull&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;&amp;gt;&lt;/span&gt; spoc pull ghcr.io/security-profiles/runc:v1.1.5
&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;16:32:29.795597 Pulling profile from: ghcr.io/security-profiles/runc:v1.1.5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:32:29.795610 Verifying signature
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;Verification for ghcr.io/security-profiles/runc:v1.1.5 --
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;The following checks were performed on each of these signatures:
&lt;/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;  - Existence of the claims in the transparency log was verified offline
&lt;/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;  - The code-signing certificate was verified using trusted certificate authority certificates
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;[{&amp;#34;critical&amp;#34;:{&amp;#34;identity&amp;#34;:{&amp;#34;docker-reference&amp;#34;:&amp;#34;ghcr.io/security-profiles/runc&amp;#34;},…}}]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:32:33.208695 Creating file store in: /tmp/pull-3199397214
&lt;/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;16:32:33.208713 Verifying reference: ghcr.io/security-profiles/runc:v1.1.5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:32:33.208718 Creating repository for ghcr.io/security-profiles/runc
&lt;/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;16:32:33.208742 Using tag: v1.1.5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:32:33.208743 Copying profile from repository
&lt;/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;16:32:34.119652 Reading profile
&lt;/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;16:32:34.119677 Trying to unmarshal seccomp profile
&lt;/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;16:32:34.120114 Got SeccompProfile: runc-v1.1.5
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;16:32:34.120119 Saving profile in: /tmp/profile.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The profile can be now found in `/tmp/profile.yaml` or the specified output file
`--output-file` / `-o`. We can specify an username and password in the same way
as for `spoc push`.

`spoc` makes it easy to manage security profiles as OCI artifacts, which can be
then consumed directly by the operator itself.
--&gt;
&lt;p&gt;现在可以在 &lt;code&gt;/tmp/profile.yaml&lt;/code&gt; 或 &lt;code&gt;--output-file&lt;/code&gt; / &lt;code&gt;-o&lt;/code&gt; 所指定的输出文件中找到该配置文件。
我们可以像 &lt;code&gt;spoc push&lt;/code&gt; 一样指定用户名和密码。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;spoc&lt;/code&gt; 使得以 OCI 工件的形式管理安全配置文件变得非常容易，这些 OCI 工件可以由 Operator 本身直接使用。&lt;/p&gt;
&lt;!--
That was our compact journey through the latest possibilities of the Security
Profiles Operator! If you&#39;re interested in more, providing feedback or asking
for help, then feel free to get in touch with us directly via [Slack
(#security-profiles-operator)][slack] or [the mailing list][mail].
--&gt;
&lt;p&gt;本文简要介绍了通过 Security Profiles Operator 能够达成的各种最新可能性！
如果你有兴趣了解更多，无论是提出反馈还是寻求帮助，
请通过 &lt;a href=&#34;https://kubernetes.slack.com/messages/security-profiles-operator&#34;&gt;Slack (#security-profiles-operator)&lt;/a&gt; 或&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-dev&#34;&gt;邮件列表&lt;/a&gt;直接与我们联系。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>在边缘上玩转 seccomp 配置文件</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/18/seccomp-profiles-edge/</link>
      <pubDate>Thu, 18 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/18/seccomp-profiles-edge/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Having fun with seccomp profiles on the edge&#34;
date: 2023-05-18
slug: seccomp-profiles-edge
--&gt;
&lt;!--
**Author**: Sascha Grunert
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;: Sascha Grunert&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;!--
The [Security Profiles Operator (SPO)][spo] is a feature-rich
[operator][operator] for Kubernetes to make managing seccomp, SELinux and
AppArmor profiles easier than ever. Recording those profiles from scratch is one
of the key features of this operator, which usually involves the integration
into large CI/CD systems. Being able to test the recording capabilities of the
operator in edge cases is one of the recent development efforts of the SPO and
makes it excitingly easy to play around with seccomp profiles.
--&gt;
&lt;p&gt;[Security Profiles Operator (SPO)][spo] 是一个功能丰富的 Kubernetes [operator][operator]，
相比以往可以简化 seccomp、SELinux 和 AppArmor 配置文件的管理。
从头开始记录这些配置文件是该 Operator 的关键特性之一，这通常涉及与大型 CI/CD 系统集成。
在边缘场景中测试 Operator 的记录能力是 SPO 的最新开发工作之一，
非常有助于轻松玩转 seccomp 配置文件。&lt;/p&gt;
&lt;!--
## Recording seccomp profiles with `spoc record`

The [v0.8.0][spo-latest] release of the Security Profiles Operator shipped a new
command line interface called `spoc`, a little helper tool for recording and
replaying seccomp profiles among various other things that are out of scope of
this blog post.
--&gt;
&lt;h2 id=&#34;使用-spoc-record-记录-seccomp-配置文件&#34;&gt;使用 &lt;code&gt;spoc record&lt;/code&gt; 记录 seccomp 配置文件&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator/releases/v0.8.0&#34;&gt;v0.8.0&lt;/a&gt; 版本的 Security Profiles Operator 附带一个名为 &lt;code&gt;spoc&lt;/code&gt; 的全新命令行接口，
是一个能够用来记录和回放 seccomp 配置文件的工具，该工具还有一些其他能力不在这篇博文的讨论范围内。&lt;/p&gt;
&lt;!--
Recording a seccomp profile requires a binary to be executed, which can be a
simple golang application which just calls [`uname(2)`][uname]:
--&gt;
&lt;p&gt;记录 seccomp 配置文件需要执行一个二进制文件，这个二进制文件可以是一个仅只调用
&lt;a href=&#34;https://man7.org/linux/man-pages/man2/uname.2.html&#34;&gt;&lt;code&gt;uname(2)&lt;/code&gt;&lt;/a&gt; 的简单 Golang 应用程序：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;package&lt;/span&gt; main
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;syscall&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;func&lt;/span&gt; &lt;span style=&#34;color:#00a000&#34;&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	utsname &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; syscall.Utsname{}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;if&lt;/span&gt; err &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; syscall.&lt;span style=&#34;color:#00a000&#34;&gt;Uname&lt;/span&gt;(&lt;span style=&#34;color:#666&#34;&gt;&amp;amp;&lt;/span&gt;utsname); err &lt;span style=&#34;color:#666&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;nil&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#a2f&#34;&gt;panic&lt;/span&gt;(err)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Building a binary from that code can be done by:
--&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:#000080;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; go build -o main main.go
&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;&amp;gt;&lt;/span&gt; ldd ./main
&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;        not a dynamic executable
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Now it&#39;s possible to download the latest binary of [`spoc` from
GitHub][spoc-latest] and run the application on Linux with it:
--&gt;
&lt;p&gt;现在可以从 GitHub 下载最新的 &lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator/releases/download/v0.8.0/spoc.amd64&#34;&gt;&lt;code&gt;spoc&lt;/code&gt;&lt;/a&gt; 二进制文件，
并使用它在 Linux 上运行应用程序：&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;&amp;gt;&lt;/span&gt; sudo ./spoc record ./main
&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;10:08:25.591945 Loading bpf module
&lt;/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;10:08:25.591958 Using system btf 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;libbpf: loading object &amp;#39;recorder.bpf.o&amp;#39; from buffer
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;…
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;libbpf: prog &amp;#39;sys_enter&amp;#39;: relo #3: patched insn #22 (ALU/ALU64) imm 16 -&amp;gt; 16
&lt;/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;10:08:25.610767 Getting bpf program sys_enter
&lt;/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;10:08:25.610778 Attaching bpf tracepoint
&lt;/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;10:08:25.611574 Getting syscalls map
&lt;/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;10:08:25.611582 Getting pid_mntns map
&lt;/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;10:08:25.613097 Module successfully loaded
&lt;/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;10:08:25.613311 Processing events
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;10:08:25.613693 Running command with PID: 336007
&lt;/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;10:08:25.613835 Received event: pid: 336007, mntns: 4026531841
&lt;/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;10:08:25.613951 No container ID found for PID (pid=336007, mntns=4026531841, err=unable to find container ID in cgroup path)
&lt;/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;10:08:25.614856 Processing recorded data
&lt;/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;10:08:25.614975 Found process mntns 4026531841 in bpf map
&lt;/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;10:08:25.615110 Got syscalls: read, close, mmap, rt_sigaction, rt_sigprocmask, madvise, nanosleep, clone, uname, sigaltstack, arch_prctl, gettid, futex, sched_getaffinity, exit_group, openat
&lt;/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;10:08:25.615195 Adding base syscalls: access, brk, capget, capset, chdir, chmod, chown, close_range, dup2, dup3, epoll_create1, epoll_ctl, epoll_pwait, execve, faccessat2, fchdir, fchmodat, fchown, fchownat, fcntl, fstat, fstatfs, getdents64, getegid, geteuid, getgid, getpid, getppid, getuid, ioctl, keyctl, lseek, mkdirat, mknodat, mount, mprotect, munmap, newfstatat, openat2, pipe2, pivot_root, prctl, pread64, pselect6, readlink, readlinkat, rt_sigreturn, sched_yield, seccomp, set_robust_list, set_tid_address, setgid, setgroups, sethostname, setns, setresgid, setresuid, setsid, setuid, statfs, statx, symlinkat, tgkill, umask, umount2, unlinkat, unshare, write
&lt;/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;10:08:25.616293 Wrote seccomp profile to: /tmp/profile.yaml
&lt;/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;10:08:25.616298 Unloading bpf module
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
I have to execute `spoc` as root because it will internally run an [ebpf][ebpf]
program by reusing the same code parts from the Security Profiles Operator
itself. I can see that the bpf module got loaded successfully and `spoc`
attached the required tracepoint to it. Then it will track the main application
by using its [mount namespace][mntns] and process the recorded syscall data. The
nature of ebpf programs is that they see the whole context of the Kernel, which
means that `spoc` tracks all syscalls of the system, but does not interfere with
their execution.
--&gt;
&lt;p&gt;我必须以 root 用户身份执行 &lt;code&gt;spoc&lt;/code&gt;，因为它将在内部通过复用 Security Profiles Operator
自身的相同代码，运行一个 &lt;a href=&#34;https://ebpf.io&#34;&gt;ebpf&lt;/a&gt; 程序。
我可以看到 bpf 模块已成功加载，并且 &lt;code&gt;spoc&lt;/code&gt; 已将所需的跟踪点附加到该模块。
随后该模块将使用其&lt;a href=&#34;https://man7.org/linux/man-pages/man7/mount_namespaces.7.html&#34;&gt;挂载命名空间&lt;/a&gt;跟踪主应用程序并处理记录的系统调用数据。
ebpf 程序的本质是监视整个内核的上下文，这意味着 &lt;code&gt;spoc&lt;/code&gt; 跟踪系统的所有系统调用，但不会干涉其执行过程。&lt;/p&gt;
&lt;!--
The logs indicate that `spoc` found the syscalls `read`, `close`,
`mmap` and so on, including `uname`. All other syscalls than `uname` are coming
from the golang runtime and its garbage collection, which already adds overhead
to a basic application like in our demo. I can also see from the log line
`Adding base syscalls: …` that `spoc` adds a bunch of base syscalls to the
resulting profile. Those are used by the OCI runtime (like [runc][runc] or
[crun][crun]) in order to be able to run a container. This means that `spoc`
can be used to record seccomp profiles which then can be containerized directly.
This behavior can be disabled in `spoc` by using the `--no-base-syscalls`/`-n`
or customized via the `--base-syscalls`/`-b` command line flags. This can be
helpful in cases where different OCI runtimes other than crun and runc are used,
or if I just want to record the seccomp profile for the application and stack
it with another [base profile][base].
--&gt;
&lt;p&gt;这些日志表明 &lt;code&gt;spoc&lt;/code&gt; 发现了包括 &lt;code&gt;uname&lt;/code&gt; 在内的 &lt;code&gt;read&lt;/code&gt;、&lt;code&gt;close&lt;/code&gt;、&lt;code&gt;mmap&lt;/code&gt; 等系统调用。
除 &lt;code&gt;uname&lt;/code&gt; 之外的所有系统调用都来自 Golang 运行时及其垃圾回收，这已经为我们演示中的简单应用增加了开销。
我还可以从日志行 &lt;code&gt;Adding base syscalls: …&lt;/code&gt; 中看到 &lt;code&gt;spoc&lt;/code&gt; 将一堆基本系统调用添加到了生成的配置文件中。
这些系统调用由 OCI 运行时（如 &lt;a href=&#34;https://github.com/opencontainers/runc&#34;&gt;runc&lt;/a&gt; 或 &lt;a href=&#34;https://github.com/containers/crun&#34;&gt;crun&lt;/a&gt;）使用以便能够运行容器。
这意味着 &lt;code&gt;spoc&lt;/code&gt; 可用于记录可直接被容器化的 seccomp 配置文件。
这种行为可以通过在 &lt;code&gt;spoc&lt;/code&gt; 中使用 &lt;code&gt;--no-base-syscalls&lt;/code&gt;/&lt;code&gt;-n&lt;/code&gt; 禁用，或通过
&lt;code&gt;--base-syscalls&lt;/code&gt;/&lt;code&gt;-b&lt;/code&gt; 命令行标志进行自定义。这对于使用除了 crun 和 runc 之外的不同 OCI
运行时或者如果我只想记录应用的 seccomp 配置文件并将其与另一个&lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator/blob/35ebdda/installation-usage.md#base-syscalls-for-a-container-runtime&#34;&gt;基本配置文件&lt;/a&gt;组合时非常有帮助。&lt;/p&gt;
&lt;!--
The resulting profile is now available in `/tmp/profile.yaml`, but the default
location can be changed using the `--output-file value`/`-o` flag:
--&gt;
&lt;p&gt;生成的配置文件现在位于 &lt;code&gt;/tmp/profile.yaml&lt;/code&gt;，
但可以使用 &lt;code&gt;--output-file value&lt;/code&gt;/&lt;code&gt;-o&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;&amp;gt;&lt;/span&gt; cat /tmp/profile.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;security-profiles-operator.x-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;SeccompProfile&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;creationTimestamp&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;null&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;main&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;architectures&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- SCMP_ARCH_X86_64&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;defaultAction&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;SCMP_ACT_ERRNO&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;syscalls&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;SCMP_ACT_ALLOW&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;names&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- access&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- arch_prctl&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;- brk&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#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;- uname&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#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;status&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;{}&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The seccomp profile Custom Resource Definition (CRD) can be directly used
together with the Security Profiles Operator for managing it within Kubernetes.
`spoc` is also capable of producing raw seccomp profiles (as JSON), by using the
`--type`/`-t` `raw-seccomp` flag:
--&gt;
&lt;p&gt;seccomp 配置文件 CRD 可直接与 Security Profiles Operator 一起使用，统一在 Kubernetes 中进行管理。
&lt;code&gt;spoc&lt;/code&gt; 还可以通过使用 &lt;code&gt;--type&lt;/code&gt;/&lt;code&gt;-t&lt;/code&gt; &lt;code&gt;raw-seccomp&lt;/code&gt; 标志生成原始的 seccomp 配置文件（格式为 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-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;&amp;gt;&lt;/span&gt; sudo ./spoc record --type raw-seccomp ./main
&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;52.628827 Wrote seccomp profile to: /tmp/profile.json
&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-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;&amp;gt;&lt;/span&gt; jq . /tmp/profile.json
&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-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;defaultAction&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;SCMP_ACT_ERRNO&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;architectures&amp;#34;&lt;/span&gt;: [&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;SCMP_ARCH_X86_64&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;syscalls&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;names&amp;#34;&lt;/span&gt;: [&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;access&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;…&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;write&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;action&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;SCMP_ACT_ALLOW&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;!--
The utility `spoc record` allows us to record complex seccomp profiles directly
from binary invocations in any Linux system which is capable of running the ebpf
code within the Kernel. But it can do more: How about modifying the seccomp
profile and then testing it by using `spoc run`.
--&gt;
&lt;p&gt;实用程序 &lt;code&gt;spoc record&lt;/code&gt; 允许我们直接在任何能够在内核中运行 ebpf 代码的 Linux
系统上记录复杂的 seccomp 配置文件。但它还可以做更多事情：
例如修改 seccomp 配置文件并使用 &lt;code&gt;spoc run&lt;/code&gt; 进行测试。&lt;/p&gt;
&lt;!--
## Running seccomp profiles with `spoc run`

`spoc` is also able to run binaries with applied seccomp profiles, making it
easy to test any modification to it. To do that, just run:
--&gt;
&lt;h2 id=&#34;使用-spoc-run-运行-seccomp-配置文件&#34;&gt;使用 &lt;code&gt;spoc run&lt;/code&gt; 运行 seccomp 配置文件&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;spoc&lt;/code&gt; 还能够使用 seccomp 配置文件来运行二进制文件，轻松测试对其所做的任何修改。
要执行此操作，只需运行：&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;&amp;gt;&lt;/span&gt; sudo ./spoc run ./main
&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;10:29:58.153263 Reading file /tmp/profile.yaml
&lt;/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;10:29:58.153311 Assuming YAML profile
&lt;/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;10:29:58.154138 Setting up seccomp
&lt;/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;10:29:58.154178 Load seccomp profile
&lt;/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;10:29:58.154189 Starting audit log enricher
&lt;/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;10:29:58.154224 Enricher reading from file /var/log/audit/audit.log
&lt;/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;10:29:58.155356 Running command with PID: 437880
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
It looks like that the application exited successfully, which is anticipated
because I did not modify the previously recorded profile yet. I can also
specify a custom location for the profile by using the `--profile`/`-p` flag,
but this was not necessary because I did not modify the default output location
from the record. `spoc` will automatically determine if it&#39;s a raw (JSON) or CRD
(YAML) based seccomp profile and then apply it to the process.
--&gt;
&lt;p&gt;看起来应用程序已成功退出，这是符合预期的，因为我尚未修改先前记录的配置文件。
我还可以使用 &lt;code&gt;--profile&lt;/code&gt;/&lt;code&gt;-p&lt;/code&gt; 标志指定配置文件的自定义位置，但这并不是必需的，
因为我没有修改默认输出位置。&lt;code&gt;spoc&lt;/code&gt; 将自动确定它是基于原始的（JSON）还是基于 CRD 的
（YAML）seccomp 配置文件，然后将其应用于该进程。&lt;/p&gt;
&lt;!--
The Security Profiles Operator supports a [log enricher feature][enricher],
which provides additional seccomp related information by parsing the audit logs.
`spoc run` uses the enricher in the same way to provide more data to the end
users when it comes to debugging seccomp profiles.
--&gt;
&lt;p&gt;Security Profiles Operator 支持 &lt;a href=&#34;https://github.com/kubernetes-sigs/security-profiles-operator/blob/35ebdda/installation-usage.md#using-the-log-enricher&#34;&gt;log enricher 特性&lt;/a&gt;，
通过解析审计日志提供与 seccomp 相关的额外信息。
&lt;code&gt;spoc run&lt;/code&gt; 以同样的方式使用 enricher 向最终用户提供更多数据以调试 seccomp 配置文件。&lt;/p&gt;
&lt;!--
Now I have to modify the profile to see anything valuable in the output. For
example, I could remove the allowed `uname` syscall:
--&gt;
&lt;p&gt;现在我不得不修改配置文件来查看输出中有价值的信息。
例如，我可以移除允许的 &lt;code&gt;uname&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;&amp;gt;&lt;/span&gt; jq &lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;del(.syscalls[0].names[] | select(. == &amp;#34;uname&amp;#34;))&amp;#39;&lt;/span&gt; /tmp/profile.json &amp;gt; /tmp/no-uname-profile.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
And then try to run it again with the new profile `/tmp/no-uname-profile.json`:
--&gt;
&lt;p&gt;然后尝试用新的配置文件 &lt;code&gt;/tmp/no-uname-profile.json&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;&amp;gt;&lt;/span&gt; sudo ./spoc run -p /tmp/no-uname-profile.json ./main
&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;10:39:12.707798 Reading file /tmp/no-uname-profile.json
&lt;/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;10:39:12.707892 Setting up seccomp
&lt;/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;10:39:12.707920 Load seccomp profile
&lt;/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;10:39:12.707982 Starting audit log enricher
&lt;/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;10:39:12.707998 Enricher reading from file /var/log/audit/audit.log
&lt;/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;10:39:12.709164 Running command with PID: 480512
&lt;/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;panic: operation not permitted
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#888&#34;&gt;goroutine 1 [running]:
&lt;/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;main.main()
&lt;/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;        /path/to/main.go:10 +0x85
&lt;/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;10:39:12.713035 Unable to run: launch runner: wait for command: exit status 2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Alright, that was expected! The applied seccomp profile blocks the `uname`
syscall, which results in an &#34;operation not permitted&#34; error. This error is
pretty generic and does not provide any hint on what got blocked by seccomp.
It is generally extremely difficult to predict how applications behave if single
syscalls are forbidden by seccomp. It could be possible that the application
terminates like in our simple demo, but it could also lead to a strange
misbehavior and the application does not stop at all.
--&gt;
&lt;p&gt;好的，这符合预期！应用的 seccomp 配置文件阻止了 &lt;code&gt;uname&lt;/code&gt; 系统调用，导致出现
&amp;quot;operation not permitted&amp;quot; 错误。此错误提示过于宽泛，没有提供关于 seccomp 阻止了什么的任何提示。
通常情况下，如果 seccomp 禁止某个系统调用，很难预测应用程序会做出什么行为。
可能应用程序像这个简单演示一样终止，但也可能导致奇怪的异常行为使得应用程序根本无法停止。&lt;/p&gt;
&lt;!--
If I now change the default seccomp action of the profile from `SCMP_ACT_ERRNO`
to `SCMP_ACT_LOG` like this:
--&gt;
&lt;p&gt;现在，如果我将配置文件的默认 seccomp 操作从 &lt;code&gt;SCMP_ACT_ERRNO&lt;/code&gt; 更改为 &lt;code&gt;SCMP_ACT_LOG&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;&amp;gt;&lt;/span&gt; jq &lt;span style=&#34;color:#b44&#34;&gt;&amp;#39;.defaultAction = &amp;#34;SCMP_ACT_LOG&amp;#34;&amp;#39;&lt;/span&gt; /tmp/no-uname-profile.json &amp;gt; /tmp/no-uname-profile-log.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Then the log enricher will give us a hint that the `uname` syscall got blocked
when using `spoc run`:
--&gt;
&lt;p&gt;那么 log enricher 将提示我们 &lt;code&gt;uname&lt;/code&gt; 系统调用在使用 &lt;code&gt;spoc run&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;&amp;gt;&lt;/span&gt; sudo ./spoc run -p /tmp/no-uname-profile-log.json ./main
&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;10:48:07.470126 Reading file /tmp/no-uname-profile-log.json
&lt;/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;10:48:07.470234 Setting up seccomp
&lt;/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;10:48:07.470245 Load seccomp profile
&lt;/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;10:48:07.470302 Starting audit log enricher
&lt;/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;10:48:07.470339 Enricher reading from file /var/log/audit/audit.log
&lt;/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;10:48:07.470889 Running command with PID: 522268
&lt;/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;10:48:07.472007 Seccomp: uname (63)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The application will not terminate any more, but seccomp will log the behavior
to `/var/log/audit/audit.log` and `spoc` will parse the data to correlate it
directly to our program. Generating the log messages to the audit subsystem
comes with a large performance overhead and should be handled with care in
production systems. It also comes with a security risk when running untrusted
apps in audit mode in production environments.
--&gt;
&lt;p&gt;应用程序现在不会再终止，但 seccomp 将行为记录到 &lt;code&gt;/var/log/audit/audit.log&lt;/code&gt; 中，
而 &lt;code&gt;spoc&lt;/code&gt; 会解析数据以将其直接与我们的程序相关联。将日志消息生成到审计子系统中会带来巨大的性能开销，
在生产系统中应小心处理。当在生产环境中以审计模式运行不受信任的应用时，也会带来安全风险。&lt;/p&gt;
&lt;!--
This demo should give you an impression how to debug seccomp profile issues with
applications, probably by using our shiny new helper tool powered by the
features of the Security Profiles Operator. `spoc` is a flexible and portable
binary suitable for edge cases where resources are limited and even Kubernetes
itself may not be available with its full capabilities.
--&gt;
&lt;p&gt;本文的演示希望让你了解如何使用 Security Profiles Operator
各项特性所赋予的全新辅助工具来调试应用程序的 seccomp 配置文件问题。
&lt;code&gt;spoc&lt;/code&gt; 是一个灵活且可移植的二进制文件，适用于资源有限的边缘场景，
甚至是 Kubernetes 本身可能无法提供其全部功能的场景中。&lt;/p&gt;
&lt;!--
Thank you for reading this blog post! If you&#39;re interested in more, providing
feedback or asking for help, then feel free to get in touch with us directly via
[Slack (#security-profiles-operator)][slack] or the [mailing list][mail].
--&gt;
&lt;p&gt;感谢阅读这篇博文！如果你有兴趣了解更多，想提出反馈或寻求帮助，请通过
&lt;a href=&#34;https://kubernetes.slack.com/messages/security-profiles-operator&#34;&gt;Slack (#security-profiles-operator)&lt;/a&gt; 或&lt;a href=&#34;https://groups.google.com/forum/#!forum/kubernetes-dev&#34;&gt;邮件列表&lt;/a&gt;直接与我们联系。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27: KMS V2 进入 Beta 阶段</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/16/kms-v2-moves-to-beta/</link>
      <pubDate>Tue, 16 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/16/kms-v2-moves-to-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: KMS V2 Moves to Beta&#34;
date: 2023-05-16
slug: kms-v2-moves-to-beta
--&gt;
&lt;!--
**Authors:** Anish Ramasekar, Mo Khan, and Rita Zhang (Microsoft)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Anish Ramasekar, Mo Khan, and Rita Zhang (Microsoft)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
With Kubernetes 1.27, we (SIG Auth) are moving Key Management Service (KMS) v2 API to beta.
--&gt;
&lt;p&gt;在 Kubernetes 1.27 中，我们（SIG Auth）将密钥管理服务（KMS）v2 API 带入 Beta 阶段。&lt;/p&gt;
&lt;!--
## What is KMS?
One of the first things to consider when securing a Kubernetes cluster is encrypting etcd data at
rest. KMS provides an interface for a provider to utilize a key stored in an external key service to
perform this encryption.
--&gt;
&lt;h2 id=&#34;kms-是什么&#34;&gt;KMS 是什么？&lt;/h2&gt;
&lt;p&gt;保护 Kubernetes 集群时首先要考虑的事情之一是加密静态的 etcd 数据。
KMS 为供应商提供了一个接口，以便利用存储在外部密钥服务中的密钥来执行此加密。&lt;/p&gt;
&lt;!--
KMS v1 has been a feature of Kubernetes since version 1.10, and is currently in beta as of version
v1.12. KMS v2 was introduced as alpha in v1.25.
--&gt;
&lt;p&gt;KMS v1 自 1.10 版以来一直是 Kubernetes 的一项功能特性，该特性从 v1.12
版开始处于 Beta 阶段。KMS v2 在 v1.25 中作为 Alpha 特性引入。&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;!--
The KMS v2 API and implementation changed in incompatible
ways in-between the alpha release in v1.25 and the beta release in v1.27. The design of KMS v2 has
changed since [the previous blog post](https://kubernetes.io/blog/2022/09/09/kms-v2-improvements/)
was written and it is not compatible with the design in this blog post. Attempting to upgrade from
old versions with the alpha feature enabled will result in data loss.
--&gt;
&lt;p&gt;KMS v2 API 与实现在 v1.25 的 Alpha 版本和 v1.27 的 Beta 版本之间发生了一些不兼容的变化。
自&lt;a href=&#34;https://kubernetes.io/blog/2022/09/09/kms-v2-improvements/&#34;&gt;上一篇博文&lt;/a&gt;撰写以来，
KMS v2 的设计发生了变化，与本博文中的设计不兼容。如果尝试从启用了 Alpha 特性的旧版本升级到
Beta 版本，将会导致数据丢失。

&lt;/div&gt;

&lt;!--
## What’s new in `v2beta1`?
The KMS encryption provider uses an envelope encryption scheme to encrypt data in etcd. The data is
encrypted using a data encryption key (DEK). The DEKs are encrypted with a key encryption key (KEK)
that is stored and managed in a remote KMS. With KMS v1, a new DEK is generated for each encryption.
With KMS v2, a new DEK is only generated on server startup and when the KMS plugin informs the API
server that a KEK rotation has occurred.
--&gt;
&lt;h2 id=&#34;v2beta1-有什么新内容&#34;&gt;&lt;code&gt;v2beta1&lt;/code&gt; 有什么新内容？&lt;/h2&gt;
&lt;p&gt;KMS 加密驱动使用信封加密方式来加密 etcd 中的数据，使用数据加密密钥（DEK）对数据进行加密。
DEK 使用在远程 KMS 中存储和管理的密钥加密密钥（KEK）进行加密。
使用 KMS v1，每次加密都会生成一个新的 DEK。
使用 KMS v2，只有在服务器启动时且 KMS 插件通知 API 服务器发生 KEK 轮换时才会生成新的 DEK。&lt;/p&gt;


&lt;div class=&#34;alert alert-warning&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;alert-heading&#34;&gt;警告&lt;/h4&gt;

    &lt;!--
If you are running virtual machine (VM) based nodes
that leverage VM state store with this feature, you must not use KMS v2.

With KMS v2, the API server uses AES-GCM with a 12 byte nonce (8 byte atomic counter and 4 bytes
random data) for encryption. The following issues could occur if the VM is saved and restored:
--&gt;
&lt;p&gt;如果你运行的是虚拟机（VM）节点，其中启用此特性的节点使用了 VM 的状态存储，
则不得使用 KMS v2。&lt;/p&gt;
&lt;p&gt;对于 KMS v2，API 服务器使用带有 12 字节随机数（8 字节原子计数器和 4 字节随机数据）的
AES-GCM 进行加密。在保存和恢复虚拟机时，可能会出现以下问题：&lt;/p&gt;
&lt;!--
1. The counter value may be lost or corrupted if the VM is saved in an inconsistent state or
   restored improperly. This can lead to a situation where the same counter value is used twice,
   resulting in the same nonce being used for two different messages.
2. If the VM is restored to a previous state, the counter value may be set back to its previous
   value, resulting in the same nonce being used again.
--&gt;
&lt;ol&gt;
&lt;li&gt;如果 VM 的保存状态不一致或其恢复不正确，计数器值可能会丢失或损坏。
这可能会导致系统再次使用同一计数器值，进而在两个不同的消息中使用相同的随机数。&lt;/li&gt;
&lt;li&gt;如果 VM 恢复到以前的状态，则计数器值可能会设置回其以前的值，
导致再次使用相同的随机数。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Although both of these cases are partially mitigated by the 4 byte random nonce, this can compromise
the security of the encryption.
--&gt;
&lt;p&gt;虽然这两种情况都可以通过 4 字节随机数部分缓解，但这仍可能会危及加密的安全性。&lt;/p&gt;


&lt;/div&gt;

&lt;!--
### Sequence Diagram

#### Encrypt Request
--&gt;
&lt;h3 id=&#34;时序图&#34;&gt;时序图&lt;/h3&gt;
&lt;h4 id=&#34;加密请求&#34;&gt;加密请求&lt;/h4&gt;
&lt;!-- source
```mermaid
%%{init:{&#34;theme&#34;:&#34;neutral&#34;, &#34;sequence&#34;: {&#34;mirrorActors&#34;:true},
    &#34;themeVariables&#34;: {
        &#34;actorBkg&#34;:&#34;royalblue&#34;,
        &#34;actorTextColor&#34;:&#34;white&#34;
}}}%%

sequenceDiagram
    participant user
    participant kube_api_server
    participant kms_plugin
    participant external_kms
    alt Generate DEK at startup
        Note over kube_api_server,external_kms: Refer to Generate Data Encryption Key (DEK) diagram for details
    end
    user-&gt;&gt;kube_api_server: create/update resource that&#39;s to be encrypted
    kube_api_server-&gt;&gt;kube_api_server: encrypt resource with DEK
    kube_api_server-&gt;&gt;etcd: store encrypted object
```
--&gt;
&lt;!--

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-encryption.svg&#34;
         alt=&#34;Sequence diagram for KMSv2 beta Encrypt&#34;/&gt; 
&lt;/figure&gt;

--&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-encryption.svg&#34;
         alt=&#34;KMSv2 Beta 加密的序列图&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
#### Decrypt Request
--&gt;
&lt;h4 id=&#34;解密请求&#34;&gt;解密请求&lt;/h4&gt;
&lt;!-- source
```mermaid
%%{init:{&#34;theme&#34;:&#34;neutral&#34;, &#34;sequence&#34;: {&#34;mirrorActors&#34;:true},
    &#34;themeVariables&#34;: {
        &#34;actorBkg&#34;:&#34;royalblue&#34;,
        &#34;actorTextColor&#34;:&#34;white&#34;
}}}%%

sequenceDiagram
    participant user
    participant kube_api_server
    participant kms_plugin
    participant external_kms
    participant etcd
    user-&gt;&gt;kube_api_server: get/list resource that&#39;s encrypted
    kube_api_server-&gt;&gt;etcd: get encrypted resource
    etcd-&gt;&gt;kube_api_server: encrypted resource
    alt Encrypted DEK not in cache
        kube_api_server-&gt;&gt;kms_plugin: decrypt request
        kms_plugin-&gt;&gt;external_kms: decrypt DEK with remote KEK
        external_kms-&gt;&gt;kms_plugin: decrypted DEK
        kms_plugin-&gt;&gt;kube_api_server: return decrypted DEK
        kube_api_server-&gt;&gt;kube_api_server: cache decrypted DEK
    end
    kube_api_server-&gt;&gt;kube_api_server: decrypt resource with DEK
    kube_api_server-&gt;&gt;user: return decrypted resource
```
--&gt;
&lt;!--

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-decryption.svg&#34;
         alt=&#34;Sequence diagram for KMSv2 beta Decrypt&#34;/&gt; 
&lt;/figure&gt;

--&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-decryption.svg&#34;
         alt=&#34;KMSv2 Beta 解密的序列图&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
#### Status Request
--&gt;
&lt;h4 id=&#34;状态请求&#34;&gt;状态请求&lt;/h4&gt;
&lt;!-- source
```mermaid
%%{init:{&#34;theme&#34;:&#34;neutral&#34;, &#34;sequence&#34;: {&#34;mirrorActors&#34;:true},
    &#34;themeVariables&#34;: {
        &#34;actorBkg&#34;:&#34;royalblue&#34;,
        &#34;actorTextColor&#34;:&#34;white&#34;
}}}%%

sequenceDiagram
    participant kube_api_server
    participant kms_plugin
    participant external_kms
    alt Generate DEK at startup
        Note over kube_api_server,external_kms: Refer to Generate Data Encryption Key (DEK) diagram for details
    end
    loop every minute (or every 10s if error or unhealthy)
        kube_api_server-&gt;&gt;kms_plugin: status request
        kms_plugin-&gt;&gt;external_kms: validate remote KEK
        external_kms-&gt;&gt;kms_plugin: KEK status
        kms_plugin-&gt;&gt;kube_api_server: return status response &lt;br/&gt; {&#34;healthz&#34;: &#34;ok&#34;, key_id: &#34;&lt;remote KEK ID&gt;&#34;, &#34;version&#34;: &#34;v2beta1&#34;}
        alt KEK rotation detected (key_id changed), rotate DEK
            Note over kube_api_server,external_kms: Refer to Generate Data Encryption Key (DEK) diagram for details
        end
    end
```
--&gt;
&lt;!--

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-status.svg&#34;
         alt=&#34;Sequence diagram for KMSv2 beta Status&#34;/&gt; 
&lt;/figure&gt;

--&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-status.svg&#34;
         alt=&#34;KMSv2 Beta 状态的序列图&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
#### Generate Data Encryption Key (DEK)
--&gt;
&lt;h4 id=&#34;生成数据加密密钥-dke&#34;&gt;生成数据加密密钥（DKE）&lt;/h4&gt;
&lt;!-- source
```mermaid
%%{init:{&#34;theme&#34;:&#34;neutral&#34;, &#34;sequence&#34;: {&#34;mirrorActors&#34;:true},
    &#34;themeVariables&#34;: {
        &#34;actorBkg&#34;:&#34;royalblue&#34;,
        &#34;actorTextColor&#34;:&#34;white&#34;
}}}%%

sequenceDiagram
    participant kube_api_server
    participant kms_plugin
    participant external_kms
        kube_api_server-&gt;&gt;kube_api_server: generate DEK
        kube_api_server-&gt;&gt;kms_plugin: encrypt request
        kms_plugin-&gt;&gt;external_kms: encrypt DEK with remote KEK
        external_kms-&gt;&gt;kms_plugin: encrypted DEK
        kms_plugin-&gt;&gt;kube_api_server: return encrypt response &lt;br/&gt; {&#34;ciphertext&#34;: &#34;&lt;encrypted DEK&gt;&#34;, key_id: &#34;&lt;remote KEK ID&gt;&#34;, &#34;annotations&#34;: {}}
```
--&gt;
&lt;!--

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-generate-dek.svg&#34;
         alt=&#34;Sequence diagram for KMSv2 beta Generate DEK&#34;/&gt; 
&lt;/figure&gt;

--&gt;

&lt;figure class=&#34;diagram-large&#34;&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/images/blog/2023-05-16-kubernetes-1.27-kmsv2-beta/kubernetes-1.27-generate-dek.svg&#34;
         alt=&#34;KMSv2 Beta 生成 DEK 的序列图&#34;/&gt; 
&lt;/figure&gt;

&lt;!--
### Performance Improvements
With KMS v2, we have made significant improvements to the performance of the KMS encryption
provider. In case of KMS v1, a new DEK is generated for every encryption. This means that for every
write request, the API server makes a call to the KMS plugin to encrypt the DEK using the remote
KEK. The API server also has to cache the DEKs to avoid making a call to the KMS plugin for every
read request. When the API server restarts, it has to populate the cache by making a call to the KMS
plugin for every DEK in the etcd store based on the cache size. This is a significant overhead for
the API server. With KMS v2, the API server generates a DEK at startup and caches it. The API server
also makes a call to the KMS plugin to encrypt the DEK using the remote KEK. This is a one-time call
at startup and on KEK rotation. The API server then uses the cached DEK to encrypt the resources.
This reduces the number of calls to the KMS plugin and improves the overall latency of the API
server requests.
--&gt;
&lt;h3 id=&#34;性能改进&#34;&gt;性能改进&lt;/h3&gt;
&lt;p&gt;在 KMS v2 中，我们对 KMS 加密提供程序的性能进行了重大改进。对于 KMS v1，
每次加密都会生成一个新的 DEK。这意味着对于每个写入请求，API 服务器都会调用
KMS 插件以使用远程 KEK 加密 DEK。为避免每个读取请求都会调用 KMS 插件，
API 服务器必须缓存 DEK。当 API 服务器重新启动时，
它必须根据缓存大小为 etcd 存储中的每个 DEK 调用 KMS 插件来填充缓存。
这对 API 服务器来说是一个很大的开销。使用 KMS v2，API 服务器在启动时生成一个 DEK 并将其缓存。
API 服务器还调用 KMS 插件以使用远程 KEK 加密 DEK。这是启动时和 KEK 轮换时的一次性调用。
在此之后，API 服务器使用缓存的 DEK 来加密资源。这样做减少了对 KMS 插件的调用次数，
并改善了 API 服务器请求的整体延迟。&lt;/p&gt;
&lt;!--
We conducted a test that created 12k secrets and measured the time taken for the API server to
encrypt the resources. The metric used was
[`apiserver_storage_transformation_duration_seconds`](https://kubernetes.io/docs/reference/instrumentation/metrics/).
For KMS v1, the test was run on a managed Kubernetes v1.25 cluster with 2 nodes. There was no
additional load on the cluster during the test. For KMS v2, the test was run in the Kubernetes CI
environment with the following [cluster
configuration](https://github.com/kubernetes/kubernetes/blob/release-1.27/test/e2e/testing-manifests/auth/encrypt/kind.yaml).
--&gt;
&lt;p&gt;我们进行了一项创建 12,000 个 Secret 的测试，并检测了 API
服务器加密资源所花费的时间。使用的指标是
&lt;a href=&#34;https://kubernetes.io/zh-cn/docs/reference/instrumentation/metrics/&#34;&gt;&lt;code&gt;apiserver_storage_transformation_duration_seconds&lt;/code&gt;&lt;/a&gt;。
对于 KMS v1，测试在具有 2 个节点的托管 Kubernetes v1.25 集群上运行。
测试期间集群上没有额外的负载。对于 KMS v2，
测试是在具有以下&lt;a href=&#34;https://github.com/kubernetes/kubernetes/blob/release-1.27/test/e2e/testing-manifests/auth/encrypt/kind.yaml&#34;&gt;集群配置&lt;/a&gt;的
Kubernetes CI 环境中运行的&lt;/p&gt;
&lt;!--
| KMS Provider | Time taken by 95 percentile |
| ------------ | --------------------------- |
| KMS v1       | 160ms                       |
| KMS v2       | 80μs                        |

The results show that the KMS v2 encryption provider is three orders of magnitude faster than the
KMS v1 encryption provider.
--&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;KMS 驱动&lt;/th&gt;
&lt;th&gt;95 分位请求所用时间&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;KMS v1&lt;/td&gt;
&lt;td&gt;160ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KMS v2&lt;/td&gt;
&lt;td&gt;80μs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;结果表明，KMS v2 加密驱动比 KMS v1 快三个数量级。&lt;/p&gt;
&lt;!--
## What&#39;s next?
For Kubernetes v1.28, we expect the feature to stay in beta. In the coming releases we want to
investigate:
- Cryptographic changes to remove the limitation on VM state store.
- Kubernetes REST API changes to enable a more robust story around key rotation.
- Handling undecryptable resources. Refer to the
  [KEP](https://github.com/kubernetes/enhancements/pull/3927) for details.
--&gt;
&lt;h2 id=&#34;下一步计划&#34;&gt;下一步计划&lt;/h2&gt;
&lt;p&gt;对于 Kubernetes v1.28，我们预计该功能仍处于测试阶段。在即将发布的版本中，我们将致力于：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;修改加密程序以消除对 VM 状态存储的限制。&lt;/li&gt;
&lt;li&gt;针对密钥轮换，修改 Kubernetes REST API 以实现更强大的特性。&lt;/li&gt;
&lt;li&gt;处理无法解密的资源，更多细节参考：&lt;a href=&#34;https://github.com/kubernetes/enhancements/pull/3927&#34;&gt;KEP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
You can learn more about KMS v2 by reading [Using a KMS provider for data
encryption](/docs/tasks/administer-cluster/kms-provider/). You can also follow along on the
[KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-auth/3299-kms-v2-improvements/#readme)
to track progress across the coming Kubernetes releases.
--&gt;
&lt;p&gt;你可以通过阅读&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/kms-provider/&#34;&gt;使用 KMS 驱动进行数据加密&lt;/a&gt;，
还可以关注 &lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-auth/3299-kms-v2-improvements/#readme&#34;&gt;KEP&lt;/a&gt;
来跟踪即将发布的 Kubernetes 版本进度。&lt;/p&gt;
&lt;!--
## Call to action

In this blog post, we have covered the improvements made to the KMS encryption provider in
Kubernetes v1.27. We have also discussed the new KMS v2 API and how it works. We would love to hear
your feedback on this feature. In particular, we would like feedback from Kubernetes KMS plugin
implementors as they go through the process of building their integrations with this new API. Please
reach out to us on the [#sig-auth-kms-dev](https://kubernetes.slack.com/archives/C03035EH4VB)
channel on Kubernetes Slack.
--&gt;
&lt;h2 id=&#34;行动号召&#34;&gt;行动号召&lt;/h2&gt;
&lt;p&gt;在这篇博文中，我们介绍了 Kubernetes v1.27 中对 KMS 加密驱动所做的改进。
我们还讨论了新的 KMS v2 API 及其工作原理。我们很想听听你对此功能的反馈，
特别是，我们希望 Kubernetes KMS 插件实现者在构建与这个新 API 的集成过程中得到反馈。
请通过 Kubernetes Slack 上的 &lt;a href=&#34;https://kubernetes.slack.com/archives/C03035EH4VB&#34;&gt;#sig-auth-kms-dev&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;如何参与&#34;&gt;如何参与&lt;/h2&gt;
&lt;p&gt;如果你有兴趣参与此功能的开发、分享反馈或参与任何其他正在进行的 SIG Auth 项目，
请联系 Kubernetes Slack 上的 [#sig-auth](&lt;a href=&#34;https://kubernetes.slack.com/archives&#34;&gt;https://kubernetes.slack.com/archives&lt;/a&gt; /C0EN96KUY) 频道。&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;
&lt;!--
## Acknowledgements
This feature has been an effort driven by contributors from several different companies. We would
like to extend a huge thank you to everyone that contributed their time and effort to help make this
possible.
--&gt;
&lt;h2 id=&#34;致谢&#34;&gt;致谢&lt;/h2&gt;
&lt;p&gt;此功能是由来自几家不同公司的贡献者推动的，我们非常感谢所有贡献时间和精力帮助实现这一目标的人。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：关于加快 Pod 启动的进展</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/15/speed-up-pod-startup/</link>
      <pubDate>Mon, 15 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/15/speed-up-pod-startup/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: updates on speeding up Pod startup&#34;
date: 2023-05-15T00:00:00+0000
slug: speed-up-pod-startup
--&gt;
&lt;!--
**Authors**: Paco Xu (DaoCloud), Sergey Kanzhelev (Google), Ruiwen Zhao (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Paco Xu (DaoCloud), Sergey Kanzhelev (Google), Ruiwen Zhao (Google)
&lt;strong&gt;译者&lt;/strong&gt;：Michael Yao (DaoCloud)&lt;/p&gt;
&lt;!--
How can Pod start-up be accelerated on nodes in large clusters? This is a common issue that
cluster administrators may face.

This blog post focuses on methods to speed up pod start-up from the kubelet side. It does not
involve the creation time of pods by controller-manager through kube-apiserver, nor does it
include scheduling time for pods or webhooks executed on it.
--&gt;
&lt;p&gt;如何在大型集群中加快节点上的 Pod 启动？这是集群管理员可能面临的常见问题。&lt;/p&gt;
&lt;p&gt;本篇博文重点介绍了从 kubelet 一侧加快 Pod 启动的方法。它不涉及通过
kube-apiserver 由 controller-manager 创建 Pod 所用的时间，
也不包括 Pod 的调度时间或在其上执行 Webhook 的时间。&lt;/p&gt;
&lt;!--
We have mentioned some important factors here to consider from the kubelet&#39;s perspective, but
this is not an exhaustive list. As Kubernetes v1.27 is released, this blog highlights
significant changes in v1.27 that aid in speeding up pod start-up.
--&gt;
&lt;p&gt;我们从 kubelet 的角度考虑，在本文提到了一些重要的影响因素，但这并不是详尽罗列。
随着 Kubernetes v1.27 的发布，本文强调了在 v1.27 中有助于加快 Pod 启动的重大变更。&lt;/p&gt;
&lt;!--
## Parallel container image pulls

Pulling images always takes some time and what&#39;s worse is that image pulls are done serially by
default. In other words, kubelet will send only one image pull request to the image service at
a time. Other image pull requests have to wait until the one being processed is complete.
--&gt;
&lt;h2 id=&#34;并行容器镜像拉取&#34;&gt;并行容器镜像拉取&lt;/h2&gt;
&lt;p&gt;拉取镜像总是需要一些时间的，更糟糕的是，镜像拉取默认是串行作业。
换句话说，kubelet 一次只会向镜像服务发送一个镜像拉取请求。
其他的镜像拉取请求必须等到正在处理的拉取请求完成。&lt;/p&gt;
&lt;!--
To enable parallel image pulls, set the `serializeImagePulls` field to false in the kubelet
configuration. When `serializeImagePulls` is disabled, requests for image pulls are immediately
sent to the image service and multiple images can be pulled concurrently.
--&gt;
&lt;p&gt;要启用并行镜像拉取，请在 kubelet 配置中将 &lt;code&gt;serializeImagePulls&lt;/code&gt; 字段设置为 false。
当 &lt;code&gt;serializeImagePulls&lt;/code&gt; 被禁用时，将立即向镜像服务发送镜像拉取请求，并可以并行拉取多个镜像。&lt;/p&gt;
&lt;!--
### Maximum parallel image pulls will help secure your node from overloading on image pulling

We introduced a new feature in kubelet that sets a limit on the number of parallel image
pulls at the node level. This limit restricts the maximum number of images that can be pulled
simultaneously. If there is an image pull request beyond this limit, it will be blocked until
one of the ongoing image pulls finishes. Before enabling this feature, please ensure that your
container runtime&#39;s image service can handle parallel image pulls effectively.
--&gt;
&lt;h3 id=&#34;设定并行镜像拉取最大值有助于防止节点因镜像拉取而过载&#34;&gt;设定并行镜像拉取最大值有助于防止节点因镜像拉取而过载&lt;/h3&gt;
&lt;p&gt;我们在 kubelet 中引入了一个新特性，可以在节点级别设置并行镜像拉取的限值。
此限值限制了可以同时拉取的最大镜像数量。如果有个镜像拉取请求超过了这个限值，
该请求将被阻止，直到其中一个正在进行的镜像拉取完成为止。
在启用此特性之前，请确保容器运行时的镜像服务可以有效处理并行镜像拉取。&lt;/p&gt;
&lt;!--
To limit the number of simultaneous image pulls, you can configure the `maxParallelImagePulls`
field in kubelet. By setting `maxParallelImagePulls` to a value of _n_, only _n_ images will
be pulled concurrently. Any additional image pulls beyond this limit will wait until at least
one ongoing pull is complete.

You can find more details in the associated KEP: [Kubelet limit of Parallel Image Pulls](https://kep.k8s.io/3673)
 (KEP-3673).
 --&gt;
&lt;p&gt;要限制并行镜像拉取的数量，你可以在 kubelet 中配置 &lt;code&gt;maxParallelImagePulls&lt;/code&gt; 字段。
将 &lt;code&gt;maxParallelImagePulls&lt;/code&gt; 的值设置为 &lt;strong&gt;n&lt;/strong&gt; 后，并行拉取的镜像数将不能超过 &lt;strong&gt;n&lt;/strong&gt; 个。
超过此限值的任何其他镜像拉取请求都需要等到至少一个正在进行的拉取被完成为止。&lt;/p&gt;
&lt;p&gt;你可以在关联的 KEP 中找到更多细节：
&lt;a href=&#34;https://kep.k8s.io/3673&#34;&gt;Kubelet 并行镜像拉取数限值&lt;/a&gt; (KEP-3673)。&lt;/p&gt;
&lt;!--
## Raised default API query-per-second limits for kubelet

To improve pod startup in scenarios with multiple pods on a node, particularly sudden scaling
situations, it is necessary for Kubelet to synchronize the pod status and prepare configmaps,
secrets, or volumes. This requires a large bandwidth to access kube-apiserver.
--&gt;
&lt;h2 id=&#34;提高了-kubelet-默认-api-每秒查询限值&#34;&gt;提高了 kubelet 默认 API 每秒查询限值&lt;/h2&gt;
&lt;p&gt;为了在节点上具有多个 Pod 的场景中加快 Pod 启动，特别是在突然扩缩的情况下，
kubelet 需要同步 Pod 状态并准备 ConfigMap、Secret 或卷。这就需要大带宽访问 kube-apiserver。&lt;/p&gt;
&lt;!--
In versions prior to v1.27, the default `kubeAPIQPS` was 5 and `kubeAPIBurst` was 10. However,
the kubelet in v1.27 has increased these defaults to 50 and 100 respectively for better performance during
pod startup. It&#39;s worth noting that this isn&#39;t the only reason why we&#39;ve bumped up the API QPS
limits for Kubelet.
--&gt;
&lt;p&gt;在 v1.27 之前的版本中，&lt;code&gt;kubeAPIQPS&lt;/code&gt; 的默认值为 5，&lt;code&gt;kubeAPIBurst&lt;/code&gt; 的默认值为 10。
然而在 v1.27 中，kubelet 为了提高 Pod 启动性能，将这些默认值分别提高到了 50 和 100。
值得注意的是，这并不是我们提高 kubelet 的 API QPS 限值的唯一原因。&lt;/p&gt;
&lt;!--
1. It has a potential to be hugely throttled now (default QPS = 5)
2. In large clusters they can generate significant load anyway as there are a lot of them
3. They have a dedicated PriorityLevel and FlowSchema that we can easily control
--&gt;
&lt;ol&gt;
&lt;li&gt;现在的情况是 API 请求可能会被过度限制（默认 QPS = 5）&lt;/li&gt;
&lt;li&gt;在大型集群中，API 请求仍然可能产生相当大的负载，因为数量很多&lt;/li&gt;
&lt;li&gt;我们现在可以轻松控制一个专门为此设计的 PriorityLevel 和 FlowSchema&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Previously, we often encountered `volume mount timeout` on kubelet in node with more than 50 pods
during pod start up. We suggest that cluster operators bump `kubeAPIQPS` to 20 and `kubeAPIBurst` to 40,
 especially if using bare metal nodes.

More detials can be found in the KEP &lt;https://kep.k8s.io/1040&gt; and the pull request [#116121](https://github.com/kubernetes/kubernetes/pull/116121).
--&gt;
&lt;p&gt;以前在具有 50 个以上 Pod 的节点中，我们经常在 Pod 启动期间在 kubelet 上遇到 &lt;code&gt;volume mount timeout&lt;/code&gt;。
特别是在使用裸金属节点时，我们建议集群操作员将 &lt;code&gt;kubeAPIQPS&lt;/code&gt; 提高到 20，&lt;code&gt;kubeAPIBurst&lt;/code&gt; 提高到 40。&lt;/p&gt;
&lt;p&gt;更多细节请参阅 KEP &lt;a href=&#34;https://kep.k8s.io/1040&#34;&gt;https://kep.k8s.io/1040&lt;/a&gt; 和
&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/116121&#34;&gt;PR#116121&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Event triggered updates to container status

`Evented PLEG` (PLEG is short for &#34;Pod Lifecycle Event Generator&#34;) is set to be in beta for v1.27,
Kubernetes offers two ways for the kubelet to detect Pod lifecycle events, such as the last
process in a container shutting down.
In Kubernetes v1.27, the _event based_ mechanism has graduated to beta but remains
disabled by default. If you do explicitly switch to event-based lifecycle change detection,
the kubelet is able to start Pods more quickly than with the default approach that relies on polling.
The default mechanism, polling for lifecycle changes, adds a noticeable overhead; this affects
the kubelet&#39;s ability to handle different tasks in parallel, and leads to poor performance and
reliability issues. For these reasons, we recommend that you switch your nodes to use
event-based pod lifecycle change detection.
--&gt;
&lt;h2 id=&#34;事件驱动的容器状态更新&#34;&gt;事件驱动的容器状态更新&lt;/h2&gt;
&lt;p&gt;在 v1.27 中，&lt;code&gt;Evented PLEG&lt;/code&gt;
（PLEG 是英文 Pod Lifecycle Event Generator 的缩写，表示 “Pod 生命周期事件生成器”）
进阶至 Beta 阶段。Kubernetes 为 kubelet 提供了两种方法来检测 Pod 的生命周期事件，
例如容器中最后一个进程关闭。在 Kubernetes v1.27 中，&lt;strong&gt;基于事件的&lt;/strong&gt; 机制已进阶至 Beta，
但默认被禁用。如果你显式切换为基于事件的生命周期变更检测，则 kubelet
能够比依赖轮询的默认方法更快地启动 Pod。默认的轮询生命周期变化机制会增加明显的开销，
这会影响 kubelet 处理不同任务的并行能力，并导致性能和可靠性问题。
出于这些原因，我们建议你将节点切换为使用基于事件的 Pod 生命周期变更检测。&lt;/p&gt;
&lt;!--
Further details can be found in the KEP &lt;https://kep.k8s.io/3386&gt; and
[Switching From Polling to CRI Event-based Updates to Container Status](/docs/tasks/administer-cluster/switch-to-evented-pleg/).
--&gt;
&lt;p&gt;更多细节请参阅 KEP &lt;a href=&#34;https://kep.k8s.io/3386&#34;&gt;https://kep.k8s.io/3386&lt;/a&gt;
和&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/switch-to-evented-pleg/&#34;&gt;容器状态从轮询切换为基于 CRI 事件更新&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Raise your pod resource limit if needed

During start-up, some pods may consume a considerable amount of CPU or memory. If the CPU limit is
low, this can significantly slow down the pod start-up process. To improve the memory management,
Kubernetes v1.22 introduced a feature gate called MemoryQoS to kubelet. This feature enables
kubelet to set memory QoS at container, pod, and QoS levels for better protection and guaranteed
quality of memory when running with cgroups v2. Although it has benefits, it is possible that
enabling this feature gate may affect the start-up speed of the pod if the pod startup consumes
a large amount of memory.
--&gt;
&lt;h2 id=&#34;必要时提高-pod-资源限值&#34;&gt;必要时提高 Pod 资源限值&lt;/h2&gt;
&lt;p&gt;某些 Pod 在启动过程中可能会耗用大量的 CPU 或内存。
如果 CPU 限值较低，则可能会显著降低 Pod 启动过程的速度。
为了改善内存管理，Kubernetes v1.22 引入了一个名为 MemoryQoS 的特性门控。
该特性使 kubelet 能够在容器、Pod 和 QoS 级别上设置内存 QoS，以便更好地保护和确保在运行
CGroup V2 时的内存质量。尽管此特性门控有一定的好处，但如果 Pod 启动消耗大量内存，
启用此特性门控可能会影响 Pod 的启动速度。&lt;/p&gt;
&lt;!--
Kubelet configuration now includes `memoryThrottlingFactor`. This factor is multiplied by
the memory limit or node allocatable memory to set the cgroupv2 `memory.high` value for enforcing
MemoryQoS. Decreasing this factor sets a lower high limit for container cgroups, increasing reclaim
pressure. Increasing this factor will put less reclaim pressure. The default value is 0.8 initially
and will change to 0.9 in Kubernetes v1.27. This parameter adjustment can reduce the potential
impact of this feature on pod startup speed.

Further details can be found in the KEP &lt;https://kep.k8s.io/2570&gt;.
--&gt;
&lt;p&gt;Kubelet 配置现在包括 &lt;code&gt;memoryThrottlingFactor&lt;/code&gt;。该因子乘以内存限制或节点可分配内存，
可以设置 cgroupv2  &lt;code&gt;memory.high&lt;/code&gt; 值来执行 MemoryQoS。
减小该因子将为容器 cgroup 设置较低的上限，同时增加了回收压力。
提高此因子将减少回收压力。默认值最初为 0.8，并将在 Kubernetes v1.27 中更改为 0.9。
调整此参数可以减少此特性对 Pod 启动速度的潜在影响。&lt;/p&gt;
&lt;p&gt;更多细节请参阅 KEP &lt;a href=&#34;https://kep.k8s.io/2570&#34;&gt;https://kep.k8s.io/2570&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## What&#39;s more?

In Kubernetes v1.26, a new histogram metric `pod_start_sli_duration_seconds` was added for Pod
startup latency SLI/SLO details. Additionally, the kubelet log will now display more information
about pod start-related timestamps, as shown below:
--&gt;
&lt;h2 id=&#34;更多说明&#34;&gt;更多说明&lt;/h2&gt;
&lt;p&gt;在 Kubernetes v1.26 中，新增了一个名为 &lt;code&gt;pod_start_sli_duration_seconds&lt;/code&gt; 的直方图指标，
用于显示 Pod 启动延迟 SLI/SLO 详情。此外，kubelet 日志现在会展示更多与 Pod 启动相关的时间戳信息，如下所示：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Dec 30 15:33:13.375379 e2e-022435249c-674b9-minion-group-gdj4 kubelet[8362]: I1230 15:33:13.375359    8362 pod_startup_latency_tracker.go:102] &amp;quot;Observed pod startup duration&amp;quot; pod=&amp;quot;kube-system/konnectivity-agent-gnc9k&amp;quot; podStartSLOduration=-9.223372029479458e+09 pod.CreationTimestamp=&amp;quot;2022-12-30 15:33:06 +0000 UTC&amp;quot; firstStartedPulling=&amp;quot;2022-12-30 15:33:09.258791695 +0000 UTC m=+13.029631711&amp;quot; lastFinishedPulling=&amp;quot;0001-01-01 00:00:00 +0000 UTC&amp;quot; observedRunningTime=&amp;quot;2022-12-30 15:33:13.375009262 +0000 UTC m=+17.145849275&amp;quot; watchObservedRunningTime=&amp;quot;2022-12-30 15:33:13.375317944 +0000 UTC m=+17.146157970&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
The SELinux Relabeling with Mount Options feature moved to Beta in v1.27. This feature speeds up
container startup by mounting volumes with the correct SELinux label instead of changing each file
on the volumes recursively. Further details can be found in the KEP &lt;https://kep.k8s.io/1710&gt;.

To identify the cause of slow pod startup, analyzing metrics and logs can be helpful. Other
factors that may impact pod startup include container runtime, disk speed, CPU and memory
resources on the node.
--&gt;
&lt;p&gt;SELinux 挂载选项重标记功能在 v1.27 中升至 Beta 版本。
该特性通过挂载具有正确 SELinux 标签的卷来加快容器启动速度，
而不是递归地更改卷上的每个文件。更多细节请参阅 KEP &lt;a href=&#34;https://kep.k8s.io/1710&#34;&gt;https://kep.k8s.io/1710&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;为了确定 Pod 启动缓慢的原因，分析指标和日志可能会有所帮助。
其他可能会影响 Pod 启动的因素包括容器运行时、磁盘速度、节点上的 CPU 和内存资源。&lt;/p&gt;
&lt;!--
SIG Node is responsible for ensuring fast Pod startup times, while addressing issues in large
clusters falls under the purview of SIG Scalability as well.
--&gt;
&lt;p&gt;SIG Node 负责确保 Pod 快速启动，而解决大型集群中的问题则属于 SIG Scalability 的范畴。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27: 原地调整 Pod 资源 (alpha)</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/12/in-place-pod-resize-alpha/</link>
      <pubDate>Fri, 12 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/12/in-place-pod-resize-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: In-place Resource Resize for Kubernetes Pods (alpha)&#34;
date: 2023-05-12
slug: in-place-pod-resize-alpha
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Vinay Kulkarni (Kubescaler Labs)&lt;/p&gt;
&lt;!--
**Author:** [Vinay Kulkarni](https://github.com/vinaykul) (Kubescaler Labs)
--&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/pacoxu&#34;&gt;Paco Xu&lt;/a&gt; (Daocloud)&lt;/p&gt;
&lt;!--
If you have deployed Kubernetes pods with CPU and/or memory resources
specified, you may have noticed that changing the resource values involves
restarting the pod. This has been a disruptive operation for running
workloads... until now.
--&gt;
&lt;p&gt;如果你部署的 Pod 设置了 CPU 或内存资源，你就可能已经注意到更改资源值会导致 Pod 重新启动。
以前，这对于运行的负载来说是一个破坏性的操作。&lt;/p&gt;
&lt;!--
In Kubernetes v1.27, we have added a new alpha feature that allows users
to resize CPU/memory resources allocated to pods without restarting the
containers. To facilitate this, the `resources` field in a pod&#39;s containers
now allow mutation for `cpu` and `memory` resources. They can be changed
simply by patching the running pod spec.
--&gt;
&lt;p&gt;在 Kubernetes v1.27 中，我们添加了一个新的 alpha 特性，允许用户调整分配给 Pod 的
CPU 和内存资源大小，而无需重新启动容器。 首先，API 层面现在允许修改 Pod 容器中的
&lt;code&gt;resources&lt;/code&gt; 字段下的 &lt;code&gt;cpu&lt;/code&gt; 和 &lt;code&gt;memory&lt;/code&gt; 资源。资源修改只需 patch 正在运行的 pod
规约即可。&lt;/p&gt;
&lt;!--
This also means that `resources` field in the pod spec can no longer be
relied upon as an indicator of the pod&#39;s actual resources. Monitoring tools
and other such applications must now look at new fields in the pod&#39;s status.
Kubernetes queries the actual CPU and memory requests and limits enforced on
the running containers via a CRI (Container Runtime Interface) API call to the
runtime, such as containerd, which is responsible for running the containers.
The response from container runtime is reflected in the pod&#39;s status.
--&gt;
&lt;p&gt;这也意味着 Pod 定义中的 &lt;code&gt;resource&lt;/code&gt; 字段不能再被视为 Pod 实际资源的指标。监控程序必须
查看 Pod 状态中的新字段来获取实际资源状况。Kubernetes 通过 CRI（Container Runtime
Interface，容器运行时接口）API 调用运行时（例如 containerd）来查询实际的 CPU 和内存
的请求和限制。容器运行时的响应会反映在 Pod 的状态中。&lt;/p&gt;
&lt;!--
In addition, a new `restartPolicy` for resize has been added. It gives users
control over how their containers are handled when resources are resized.
--&gt;
&lt;p&gt;此外，Pod 中还添加了对应于资源调整的新字段 &lt;code&gt;restartPolicy&lt;/code&gt;。这个字段使用户可以控制在资
源调整时容器的行为。&lt;/p&gt;
&lt;!--
## What&#39;s new in v1.27?
--&gt;
&lt;h2 id=&#34;1-27-版本有什么新内容&#34;&gt;1.27 版本有什么新内容?&lt;/h2&gt;
&lt;!--
Besides the addition of resize policy in the pod&#39;s spec, a new field named
`allocatedResources` has been added to `containerStatuses` in the pod&#39;s status.
This field reflects the node resources allocated to the pod&#39;s containers.
--&gt;
&lt;p&gt;除了在 Pod 规范中添加调整策略之外，还在 Pod 状态中的 &lt;code&gt;containerStatuses&lt;/code&gt; 中添加了一个名为
&lt;code&gt;allocatedResources&lt;/code&gt; 的新字段。该字段反映了分配给 Pod 容器的节点资源。&lt;/p&gt;
&lt;!--
In addition, a new field called `resources` has been added to the container&#39;s
status. This field reflects the actual resource requests and limits configured
on the running containers as reported by the container runtime.
--&gt;
&lt;p&gt;此外，容器状态中还添加了一个名为 &lt;code&gt;resources&lt;/code&gt; 的新字段。该字段反映的是如同容器运行时所报告的、
针对正运行的容器配置的实际资源 requests 和 limits。&lt;/p&gt;
&lt;!--
此处使用了 https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/resize-container-resources/ 内容：
Lastly, a new field named `resize` has been added to the pod&#39;s status to show the
status of the last requested resize. A value of `Proposed` is an acknowledgement
of the requested resize and indicates that request was validated and recorded. A
value of `InProgress` indicates that the node has accepted the resize request
and is in the process of applying the resize request to the pod&#39;s containers.
A value of `Deferred` means that the requested resize cannot be granted at this
time, and the node will keep retrying. The resize may be granted when other pods
leave and free up node resources. A value of `Infeasible` is a signal that the
node cannot accommodate the requested resize. This can happen if the requested
resize exceeds the maximum resources the node can ever allocate for a pod.
--&gt;
&lt;p&gt;最后，Pod 状态中添加了新字段 &lt;code&gt;resize&lt;/code&gt;。&lt;code&gt;resize&lt;/code&gt; 字段显示上次请求待处理的调整状态。
此字段可以具有以下值：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Proposed：此值表示请求调整已被确认，并且请求已被验证和记录。&lt;/li&gt;
&lt;li&gt;InProgress：此值表示节点已接受调整请求，并正在将其应用于 Pod 的容器。&lt;/li&gt;
&lt;li&gt;Deferred：此值意味着在此时无法批准请求的调整，节点将继续重试。 当其他 Pod 退出并释放节点资源时，调整可能会被真正实施。&lt;/li&gt;
&lt;li&gt;Infeasible：此值是一种信号，表示节点无法承接所请求的调整值。 如果所请求的调整超过节点可分配给 Pod 的最大资源，则可能会发生这种情况。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## When to use this feature
--&gt;
&lt;h2 id=&#34;何时使用此功能&#34;&gt;何时使用此功能？&lt;/h2&gt;
&lt;!--
Here are a few examples where this feature may be useful:

- Pod is running on node but with either too much or too little resources.
- Pods are not being scheduled do to lack of sufficient CPU or memory in a
cluster that is underutilized by running pods that were overprovisioned.
- Evicting certain stateful pods that need more resources to schedule them
on bigger nodes is an expensive or disruptive operation when other lower
priority pods in the node can be resized down or moved.
--&gt;
&lt;p&gt;以下是此功能可能有价值的一些示例：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;正在运行的 Pod 资源限制或者请求过多或过少。&lt;/li&gt;
&lt;li&gt;一些过度预配资源的 Pod 调度到某个节点，会导致资源利用率较低的集群上因为
CPU 或内存不足而无法调度 Pod。&lt;/li&gt;
&lt;li&gt;驱逐某些需要较多资源的有状态 Pod 是一项成本较高或破坏性的操作。
这种场景下，缩小节点中的其他优先级较低的 Pod 的资源，或者移走这些 Pod 的成本更低。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How to use this feature
--&gt;
&lt;h2 id=&#34;如何使用这个功能&#34;&gt;如何使用这个功能&lt;/h2&gt;
&lt;!--
In order to use this feature in v1.27, the `InPlacePodVerticalScaling`
feature gate must be enabled. A local cluster with this feature enabled
can be started as shown below:
--&gt;
&lt;p&gt;在 v1.27 中使用此功能，必须启用 &lt;code&gt;InPlacePodVerticalScaling&lt;/code&gt; 特性门控。
可以如下所示启动一个启用了此特性的本地集群：&lt;/p&gt;
&lt;!--
```
root@vbuild:~/go/src/k8s.io/kubernetes# FEATURE_GATES=InPlacePodVerticalScaling=true ./hack/local-up-cluster.sh
go version go1.20.2 linux/arm64
+++ [0320 13:52:02] Building go targets for linux/arm64
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/cloud-controller-manager (non-static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
...
...
Logs:
  /tmp/etcd.log
  /tmp/kube-apiserver.log
  /tmp/kube-controller-manager.log

  /tmp/kube-proxy.log
  /tmp/kube-scheduler.log
  /tmp/kubelet.log

To start using your cluster, you can open up another terminal/tab and run:

  export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
  cluster/kubectl.sh

Alternatively, you can write to the default kubeconfig:

  export KUBERNETES_PROVIDER=local

  cluster/kubectl.sh config set-cluster local --server=https://localhost:6443 --certificate-authority=/var/run/kubernetes/server-ca.crt
  cluster/kubectl.sh config set-credentials myself --client-key=/var/run/kubernetes/client-admin.key --client-certificate=/var/run/kubernetes/client-admin.crt
  cluster/kubectl.sh config set-context local --cluster=local --user=myself
  cluster/kubectl.sh config use-context local
  cluster/kubectl.sh

```
--&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@vbuild:~/go/src/k8s.io/kubernetes# FEATURE_GATES=InPlacePodVerticalScaling=true ./hack/local-up-cluster.sh
go version go1.20.2 linux/arm64
+++ [0320 13:52:02] Building go targets for linux/arm64
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/cloud-controller-manager (non-static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
...
...
Logs:
  /tmp/etcd.log
  /tmp/kube-apiserver.log
  /tmp/kube-controller-manager.log

  /tmp/kube-proxy.log
  /tmp/kube-scheduler.log
  /tmp/kubelet.log

To start using your cluster, you can open up another terminal/tab and run:

  export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
  cluster/kubectl.sh

# Alternatively, you can write to the default kubeconfig:

  export KUBERNETES_PROVIDER=local

  cluster/kubectl.sh config set-cluster local --server=https://localhost:6443 --certificate-authority=/var/run/kubernetes/server-ca.crt
  cluster/kubectl.sh config set-credentials myself --client-key=/var/run/kubernetes/client-admin.key --client-certificate=/var/run/kubernetes/client-admin.crt
  cluster/kubectl.sh config set-context local --cluster=local --user=myself
  cluster/kubectl.sh config use-context local
  cluster/kubectl.sh
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Once the local cluster is up and running, Kubernetes users can schedule pods
with resources, and resize the pods via kubectl. An example of how to use this
feature is illustrated in the following demo video.
--&gt;
&lt;p&gt;一旦本地集群启动并运行，Kubernetes 用户就可以调度带有资源配置的 pod，并通过 kubectl 调整 pod
的资源。 以下演示视频演示了如何使用此功能的示例。&lt;/p&gt;
&lt;!--

&lt;div style=&#34;position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;&#34;&gt;
  &lt;iframe src=&#34;https://www.youtube.com/embed/1m2FOuB6Bh0&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;&#34; allowfullscreen title=&#34;In-place resize of pod CPU and memory resources&#34;&gt;&lt;/iframe&gt;
&lt;/div&gt;

--&gt;

&lt;div style=&#34;position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;&#34;&gt;
  &lt;iframe src=&#34;https://www.youtube.com/embed/1m2FOuB6Bh0&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;&#34; allowfullscreen title=&#34;原地调整 Pod CPU 或内存资源&#34;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;!--
## Example Use Cases
--&gt;
&lt;h2 id=&#34;示例用例&#34;&gt;示例用例&lt;/h2&gt;
&lt;!--
### Cloud-based Development Environment
--&gt;
&lt;h3 id=&#34;云端开发环境&#34;&gt;云端开发环境&lt;/h3&gt;
&lt;!--
In this scenario, developers or development teams write their code locally
but build and test their code in Kubernetes pods with consistent configs
that reflect production use. Such pods need minimal resources when the
developers are writing code, but need significantly more CPU and memory
when they build their code or run a battery of tests. This use case can
leverage in-place pod resize feature (with a little help from eBPF) to
quickly resize the pod&#39;s resources and avoid kernel OOM (out of memory)
killer from terminating their processes.
--&gt;
&lt;p&gt;在这种场景下，开发人员或开发团队在本地编写代码，但在和生产环境资源配置相同的 Kubernetes pod 中的
构建和测试代码。当开发人员编写代码时，此类 Pod 需要最少的资源，但在构建代码或运行一系列测试时需要
更多的 CPU 和内存。 这个用例可以利用原地调整 pod 资源的功能（在 eBPF 的一点帮助下）快速调整 pod
资源的大小，并避免内核 OOM（内存不足）Killer 终止其进程。&lt;/p&gt;
&lt;!--
This [KubeCon North America 2022 conference talk](https://www.youtube.com/watch?v=jjfa1cVJLwc)
illustrates the use case.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=jjfa1cVJLwc&#34;&gt;KubeCon North America 2022 会议演讲&lt;/a&gt;中详细介绍了上述用例。&lt;/p&gt;
&lt;!--
### Java processes initialization CPU requirements
--&gt;
&lt;h3 id=&#34;java进程初始化cpu要求&#34;&gt;Java进程初始化CPU要求&lt;/h3&gt;
&lt;!--
Some Java applications may need significantly more CPU during initialization
than what is needed during normal process operation time. If such applications
specify CPU requests and limits suited for normal operation, they may suffer
from very long startup times. Such pods can request higher CPU values at the
time of pod creation, and can be resized down to normal running needs once the
application has finished initializing.
--&gt;
&lt;p&gt;某些 Java 应用程序在初始化期间 CPU 资源使用量可能比正常进程操作期间所需的 CPU 资源多很多。
如果此类应用程序指定适合正常操作的 CPU 请求和限制，会导致程序启动时间很长。这样的 pod
可以在创建 pod 时请求更高的 CPU 值。在应用程序完成初始化后，降低资源配置仍然可以正常运行。&lt;/p&gt;
&lt;!--
## Known Issues
--&gt;
&lt;h2 id=&#34;已知问题&#34;&gt;已知问题&lt;/h2&gt;
&lt;!--
This feature enters v1.27 at [alpha stage](/docs/reference/command-line-tools-reference/feature-gates/#feature-stages).
Below are a few known issues users may encounter:
--&gt;
&lt;p&gt;该功能在 v1.27 中仍然是 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/docs/reference/command-line-tools-reference/feature-gates/#feature-stages&#34;&gt;alpha 阶段&lt;/a&gt;.
以下是用户可能会遇到的一些已知问题：&lt;/p&gt;
&lt;!--
- containerd versions below v1.6.9 do not have the CRI support needed for full
  end-to-end operation of this feature. Attempts to resize pods will appear
  to be _stuck_ in the `InProgress` state, and `resources` field in the pod&#39;s
  status are never updated even though the new resources may have been enacted
  on the running containers.
- Pod resize may encounter a race condition with other pod updates, causing
  delayed enactment of pod resize.
- Reflecting the resized container resources in pod&#39;s status may take a while.
- Static CPU management policy is not supported with this feature.
--&gt;
&lt;ul&gt;
&lt;li&gt;containerd v1.6.9 以下的版本不具备此功能的所需的 CRI 支持，无法完成端到端的闭环。
尝试调整 Pod 大小将显示为卡在 &lt;code&gt;InProgress&lt;/code&gt; 状态，并且 Pod 状态中的 &lt;code&gt;resources&lt;/code&gt;
字段永远不会更新，即使新资源配置可能已经在正在运行的容器上生效了。&lt;/li&gt;
&lt;li&gt;Pod 资源调整可能会遇到与其他 Pod 更新的冲突，导致 pod 资源调整操作被推迟。&lt;/li&gt;
&lt;li&gt;可能需要一段时间才能在 Pod 的状态中反映出调整后的容器资源。&lt;/li&gt;
&lt;li&gt;此特性与静态 CPU 管理策略不兼容。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Credits
--&gt;
&lt;h2 id=&#34;致谢&#34;&gt;致谢&lt;/h2&gt;
&lt;!--
This feature is a result of the efforts of a very collaborative Kubernetes community.
Here&#39;s a little shoutout to just a few of the many many people that contributed
countless hours of their time and helped make this happen.
--&gt;
&lt;p&gt;此功能是 Kubernetes 社区高度协作努力的结果。这里是对在这个功能实现过程中，贡献了很多帮助的一部分人的一点点致意。&lt;/p&gt;
&lt;!--
- [@thockin](https://github.com/thockin) for detail-oriented API design and air-tight code reviews.
- [@derekwaynecarr](https://github.com/derekwaynecarr) for simplifying the design and thorough API and node reviews.
- [@dchen1107](https://github.com/dchen1107) for bringing vast knowledge from Borg and helping us avoid pitfalls.
- [@ruiwen-zhao](https://github.com/ruiwen-zhao) for adding containerd support that enabled full E2E implementation.
- [@wangchen615](https://github.com/wangchen615) for implementing comprehensive E2E tests and driving scheduler fixes.
- [@bobbypage](https://github.com/bobbypage) for invaluable help getting CI ready and quickly investigating issues, covering for me on my vacation.
- [@Random-Liu](https://github.com/Random-Liu) for thorough kubelet reviews and identifying problematic race conditions.
- [@Huang-Wei](https://github.com/Huang-Wei), [@ahg-g](https://github.com/ahg-g), [@alculquicondor](https://github.com/alculquicondor) for helping get scheduler changes done.
- [@mikebrow](https://github.com/mikebrow) [@marosset](https://github.com/marosset) for reviews on short notice that helped CRI changes make it into v1.25.
- [@endocrimes](https://github.com/endocrimes), [@ehashman](https://github.com/ehashman) for helping ensure that the oft-overlooked tests are in good shape.
- [@mrunalp](https://github.com/mrunalp) for reviewing cgroupv2 changes and ensuring clean handling of v1 vs v2.
- [@liggitt](https://github.com/liggitt), [@gjkim42](https://github.com/gjkim42) for tracking down, root-causing important missed issues post-merge.
- [@SergeyKanzhelev](https://github.com/SergeyKanzhelev) for supporting and shepherding various issues during the home stretch.
- [@pdgetrf](https://github.com/pdgetrf) for making the first prototype a reality.
- [@dashpole](https://github.com/dashpole) for bringing me up to speed on &#39;the Kubernetes way&#39; of doing things.
- [@bsalamat](https://github.com/bsalamat), [@kgolab](https://github.com/kgolab) for very thoughtful insights and suggestions in the early stages.
- [@sftim](https://github.com/sftim), [@tengqm](https://github.com/tengqm) for ensuring docs are easy to follow.
- [@dims](https://github.com/dims) for being omnipresent and helping make merges happen at critical hours.
- Release teams for ensuring that the project stayed healthy.
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/thockin&#34;&gt;@thockin&lt;/a&gt; 如此细致的 API 设计和严密的代码审核。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/derekwaynecarr&#34;&gt;@derekwaynecarr&lt;/a&gt; 设计简化和 API &amp;amp; Node 代码审核。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/dchen1107&#34;&gt;@dchen1107&lt;/a&gt; 介绍了 Borg 的大量知识，帮助我们避免落入潜在的陷阱。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ruiwen-zhao&#34;&gt;@ruiwen-zhao&lt;/a&gt; 增加 containerd 支持，使得 E2E 能够闭环。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/wangchen615&#34;&gt;@wangchen615&lt;/a&gt; 实现完整的 E2E 测试并推进调度问题修复。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bobbypage&#34;&gt;@bobbypage&lt;/a&gt; 提供宝贵的帮助，让 CI 准备就绪并快速排查问题，尤其是在我休假时。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Random-Liu&#34;&gt;@Random-Liu&lt;/a&gt; kubelet 代码审查以及定位竞态条件问题。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Huang-Wei&#34;&gt;@Huang-Wei&lt;/a&gt;, &lt;a href=&#34;https://github.com/ahg-g&#34;&gt;@ahg-g&lt;/a&gt;, &lt;a href=&#34;https://github.com/alculquicondor&#34;&gt;@alculquicondor&lt;/a&gt; 帮助完成调度部分的修改。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/mikebrow&#34;&gt;@mikebrow&lt;/a&gt; &lt;a href=&#34;https://github.com/marosset&#34;&gt;@marosset&lt;/a&gt; 帮助我在 v1.25 代码审查并最终合并 CRI 部分的修改。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/endocrimes&#34;&gt;@endocrimes&lt;/a&gt;, &lt;a href=&#34;https://github.com/ehashman&#34;&gt;@ehashman&lt;/a&gt; 帮助确保经常被忽视的测试处于良好状态。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/mrunalp&#34;&gt;@mrunalp&lt;/a&gt; cgroupv2 部分的代码审查并保证了 v1 和 v2 的清晰处理。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/liggitt&#34;&gt;@liggitt&lt;/a&gt;, &lt;a href=&#34;https://github.com/gjkim42&#34;&gt;@gjkim42&lt;/a&gt; 在合并代码后，帮助追踪遗漏的重要问题的根因。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SergeyKanzhelev&#34;&gt;@SergeyKanzhelev&lt;/a&gt; 在冲刺阶段支持和解决各种问题。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/pdgetrf&#34;&gt;@pdgetrf&lt;/a&gt; 完成了第一个原型。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/dashpole&#34;&gt;@dashpole&lt;/a&gt; 让我快速了解 Kubernetes 的做事方式。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/bsalamat&#34;&gt;@bsalamat&lt;/a&gt;, &lt;a href=&#34;https://github.com/kgolab&#34;&gt;@kgolab&lt;/a&gt; 在早期阶段提供非常周到的见解和建议。&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/sftim&#34;&gt;@sftim&lt;/a&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/dims&#34;&gt;@dims&lt;/a&gt; 无所不在并帮助在关键时刻进行合并。&lt;/li&gt;
&lt;li&gt;发布团队确保了项目保持健康。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
And a big thanks to my very supportive management [Dr. Xiaoning Ding](https://www.linkedin.com/in/xiaoningding/)
and [Dr. Ying Xiong](https://www.linkedin.com/in/ying-xiong-59a2482/) for their patience and encouragement.
--&gt;
&lt;p&gt;非常感谢我非常支持的管理层 &lt;a href=&#34;https://www.linkedin.com/in/xiaoningding/&#34;&gt;Xiaoning Ding 博士&lt;/a&gt; 和
&lt;a href=&#34;https://www.linkedin.com/in/ying-xiong-59a2482/&#34;&gt;Ying Xiong 博士&lt;/a&gt;，感谢他们的耐心和鼓励。&lt;/p&gt;
&lt;!--
## References
--&gt;
&lt;h2 id=&#34;参考&#34;&gt;参考&lt;/h2&gt;
&lt;!--
### For app developers
--&gt;
&lt;h3 id=&#34;应用程序开发者参考&#34;&gt;应用程序开发者参考&lt;/h3&gt;
&lt;!--
- [Resize CPU and Memory Resources assigned to Containers](/docs/tasks/configure-pod-container/resize-container-resources/)
- [Assign Memory Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-memory-resource/)
- [Assign CPU Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-cpu-resource/)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/resize-container-resources/&#34;&gt;调整分配给容器的 CPU 和内存资源&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/assign-memory-resource/&#34;&gt;为容器和 Pod 分配内存资源&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/configure-pod-container/assign-cpu-resource/&#34;&gt;为容器和 Pod 分配 CPU 资源&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### For cluster administrators
--&gt;
&lt;h3 id=&#34;集群管理员参考&#34;&gt;集群管理员参考&lt;/h3&gt;
&lt;!--
- [Configure Default Memory Requests and Limits for a Namespace](/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)
- [Configure Default CPU Requests and Limits for a Namespace](/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/&#34;&gt;为命名空间配置默认的内存请求和限制&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/&#34;&gt;为命名空间配置默认的 CPU 请求和限制&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：为 NodePort Service 分配端口时避免冲突</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/11/nodeport-dynamic-and-static-allocation/</link>
      <pubDate>Thu, 11 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/11/nodeport-dynamic-and-static-allocation/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Avoid Collisions Assigning Ports to NodePort Services&#34;
date: 2023-05-11
slug: nodeport-dynamic-and-static-allocation
--&gt;
&lt;!--
**Author:** Xu Zhenglun (Alibaba)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Xu Zhenglun (Alibaba)&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;!--
In Kubernetes, a Service can be used to provide a unified traffic endpoint for 
applications running on a set of Pods. Clients can use the virtual IP address (or _VIP_) provided
by the Service for access, and Kubernetes provides load balancing for traffic accessing
different back-end Pods, but a ClusterIP type of Service is limited to providing access to
nodes within the cluster, while traffic from outside the cluster cannot be routed.
One way to solve this problem is to use a `type: NodePort` Service, which sets up a mapping
to a specific port of all nodes in the cluster, thus redirecting traffic from the
outside to the inside of the cluster.
--&gt;
&lt;p&gt;在 Kubernetes 中，对于以一组 Pod 运行的应用，Service 可以为其提供统一的流量端点。
客户端可以使用 Service 提供的虚拟 IP 地址（或 &lt;strong&gt;VIP&lt;/strong&gt;）进行访问，
Kubernetes 为访问不同的后端 Pod 的流量提供负载均衡能力，
但 ClusterIP 类型的 Service 仅限于供集群内的节点来访问，
而来自集群外的流量无法被路由。解决这个难题的一种方式是使用 &lt;code&gt;type: NodePort&lt;/code&gt; Service，
这种服务会在集群所有节点上为特定端口建立映射关系，从而将来自集群外的流量重定向到集群内。&lt;/p&gt;
&lt;!--
## How Kubernetes allocates node ports to Services?

When a `type: NodePort` Service is created, its corresponding port(s) are allocated in one
of two ways:

- **Dynamic** : If the Service type is `NodePort` and you do not set a `nodePort` 
  value explicitly in the `spec` for that Service, the Kubernetes control plane will
  automatically allocate an unused port to it at creation time.

- **Static** : In addition to the dynamic auto-assignment described above, you can also
  explicitly assign a port that is within the nodeport port range configuration.
--&gt;
&lt;h2 id=&#34;kubernetes-如何为-services-分配节点端口&#34;&gt;Kubernetes 如何为 Services 分配节点端口？&lt;/h2&gt;
&lt;p&gt;当 &lt;code&gt;type: NodePort&lt;/code&gt; Service 被创建时，其所对应的端口将以下述两种方式之一分配：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;动态分配&lt;/strong&gt;：如果 Service 类型是 &lt;code&gt;NodePort&lt;/code&gt; 且你没有为 Service 显式设置 &lt;code&gt;nodePort&lt;/code&gt; 值，
Kubernetes 控制面将在创建时自动为其分配一个未使用的端口。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;静态分配&lt;/strong&gt;：除了上述动态自动分配，你还可以显式指定 nodeport 端口范围配置内的某端口。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The value of `nodePort` that you manually assign must be unique across the whole cluster.
Attempting to create a Service of `type: NodePort` where you explicitly specify a node port that
was already allocated results in an error.
--&gt;
&lt;p&gt;你手动分配的 &lt;code&gt;nodePort&lt;/code&gt; 值在整个集群范围内一定不能重复。
如果尝试在创建 &lt;code&gt;type: NodePort&lt;/code&gt; Service 时显式指定已分配的节点端口，将产生错误。&lt;/p&gt;
&lt;!--
## Why do you need to reserve ports of NodePort Service? 

Sometimes, you may want to have a NodePort Service running on well-known ports
so that other components and users inside o r outside the cluster can use them.
--&gt;
&lt;h2 id=&#34;为什么需要保留-nodeport-service-的端口&#34;&gt;为什么需要保留 NodePort Service 的端口？&lt;/h2&gt;
&lt;p&gt;有时你可能想要 NodePort Service 运行在众所周知的端口上，
便于集群内外的其他组件和用户可以使用这些端口。&lt;/p&gt;
&lt;!--
In some complex cluster deployments with a mix of Kubernetes nodes and other servers on the same network, 
it may be necessary to use some pre-defined ports for communication. In particular, some fundamental
components cannot rely on the VIPs that back `type: LoadBalancer` Services
because the virtual IP address mapping implementation for that cluster also relies on
these foundational components.

Now suppose you need to expose a Minio object storage service on Kubernetes to clients 
running outside the Kubernetes cluster, and the agreed port is `30009`, we need to 
create a Service as follows:
--&gt;
&lt;p&gt;在某些复杂的集群部署场景中在同一网络上混合了 Kubernetes 节点和其他服务器，
可能有必要使用某些预定义的端口进行通信。尤为特别的是，某些基础组件无法使用用来支撑
&lt;code&gt;type: LoadBalancer&lt;/code&gt; Service 的 VIP，因为针对集群实现的虚拟 IP 地址映射也依赖这些基础组件。&lt;/p&gt;
&lt;p&gt;现在假设你需要在 Kubernetes 上将一个 Minio 对象存储服务暴露给运行在 Kubernetes 集群外的客户端，
协商后的端口是 &lt;code&gt;30009&lt;/code&gt;，我们需要创建以下 Service：&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;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;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;minio&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;ports&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;api&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;nodePort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;30009&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;9000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;protocol&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;TCP&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;targetPort&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;9000&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;minio&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;NodePort&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, as mentioned before, if the port (30009) required for the `minio` Service is not reserved,
and another `type: NodePort` (or possibly `type: LoadBalancer`) Service is created and dynamically
allocated before or concurrently with the `minio` Service, TCP port 30009 might be allocated to that
other Service; if so, creation of the `minio` Service will fail due to a node port collision.
--&gt;
&lt;p&gt;然而如前文所述，如果 &lt;code&gt;minio&lt;/code&gt; Service 所需的端口 (30009) 未被预留，
且另一个 &lt;code&gt;type: NodePort&lt;/code&gt;（或者也包括 &lt;code&gt;type: LoadBalancer&lt;/code&gt;）Service
在 &lt;code&gt;minio&lt;/code&gt; Service 之前或与之同时被创建、动态分配，TCP 端口 30009 可能被分配给了这个 Service；
如果出现这种情况，&lt;code&gt;minio&lt;/code&gt; Service 的创建将由于节点端口冲突而失败。&lt;/p&gt;
&lt;!--
## How can you avoid NodePort Service port conflicts? 
Kubernetes 1.24 introduced changes for `type: ClusterIP` Services, dividing the CIDR range for cluster
IP addresses into two blocks that use different allocation policies to [reduce the risk of conflicts](/docs/reference/networking/virtual-ips/#avoiding-collisions).
In Kubernetes 1.27, as an alpha feature, you can adopt a similar policy for `type: NodePort` Services.
You can enable a new [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
`ServiceNodePortStaticSubrange`. Turning this on allows you to use a different port allocation strategy
for `type: NodePort` Services, and reduce the risk of collision.
--&gt;
&lt;h2 id=&#34;如何才能避免-nodeport-service-端口冲突&#34;&gt;如何才能避免 NodePort Service 端口冲突？&lt;/h2&gt;
&lt;p&gt;Kubernetes 1.24 引入了针对 &lt;code&gt;type: ClusterIP&lt;/code&gt; Service 的变更，将集群 IP 地址的 CIDR
范围划分为使用不同分配策略的两块来&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/networking/virtual-ips/#avoiding-collisions&#34;&gt;减少冲突的风险&lt;/a&gt;。
在 Kubernetes 1.27 中，作为一个 Alpha 特性，你可以为 &lt;code&gt;type: NodePort&lt;/code&gt; Service 采用类似的策略。
你可以启用新的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;
&lt;code&gt;ServiceNodePortStaticSubrange&lt;/code&gt;。开启此门控将允许你为
&lt;code&gt;type: NodePort&lt;/code&gt; Service 使用不同的端口分配策略，减少冲突的风险。&lt;/p&gt;
&lt;!--
The port range for `NodePort` will be divided, based on the formula `min(max(16, nodeport-size / 32), 128)`. 
The outcome of the formula will be a number between 16 and 128, with a step size that increases as the 
size of the nodeport range increases. The outcome of the formula determine that the size of static port 
range. When the port range is less than 16, the size of static port range will be set to 0, 
which means that all ports will be dynamically allocated.

Dynamic port assignment will use the upper band by default, once this has been exhausted it will use the lower range.
This will allow users to use static allocations on the lower band with a low risk of collision.
--&gt;
&lt;p&gt;&lt;code&gt;NodePort&lt;/code&gt; 的端口范围将基于公式 &lt;code&gt;min(max(16, 节点端口数 / 32), 128)&lt;/code&gt; 进行划分。
这个公式的结果将是一个介于 16 到 128 的数字，随着节点端口范围变大，步进值也会变大。
此公式的结果决定了静态端口范围的大小。当端口范围小于 16 时，静态端口范围的大小将被设为 0，
这意味着所有端口都将被动态分配。&lt;/p&gt;
&lt;p&gt;动态端口分配默认使用数值较高的一段，一旦用完，它将使用较低范围。
这将允许用户在冲突风险较低的较低端口段上使用静态分配。&lt;/p&gt;
&lt;!--
## Examples

### default range: 30000-32767
| Range properties        | Values                                                |
|-------------------------|-------------------------------------------------------|
| service-node-port-range | 30000-32767                                           |
| Band Offset             | &amp;ensp; `min(max(16, 2768/32), 128)` &lt;br&gt;= `min(max(16, 86), 128)` &lt;br&gt;= `min(86, 128)` &lt;br&gt;= 86 |
| Static band start       | 30000                                                 |
| Static band end         | 30085                                                 |
| Dynamic band start      | 30086                                                 |
| Dynamic band end        | 32767                                                 |
--&gt;
&lt;h2 id=&#34;示例&#34;&gt;示例&lt;/h2&gt;
&lt;h3 id=&#34;默认范围-30000-32767&#34;&gt;默认范围：30000-32767&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;范围属性&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-node-port-range&lt;/td&gt;
&lt;td&gt;30000-32767&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;分段偏移量&lt;/td&gt;
&lt;td&gt;  &lt;code&gt;min(max(16, 2768/32), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(max(16, 86), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(86, 128)&lt;/code&gt; &lt;br&gt;= 86&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始静态段&lt;/td&gt;
&lt;td&gt;30000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束静态段&lt;/td&gt;
&lt;td&gt;30085&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始动态段&lt;/td&gt;
&lt;td&gt;30086&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束动态段&lt;/td&gt;
&lt;td&gt;32767&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;figure&gt;
&lt;div class=&#34;mermaid&#34;&gt;
    
pie showData
    title 30000-32767
    &#34;Static&#34; : 86
    &#34;Dynamic&#34; : 2682

&lt;/div&gt;
&lt;/figure&gt;

&lt;noscript&gt;
  &lt;div class=&#34;alert alert-secondary callout&#34; role=&#34;alert&#34;&gt;
    &lt;em class=&#34;javascript-required&#34;&gt;必须&lt;a href=&#34;https://www.enable-javascript.com/&#34;&gt;启用&lt;/a&gt; JavaScript 才能查看此页内容&lt;/em&gt;
  &lt;/div&gt;
&lt;/noscript&gt;
&lt;!--
### very small range: 30000-30015
| Range properties        | Values                                                |
|-------------------------|-------------------------------------------------------|
| service-node-port-range | 30000-30015                                           |
| Band Offset             | 0                                                     |
| Static band start       | -                                                     |
| Static band end         | -                                                     |
| Dynamic band start      | 30000                                                 |
| Dynamic band end        | 30015                                                 |
--&gt;
&lt;h3 id=&#34;超小范围-30000-30015&#34;&gt;超小范围：30000-30015&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;范围属性&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-node-port-range&lt;/td&gt;
&lt;td&gt;30000-30015&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;分段偏移量&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始静态段&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束静态段&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始动态段&lt;/td&gt;
&lt;td&gt;30000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;动态动态段&lt;/td&gt;
&lt;td&gt;30015&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;figure&gt;
&lt;div class=&#34;mermaid&#34;&gt;
    
pie showData
    title 30000-30015
    &#34;Static&#34; : 0
    &#34;Dynamic&#34; : 16

&lt;/div&gt;
&lt;/figure&gt;

&lt;noscript&gt;
  &lt;div class=&#34;alert alert-secondary callout&#34; role=&#34;alert&#34;&gt;
    &lt;em class=&#34;javascript-required&#34;&gt;必须&lt;a href=&#34;https://www.enable-javascript.com/&#34;&gt;启用&lt;/a&gt; JavaScript 才能查看此页内容&lt;/em&gt;
  &lt;/div&gt;
&lt;/noscript&gt;
&lt;!--
### small(lower boundary) range: 30000-30127
| Range properties        | Values                                                |
|-------------------------|-------------------------------------------------------|
| service-node-port-range | 30000-30127                                           |
| Band Offset             | &amp;ensp; `min(max(16, 128/32), 128)` &lt;br&gt;= `min(max(16, 4), 128)` &lt;br&gt;= `min(16, 128)` &lt;br&gt;= 16 |
| Static band start       | 30000                                                 |
| Static band end         | 30015                                                 |
| Dynamic band start      | 30016                                                 |
| Dynamic band end        | 30127                                                 |
--&gt;
&lt;h3 id=&#34;小-下边界-范围-30000-30127&#34;&gt;小（下边界）范围：30000-30127&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;范围属性&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-node-port-range&lt;/td&gt;
&lt;td&gt;30000-30127&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;分段偏移量&lt;/td&gt;
&lt;td&gt;  &lt;code&gt;min(max(16, 128/32), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(max(16, 4), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(16, 128)&lt;/code&gt; &lt;br&gt;= 16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始静态段&lt;/td&gt;
&lt;td&gt;30000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束静态段&lt;/td&gt;
&lt;td&gt;30015&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始动态段&lt;/td&gt;
&lt;td&gt;30016&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束动态段&lt;/td&gt;
&lt;td&gt;30127&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;figure&gt;
&lt;div class=&#34;mermaid&#34;&gt;
    
pie showData
    title 30000-30127
    &#34;Static&#34; : 16
    &#34;Dynamic&#34; : 112

&lt;/div&gt;
&lt;/figure&gt;

&lt;noscript&gt;
  &lt;div class=&#34;alert alert-secondary callout&#34; role=&#34;alert&#34;&gt;
    &lt;em class=&#34;javascript-required&#34;&gt;必须&lt;a href=&#34;https://www.enable-javascript.com/&#34;&gt;启用&lt;/a&gt; JavaScript 才能查看此页内容&lt;/em&gt;
  &lt;/div&gt;
&lt;/noscript&gt;
&lt;!--
### large(upper boundary) range: 30000-34095
| Range properties        | Values                                                |
|-------------------------|-------------------------------------------------------|
| service-node-port-range | 30000-34095                                           |
| Band Offset             | &amp;ensp; `min(max(16, 4096/32), 128)` &lt;br&gt;= `min(max(16, 128), 128)` &lt;br&gt;= `min(128, 128)` &lt;br&gt;= 128 |
| Static band start       | 30000                                                 |
| Static band end         | 30127                                                 |
| Dynamic band start      | 30128                                                 |
| Dynamic band end        | 34095                                                 |
--&gt;
&lt;h3 id=&#34;大-上边界-范围-30000-34095&#34;&gt;大（上边界）范围：30000-34095&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;范围属性&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-node-port-range&lt;/td&gt;
&lt;td&gt;30000-34095&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;分段偏移量&lt;/td&gt;
&lt;td&gt;  &lt;code&gt;min(max(16, 4096/32), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(max(16, 128), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(128, 128)&lt;/code&gt; &lt;br&gt;= 128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始静态段&lt;/td&gt;
&lt;td&gt;30000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束静态段&lt;/td&gt;
&lt;td&gt;30127&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始动态段&lt;/td&gt;
&lt;td&gt;30128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束动态段&lt;/td&gt;
&lt;td&gt;34095&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;figure&gt;
&lt;div class=&#34;mermaid&#34;&gt;
    
pie showData
    title 30000-34095
    &#34;Static&#34; : 128
    &#34;Dynamic&#34; : 3968

&lt;/div&gt;
&lt;/figure&gt;

&lt;noscript&gt;
  &lt;div class=&#34;alert alert-secondary callout&#34; role=&#34;alert&#34;&gt;
    &lt;em class=&#34;javascript-required&#34;&gt;必须&lt;a href=&#34;https://www.enable-javascript.com/&#34;&gt;启用&lt;/a&gt; JavaScript 才能查看此页内容&lt;/em&gt;
  &lt;/div&gt;
&lt;/noscript&gt;
&lt;!--
### very large range: 30000-38191
| Range properties        | Values                                                |
|-------------------------|-------------------------------------------------------|
| service-node-port-range | 30000-38191                                           |
| Band Offset             | &amp;ensp; `min(max(16, 8192/32), 128)` &lt;br&gt;= `min(max(16, 256), 128)` &lt;br&gt;= `min(256, 128)` &lt;br&gt;= 128 |
| Static band start       | 30000                                                 |
| Static band end         | 30127                                                 |
| Dynamic band start      | 30128                                                 |
| Dynamic band end        | 38191                                                 |
--&gt;
&lt;h3 id=&#34;超大范围-30000-38191&#34;&gt;超大范围：30000-38191&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;范围属性&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-node-port-range&lt;/td&gt;
&lt;td&gt;30000-38191&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;分段偏移量&lt;/td&gt;
&lt;td&gt;  &lt;code&gt;min(max(16, 8192/32), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(max(16, 256), 128)&lt;/code&gt; &lt;br&gt;= &lt;code&gt;min(256, 128)&lt;/code&gt; &lt;br&gt;= 128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始静态段&lt;/td&gt;
&lt;td&gt;30000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束静态段&lt;/td&gt;
&lt;td&gt;30127&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;起始动态段&lt;/td&gt;
&lt;td&gt;30128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;结束动态段&lt;/td&gt;
&lt;td&gt;38191&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;figure&gt;
&lt;div class=&#34;mermaid&#34;&gt;
    
pie showData
    title 30000-38191
    &#34;Static&#34; : 128
    &#34;Dynamic&#34; : 8064

&lt;/div&gt;
&lt;/figure&gt;

&lt;noscript&gt;
  &lt;div class=&#34;alert alert-secondary callout&#34; role=&#34;alert&#34;&gt;
    &lt;em class=&#34;javascript-required&#34;&gt;必须&lt;a href=&#34;https://www.enable-javascript.com/&#34;&gt;启用&lt;/a&gt; JavaScript 才能查看此页内容&lt;/em&gt;
  &lt;/div&gt;
&lt;/noscript&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：kubectl apply 裁剪更安全、更高效</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/09/introducing-kubectl-applyset-pruning/</link>
      <pubDate>Tue, 09 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/09/introducing-kubectl-applyset-pruning/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Safer, More Performant Pruning in kubectl apply&#34;
date: 2023-05-09
slug: introducing-kubectl-applyset-pruning
--&gt;
&lt;!--
**Authors:** Katrina Verey (independent) and Justin Santa Barbara (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; Katrina Verey（独立个人）和 Justin Santa Barbara (Google)&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;!--
Declarative configuration management with the `kubectl apply` command is the gold standard approach
to creating or modifying Kubernetes resources. However, one challenge it presents is the deletion
of resources that are no longer needed. In Kubernetes version 1.5, the `--prune` flag was
introduced to address this issue, allowing kubectl apply to automatically clean up previously
applied resources removed from the current configuration.
--&gt;
&lt;p&gt;通过 &lt;code&gt;kubectl apply&lt;/code&gt; 命令执行声明式配置管理是创建或修改 Kubernetes 资源的黄金标准方法。
但这种方法也带来了一个挑战，那就是删除不再需要的资源。
在 Kubernetes 1.5 版本中，引入了 &lt;code&gt;--prune&lt;/code&gt; 标志来解决此问题，
允许 &lt;code&gt;kubectl apply&lt;/code&gt; 自动清理从当前配置中删除的先前应用的资源。&lt;/p&gt;
&lt;!--
Unfortunately, that existing implementation of `--prune` has design flaws that diminish its
performance and can result in unexpected behaviors. The main issue stems from the lack of explicit
encoding of the previously applied set by the preceding `apply` operation, necessitating
error-prone dynamic discovery. Object leakage, inadvertent over-selection of resources, and limited
compatibility with custom resources are a few notable drawbacks of this implementation. Moreover,
its coupling to client-side apply hinders user upgrades to the superior server-side apply
mechanism.
--&gt;
&lt;p&gt;然而，现有的 &lt;code&gt;--prune&lt;/code&gt; 实现存在设计缺陷，会降低性能并导致意外行为。
主要问题源于先前的 &lt;code&gt;apply&lt;/code&gt; 操作未对已应用的集合进行显式编码，有必要进行易错的动态发现。
对象泄漏、意外过度选择资源以及与自定义资源的有限兼容性是这种实现的一些明显缺点。
此外，其与客户端 apply 的耦合阻碍了用户升级到更优秀的服务器端 apply 方式。&lt;/p&gt;
&lt;!--
Version 1.27 of `kubectl` introduces an alpha version of a revamped pruning implementation that
addresses these issues. This new implementation, based on a concept called _ApplySet_, promises
better performance and safety.
--&gt;
&lt;p&gt;&lt;code&gt;kubectl&lt;/code&gt; 的 1.27 版本引入了 Alpha 版本的重构裁剪实现，解决了这些问题。
这个基于 &lt;strong&gt;ApplySet&lt;/strong&gt; 概念的新实现承诺能够提供更好的性能和更好的安全性。&lt;/p&gt;
&lt;!--
An _ApplySet_ is a group of resources associated with a _parent_ object on the cluster, as
identified and configured through standardized labels and annotations. Additional standardized
metadata allows for accurate identification of ApplySet _member_ objects within the cluster,
simplifying operations like pruning.
--&gt;
&lt;p&gt;&lt;strong&gt;ApplySet&lt;/strong&gt; 是一个与集群上的&lt;strong&gt;父&lt;/strong&gt;对象相关联的资源组，通过标准化的标签和注解进行标识和配置。
附加的标准化元数据允许准确标识集群内的 ApplySet &lt;strong&gt;成员&lt;/strong&gt;对象，简化了裁剪等操作。&lt;/p&gt;
&lt;!--
To leverage ApplySet-based pruning, set the `KUBECTL_APPLYSET=true` environment variable and include
the flags `--prune` and `--applyset` in your `kubectl apply` invocation:

```shell
KUBECTL_APPLYSET=true kubectl apply -f &lt;directory/&gt; --prune --applyset=&lt;name&gt;
```
--&gt;
&lt;p&gt;为了充分利用基于 ApplySet 的裁剪，设置 &lt;code&gt;KUBECTL_APPLYSET=true&lt;/code&gt; 环境变量，
并在 &lt;code&gt;kubectl apply&lt;/code&gt; 调用中包括标志 &lt;code&gt;--prune&lt;/code&gt; 和 &lt;code&gt;--applyset&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;KUBECTL_APPLYSET&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; kubectl apply -f &amp;lt;目录&amp;gt; --prune --applyset&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&amp;lt;name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
By default, ApplySet uses a Secret as the parent object. However, you can also use
a ConfigMap with the format `--applyset=configmaps/&lt;name&gt;`. If your desired Secret or
ConfigMap object does not yet exist, `kubectl` will create it for you. Furthermore, custom
resources can be enabled for use as ApplySet parent objects.
--&gt;
&lt;p&gt;默认情况下，ApplySet 使用 Secret 作为父对象。
但是，你也可以通过格式 &lt;code&gt;--applyset=configmaps/&amp;lt;name&amp;gt;&lt;/code&gt; 来使用 ConfigMap。
如果所需的 Secret 或 ConfigMap 对象尚不存在，则 &lt;code&gt;kubectl&lt;/code&gt; 将为你创建它。
此外，可以启用自定义资源以用作 ApplySet 父对象。&lt;/p&gt;
&lt;!--
The ApplySet implementation is based on a new low-level specification that can support higher-level
ecosystem tools by improving their interoperability. The lightweight nature of this specification
enables these tools to continue to use existing object grouping systems while opting in to
ApplySet&#39;s metadata conventions to prevent inadvertent changes by other tools (such as `kubectl`).
--&gt;
&lt;p&gt;ApplySet 实现基于新的底层规约，可以通过提高其互操作性来支持更高层次的生态系统工具。
这种规约的轻量性使得这些工具可以继续使用现有的对象分组系统，
同时选用 ApplySet 的元数据约定以防被其他工具（例如 &lt;code&gt;kubectl&lt;/code&gt;）意外更改。&lt;/p&gt;
&lt;!--
ApplySet-based pruning offers a promising solution to the shortcomings of the previous `--prune`
implementation in `kubectl` and can help streamline your Kubernetes resource management. Please
give this new feature a try and share your experiences with the community—ApplySet is under active
development, and your feedback is invaluable!
--&gt;
&lt;p&gt;基于 ApplySet 的裁剪提供了一种方法，保证有效解决之前 &lt;code&gt;kubectl&lt;/code&gt; 中 &lt;code&gt;--prune&lt;/code&gt; 实现的缺陷，
还可以帮助优化 Kubernetes 资源管理。请使用这个新特性并与社区分享你的经验。
ApplySet 正处于积极开发中，你的反馈至关重要！&lt;/p&gt;
&lt;!--
### Additional resources

- For more information how to use ApplySet-based pruning, read
  [Declarative Management of Kubernetes Objects Using Configuration Files](/docs/tasks/manage-kubernetes-objects/declarative-config/) in the Kubernetes documentation.
- For a deeper dive into the technical design of this feature or to learn how to implement the
  ApplySet specification in your own tools, refer to [KEP&amp;nbsp;3659](https://git.k8s.io/enhancements/keps/sig-cli/3659-kubectl-apply-prune/README.md):
  _ApplySet: `kubectl apply --prune` redesign and graduation strategy_.
--&gt;
&lt;h3 id=&#34;更多资源&#34;&gt;更多资源&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;想了解如何使用基于 ApplySet 的裁剪，请阅读 Kubernetes 文档中的
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/manage-kubernetes-objects/declarative-config/&#34;&gt;使用配置文件以声明方式管理 Kubernetes 对象&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;如需更深入地了解此特性的技术设计或了解如何用你自己工具实现 ApplySet 规范，
请参阅 &lt;a href=&#34;https://git.k8s.io/enhancements/keps/sig-cli/3659-kubectl-apply-prune/README.md&#34;&gt;KEP-3659&lt;/a&gt;:
&lt;strong&gt;ApplySet: &lt;code&gt;kubectl apply --prune&lt;/code&gt; 重新设计和进阶策略&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### How do I get involved?

If you want to get involved in ApplySet development, you can get in touch with the developers at
[SIG CLI](https://git.k8s.io/community/sig-cli). To provide feedback on the feature, please
[file a bug](https://github.com/kubernetes/kubectl/issues/new?assignees=knverey,justinsb&amp;labels=kind%2Fbug&amp;template=bug-report.md)
or [request an enhancement](https://github.com/kubernetes/kubectl/issues/new?assignees=knverey,justinsb&amp;labels=kind%2Fbug&amp;template=enhancement.md)
on the `kubernetes/kubectl` repository.
--&gt;
&lt;h3 id=&#34;如何参与&#34;&gt;如何参与&lt;/h3&gt;
&lt;p&gt;如果你想参与 ApplySet 的开发，可以联系 &lt;a href=&#34;https://git.k8s.io/community/sig-cli&#34;&gt;SIG CLI&lt;/a&gt; 的开发人员。
如需提供有关此特性的反馈，请在 &lt;code&gt;kubernetes/kubectl&lt;/code&gt;
代码库上&lt;a href=&#34;https://github.com/kubernetes/kubectl/issues/new?assignees=knverey,justinsb&amp;amp;labels=kind%2Fbug&amp;amp;template=bug-report.md&#34;&gt;提交 bug&lt;/a&gt;
或&lt;a href=&#34;https://github.com/kubernetes/kubectl/issues/new?assignees=knverey,justinsb&amp;amp;labels=kind%2Fbug&amp;amp;template=enhancement.md&#34;&gt;提出增强请求&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：介绍用于磁盘卷组快照的新 API</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/08/kubernetes-1-27-volume-group-snapshot-alpha/</link>
      <pubDate>Mon, 08 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/08/kubernetes-1-27-volume-group-snapshot-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Introducing An API For Volume Group Snapshots&#34;
date: 2023-05-08
slug: kubernetes-1-27-volume-group-snapshot-alpha
--&gt;
&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; Xing Yang (VMware)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;: &lt;a href=&#34;https://github.com/asa3311&#34;&gt;顾欣&lt;/a&gt;&lt;/p&gt;
&lt;!--
Volume group snapshot is introduced as an Alpha feature in Kubernetes v1.27.
This feature introduces a Kubernetes API that allows users to take crash consistent
snapshots for multiple volumes together. It uses a label selector to group multiple
`PersistentVolumeClaims` for snapshotting.
This new feature is only supported for [CSI](https://kubernetes-csi.github.io/docs/) volume drivers.
--&gt;
&lt;p&gt;磁盘卷组快照在 Kubernetes v1.27 中作为 Alpha 特性被引入。
此特性引入了一个 Kubernetes API，允许用户对多个卷进行快照，以保证在发生故障时数据的一致性。
它使用标签选择器来将多个 &lt;code&gt;PersistentVolumeClaims&lt;/code&gt; （持久卷申领）分组以进行快照。
这个新特性仅支持 CSI 卷驱动器。&lt;/p&gt;
&lt;!--
## An overview of volume group snapshots

Some storage systems provide the ability to create a crash consistent snapshot of
multiple volumes. A group snapshot represents “copies” from multiple volumes that
are taken at the same point-in-time. A group snapshot can be used either to rehydrate
new volumes (pre-populated with the snapshot data) or to restore existing volumes to
a previous state (represented by the snapshots).
--&gt;
&lt;h2 id=&#34;磁盘卷组快照概述&#34;&gt;磁盘卷组快照概述&lt;/h2&gt;
&lt;p&gt;一些存储系统提供了创建多个卷的崩溃一致性快照的能力。
卷组快照表示在同一时间点从多个卷中生成的“副本”。
卷组快照可以用来重新填充新的卷（预先填充快照数据）或者将现有卷恢复到以前的状态（由快照代表）。&lt;/p&gt;
&lt;!--
## Why add volume group snapshots to Kubernetes?

The Kubernetes volume plugin system already provides a powerful abstraction that
automates the provisioning, attaching, mounting, resizing, and snapshotting of block
and file storage.
--&gt;
&lt;h2 id=&#34;为什么要在-kubernetes-中添加卷组快照&#34;&gt;为什么要在 Kubernetes 中添加卷组快照？&lt;/h2&gt;
&lt;p&gt;Kubernetes 的卷插件系统已经提供了一个强大的抽象层，
可以自动化块存储和文件存储的制备、挂接、挂载、调整大小和快照等操作。&lt;/p&gt;
&lt;!--
Underpinning all these features is the Kubernetes goal of workload portability:
Kubernetes aims to create an abstraction layer between distributed applications and
underlying clusters so that applications can be agnostic to the specifics of the
cluster they run on and application deployment requires no cluster specific knowledge.
--&gt;
&lt;p&gt;所有这些特性的出发点是 Kubernetes 对工作负载可移植性的目标：
Kubernetes 致力于在分布式应用和底层集群之间创建一个抽象层，
使应用可以对承载它们的集群的特殊属性无感，应用部署不需要特定于某集群的知识。&lt;/p&gt;
&lt;!--
There is already a [VolumeSnapshot](/docs/concepts/storage/volume-snapshots/) API
that provides the ability to take a snapshot of a persistent volume to protect against
data loss or data corruption. However, there are other snapshotting functionalities
not covered by the VolumeSnapshot API.
--&gt;
&lt;p&gt;Kubernetes 已经提供了一个 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/volume-snapshots/&#34;&gt;VolumeSnapshot&lt;/a&gt; API，
这个 API 提供对持久性卷进行快照的能力，可用于防止数据丢失或数据损坏。然而，
还有一些其他的快照功能并未被 VolumeSnapshot API 所覆盖。&lt;/p&gt;
&lt;!--
Some storage systems support consistent group snapshots that allow a snapshot to be
taken from multiple volumes at the same point-in-time to achieve write order consistency.
This can be useful for applications that contain multiple volumes. For example,
an application may have data stored in one volume and logs stored in another volume.
If snapshots for the data volume and the logs volume are taken at different times,
the application will not be consistent and will not function properly if it is restored
from those snapshots when a disaster strikes.
--&gt;
&lt;p&gt;一些存储系统支持一致性的卷组快照，允许在同一时间点在多个卷上生成快照，以实现写入顺序的一致性。
这对于包含多个卷的应用非常有用。例如，应用可能在一个卷中存储数据，在另一个卷中存储日志。
如果数据卷和日志卷的快照在不同的时间点进行，应用将不会保持一致，
当灾难发生时从这些快照中恢复，应用将无法正常工作。&lt;/p&gt;
&lt;!--
It is true that you can quiesce the application first, take an individual snapshot from
each volume that is part of the application one after the other, and then unquiesce the
application after all the individual snapshots are taken. This way, you would get
application consistent snapshots.
--&gt;
&lt;p&gt;确实，你可以首先使应用静默，然后依次为构成应用的每个卷中生成一个独立的快照，
等所有的快照都已逐个生成后，再取消应用的静止状态。这样你就可以得到应用一致性的快照。&lt;/p&gt;
&lt;!--
However, sometimes it may not be possible to quiesce an application or the application
quiesce can be too expensive so you want to do it less frequently. Taking individual
snapshots one after another may also take longer time compared to taking a consistent
group snapshot. Some users may not want to do application quiesce very often for these
reasons. For example, a user may want to run weekly backups with application quiesce
and nightly backups without application quiesce but with consistent group support which
provides crash consistency across all volumes in the group.
--&gt;
&lt;p&gt;然而，有时可能无法使应用静默，或者使应用静默的代价过高，因此你希望较少地进行这个操作。
相较于生成一致性的卷组快照，依次生成单个快照可能需要更长的时间。
由于这些原因，有些用户可能不希望经常使应用静默。例如，
用户可能希望每周进行一次需要应用静默的备份，而在每晚进行不需应用静默但带有卷组一致性支持的备份，
这种一致性支持将确保组中所有卷的崩溃一致性。&lt;/p&gt;
&lt;!--
## Kubernetes Volume Group Snapshots API

Kubernetes Volume Group Snapshots introduce [three new API
objects](https://github.com/kubernetes-csi/external-snapshotter/blob/master/client/apis/volumegroupsnapshot/v1alpha1/types.go)
for managing snapshots:
--&gt;
&lt;h2 id=&#34;kubernetes-卷组快照-api&#34;&gt;Kubernetes 卷组快照 API&lt;/h2&gt;
&lt;p&gt;Kubernetes 卷组快照引入了
&lt;a href=&#34;https://github.com/kubernetes-csi/external-snapshotter/blob/master/client/apis/volumegroupsnapshot/v1alpha1/types.go&#34;&gt;三个新的 API 对象&lt;/a&gt;
用于管理快照：&lt;/p&gt;
&lt;!--
`VolumeGroupSnapshot`
: Created by a Kubernetes user (or perhaps by your own automation) to request
creation of a volume group snapshot for multiple persistent volume claims.
It contains information about the volume group snapshot operation such as the
timestamp when the volume group snapshot was taken and whether it is ready to use.
The creation and deletion of this object represents a desire to create or delete a
cluster resource (a group snapshot).
--&gt;
&lt;p&gt;&lt;code&gt;VolumeGroupSnapshot&lt;/code&gt;：由 Kubernetes 用户（或由你的自动化系统）创建，
以请求为多个持久卷申领创建卷组快照。它包含了关于卷组快照操作的信息，
如卷组快照的生成时间戳以及是否可直接使用。
此对象的创建和删除代表了创建或删除集群资源（一个卷组快照）的意愿。&lt;/p&gt;
&lt;!--
`VolumeGroupSnapshotContent`
: Created by the snapshot controller for a dynamically created VolumeGroupSnapshot.
It contains information about the volume group snapshot including the volume group
snapshot ID.
This object represents a provisioned resource on the cluster (a group snapshot).
The VolumeGroupSnapshotContent object binds to the VolumeGroupSnapshot for which it
was created with a one-to-one mapping.
--&gt;
&lt;p&gt;&lt;code&gt;VolumeGroupSnapshotContent&lt;/code&gt;：由快照控制器动态生成的 VolumeGroupSnapshot 所创建。
它包含了关于卷组快照的信息，包括卷组快照 ID。此对象代表了集群上制备的一个资源（一个卷组快照）。
VolumeGroupSnapshotContent 对象与其创建时所对应的 VolumeGroupSnapshot 之间存在一对一的映射。&lt;/p&gt;
&lt;!--
`VolumeGroupSnapshotClass`
: Created by cluster administrators to describe how volume group snapshots should be
created. including the driver information, the deletion policy, etc.

These three API kinds are defined as CustomResourceDefinitions (CRDs).
These CRDs must be installed in a Kubernetes cluster for a CSI Driver to support
volume group snapshots.
--&gt;
&lt;p&gt;&lt;code&gt;VolumeGroupSnapshotClass&lt;/code&gt;：由集群管理员创建，用来描述如何创建卷组快照，
包括驱动程序信息、删除策略等。&lt;/p&gt;
&lt;p&gt;这三种 API 类型被定义为自定义资源（CRD）。
这些 CRD 必须在 Kubernetes 集群中安装，以便 CSI 驱动程序支持卷组快照。&lt;/p&gt;
&lt;!--
## How do I use Kubernetes Volume Group Snapshots

Volume group snapshots are implemented in the
[external-snapshotter](https://github.com/kubernetes-csi/external-snapshotter) repository. Implementing volume
group snapshots meant adding or changing several components:
--&gt;
&lt;h2 id=&#34;如何使用-kubernetes-卷组快照&#34;&gt;如何使用 Kubernetes 卷组快照&lt;/h2&gt;
&lt;p&gt;卷组快照是在 &lt;a href=&#34;https://github.com/kubernetes-csi/external-snapshotter&#34;&gt;external-snapshotter&lt;/a&gt;
仓库中实现的。实现卷组快照意味着添加或更改几个组件：&lt;/p&gt;
&lt;!--
* Added new CustomResourceDefinitions for VolumeGroupSnapshot and two supporting APIs.
* Volume group snapshot controller logic is added to the common snapshot controller.
* Volume group snapshot validation webhook logic is added to the common snapshot validation webhook.
* Adding logic to make CSI calls into the snapshotter sidecar controller.
--&gt;
&lt;ul&gt;
&lt;li&gt;添加了新的 CustomResourceDefinition 用于 VolumeGroupSnapshot 和两个辅助性 API。&lt;/li&gt;
&lt;li&gt;向通用快照控制器中添加卷组快照控制器的逻辑。&lt;/li&gt;
&lt;li&gt;向通用快照验证 webhook 中添加卷组快照验证 webhook 的逻辑。&lt;/li&gt;
&lt;li&gt;添加逻辑以便在快照 sidecar 控制器中进行 CSI 调用。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
The volume snapshot controller, CRDs, and validation webhook are deployed once per
cluster, while the sidecar is bundled with each CSI driver.

Therefore, it makes sense to deploy the volume snapshot controller, CRDs, and validation
webhook as a cluster addon. I strongly recommend that Kubernetes distributors
bundle and deploy the volume snapshot controller, CRDs, and validation webhook as part
of their Kubernetes cluster management process (independent of any CSI Driver).
--&gt;
&lt;p&gt;每个集群只部署一次卷快照控制器、CRD 和验证 webhook，
而 sidecar 则与每个 CSI 驱动程序一起打包。&lt;/p&gt;
&lt;p&gt;因此，将卷快照控制器、CRD 和验证 webhook 作为集群插件部署是合理的。
我强烈建议 Kubernetes 发行版的厂商将卷快照控制器、
CRD 和验证 webhook 打包并作为他们的 Kubernetes 集群管理过程的一部分（独立于所有 CSI 驱动）。&lt;/p&gt;
&lt;!--
### Creating a new group snapshot with Kubernetes

Once a VolumeGroupSnapshotClass object is defined and you have volumes you want to
snapshot together, you may request a new group snapshot by creating a VolumeGroupSnapshot
object.
--&gt;
&lt;h3 id=&#34;使用-kubernetes-创建新的卷组快照&#34;&gt;使用 Kubernetes 创建新的卷组快照&lt;/h3&gt;
&lt;p&gt;一旦定义了一个 VolumeGroupSnapshotClass 对象，并且你有想要一起生成快照的卷，
就可以通过创建一个 VolumeGroupSnapshot 对象来请求一个新的卷组快照。&lt;/p&gt;
&lt;!--
The source of the group snapshot specifies whether the underlying group snapshot
should be dynamically created or if a pre-existing VolumeGroupSnapshotContent
should be used.

A pre-existing VolumeGroupSnapshotContent is created by a cluster administrator.
It contains the details of the real volume group snapshot on the storage system which
is available for use by cluster users.
--&gt;
&lt;p&gt;卷组快照的源指定了底层的卷组快照是应该动态创建，
还是应该使用预先存在的 VolumeGroupSnapshotContent。&lt;/p&gt;
&lt;p&gt;预先存在的 VolumeGroupSnapshotContent 由集群管理员创建。
其中包含了在存储系统上实际卷组快照的细节，这些卷组快照可供集群用户使用。&lt;/p&gt;
&lt;!--
One of the following members in the source of the group snapshot must be set.

* `selector` - a label query over PersistentVolumeClaims that are to be grouped
  together for snapshotting. This labelSelector will be used to match the label
  added to a PVC.
* `volumeGroupSnapshotContentName` - specifies the name of a pre-existing
  VolumeGroupSnapshotContent object representing an existing volume group snapshot.

In the following example, there are two PVCs.
--&gt;
&lt;p&gt;在卷组快照源中，必须设置以下成员之一。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;selector&lt;/code&gt; - 针对要一起生成快照的 PersistentVolumeClaims 的标签查询。
该 labelSelector 将用于匹配添加到 PVC 上的标签。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;volumeGroupSnapshotContentName&lt;/code&gt; - 指定一个现有的 VolumeGroupSnapshotContent
对象的名称，该对象代表着一个已存在的卷组快照。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;在以下示例中，有两个 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-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;NAME        STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;pvc-0       Bound     pvc-a42d7ea2-e3df-11ed-b5ea-0242ac120002   1Gi        RWO           48s
&lt;/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;pvc-1       Bound     pvc-a42d81b8-e3df-11ed-b5ea-0242ac120002   1Gi        RWO           48s
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
Label the PVCs.
--&gt;
&lt;p&gt;标记 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-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 label pvc pvc-0 &lt;span style=&#34;color:#b8860b&#34;&gt;group&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;myGroup
&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;persistentvolumeclaim/pvc-0 labeled
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#888&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;%&lt;/span&gt; kubectl label pvc pvc-1 &lt;span style=&#34;color:#b8860b&#34;&gt;group&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;myGroup
&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;persistentvolumeclaim/pvc-1 labeled
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
For dynamic provisioning, a selector must be set so that the snapshot controller can
find PVCs with the matching labels to be snapshotted together.
--&gt;
&lt;p&gt;对于动态制备，必须设置一个选择算符，以便快照控制器可以找到带有匹配标签的 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;groupsnapshot.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;VolumeGroupSnapshot&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;new-group-snapshot-demo&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;demo-namespace&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;volumeGroupSnapshotClassName&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;csi-groupSnapclass&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;selector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;group&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;myGroup&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 the VolumeGroupSnapshot spec, a user can specify the VolumeGroupSnapshotClass which
has the information about which CSI driver should be used for creating the group snapshot.

Two individual volume snapshots will be created as part of the volume group snapshot creation.
--&gt;
&lt;p&gt;在 VolumeGroupSnapshot 的规约中，用户可以指定 VolumeGroupSnapshotClass，
其中包含应使用哪个 CSI 驱动程序来创建卷组快照的信息。&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-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;snapshot-62abb5db7204ac6e4c1198629fec533f2a5d9d60ea1a25f594de0bf8866c7947-2023-04-26-2.20.4
&lt;/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;snapshot-2026811eb9f0787466171fe189c805a22cdb61a326235cd067dc3a1ac0104900-2023-04-26-2.20.4
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
### How to use group snapshot for restore in Kubernetes

At restore time, the user can request a new PersistentVolumeClaim to be created from
a VolumeSnapshot object that is part of a VolumeGroupSnapshot. This will trigger
provisioning of a new volume that is pre-populated with data from the specified
snapshot. The user should repeat this until all volumes are created from all the
snapshots that are part of a group snapshot.
--&gt;
&lt;h3 id=&#34;如何在-kubernetes-中使用卷组快照进行恢复&#34;&gt;如何在 Kubernetes 中使用卷组快照进行恢复&lt;/h3&gt;
&lt;p&gt;在恢复时，用户可以请求某 VolumeGroupSnapshot 的一部分，即某个 VolumeSnapshot 对象，
创建一个新的 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;pvc0-restore&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;demo-namespace&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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-hostpath-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;dataSource&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;snapshot-62abb5db7204ac6e4c1198629fec533f2a5d9d60ea1a25f594de0bf8866c7947-2023-04-26-2.20.4&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;VolumeSnapshot&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;apiGroup&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;snapshot.storage.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;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;1Gi&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;!--
## As a storage vendor, how do I add support for group snapshots to my CSI driver?

To implement the volume group snapshot feature, a CSI driver **must**:

* Implement a new group controller service.
* Implement group controller RPCs: `CreateVolumeGroupSnapshot`, `DeleteVolumeGroupSnapshot`, and `GetVolumeGroupSnapshot`.
* Add group controller capability `CREATE_DELETE_GET_VOLUME_GROUP_SNAPSHOT`.
--&gt;
&lt;h2 id=&#34;作为一个存储供应商-我应该如何为我的-csi-驱动程序添加对卷组快照的支持&#34;&gt;作为一个存储供应商，我应该如何为我的 CSI 驱动程序添加对卷组快照的支持？&lt;/h2&gt;
&lt;p&gt;要实现卷组快照功能，CSI 驱动&lt;strong&gt;必须&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;实现一个新的组控制器服务。&lt;/li&gt;
&lt;li&gt;实现组控制器的 RPC：&lt;code&gt;CreateVolumeGroupSnapshot&lt;/code&gt;，&lt;code&gt;DeleteVolumeGroupSnapshot&lt;/code&gt; 和 &lt;code&gt;GetVolumeGroupSnapshot&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;添加组控制器的特性 &lt;code&gt;CREATE_DELETE_GET_VOLUME_GROUP_SNAPSHOT&lt;/code&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
See the [CSI spec](https://github.com/container-storage-interface/spec/blob/master/spec.md)
and the [Kubernetes-CSI Driver Developer Guide](https://kubernetes-csi.github.io/docs/)
for more details.

a CSI Volume Driver as possible, it provides a suggested mechanism to deploy a
containerized CSI driver to simplify the process.
--&gt;
&lt;p&gt;更多详情请参阅
&lt;a href=&#34;https://github.com/container-storage-interface/spec/blob/master/spec.md&#34;&gt;CSI规范&lt;/a&gt;
和 &lt;a href=&#34;https://kubernetes-csi.github.io/docs/&#34;&gt;Kubernetes-CSI驱动程序开发指南&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;对于 CSI 卷驱动程序，它提供了一种建议采用的机制来部署容器化的 CSI 驱动程序以简化流程。&lt;/p&gt;
&lt;!--
As part of this recommended deployment process, the Kubernetes team provides a number of
sidecar (helper) containers, including the
[external-snapshotter sidecar container](https://kubernetes-csi.github.io/docs/external-snapshotter.html)
which has been updated to support volume group snapshot.
--&gt;
&lt;p&gt;作为所推荐的部署过程的一部分，Kubernetes 团队提供了许多 sidecar（辅助）容器，
包括已经更新以支持卷组快照的
&lt;a href=&#34;https://kubernetes-csi.github.io/docs/external-snapshotter.html&#34;&gt;external-snapshotter&lt;/a&gt;
sidecar 容器。&lt;/p&gt;
&lt;!--
The external-snapshotter watches the Kubernetes API server for the
`VolumeGroupSnapshotContent` object and triggers `CreateVolumeGroupSnapshot` and
`DeleteVolumeGroupSnapshot` operations against a CSI endpoint.
--&gt;
&lt;p&gt;external-snapshotter 会监听 Kubernetes API 服务器上的 &lt;code&gt;VolumeGroupSnapshotContent&lt;/code&gt; 对象，
并对 CSI 端点触发 &lt;code&gt;CreateVolumeGroupSnapshot&lt;/code&gt; 和 &lt;code&gt;DeleteVolumeGroupSnapshot&lt;/code&gt; 操作。&lt;/p&gt;
&lt;!--
## What are the limitations?

The alpha implementation of volume group snapshots for Kubernetes has the following
limitations:

* Does not support reverting an existing PVC to an earlier state represented by
  a snapshot (only supports provisioning a new volume from a snapshot).
* No application consistency guarantees beyond any guarantees provided by the storage system
  (e.g. crash consistency). See this [doc](https://github.com/kubernetes/community/blob/master/wg-data-protection/data-protection-workflows-white-paper.md#quiesce-and-unquiesce-hooks)
  for more discussions on application consistency.
--&gt;
&lt;h2 id=&#34;有哪些限制&#34;&gt;有哪些限制？&lt;/h2&gt;
&lt;p&gt;Kubernetes 的卷组快照的 Alpha 版本具有以下限制：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;不支持将现有的 PVC 还原到由快照表示的较早状态（仅支持从快照创建新的卷）。&lt;/li&gt;
&lt;li&gt;除了存储系统提供的保证（例如崩溃一致性）之外，不提供应用一致性保证。
请参阅此&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/wg-data-protection/data-protection-workflows-white-paper.md#quiesce-and-unquiesce-hooks&#34;&gt;文档&lt;/a&gt;，
了解有关应用一致性的更多讨论。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## What’s next?

Depending on feedback and adoption, the Kubernetes team plans to push the CSI
Group Snapshot implementation to Beta in either 1.28 or 1.29.
Some of the features we are interested in supporting include volume replication,
replication group, volume placement, application quiescing, changed block tracking, and more.
--&gt;
&lt;h2 id=&#34;下一步是什么&#34;&gt;下一步是什么？&lt;/h2&gt;
&lt;p&gt;根据反馈和采用情况，Kubernetes 团队计划在 1.28 或 1.29 版本中将 CSI 卷组快照实现推进到 Beta 阶段。
我们有兴趣支持的一些功能包括卷复制、复制组、卷位置选择、应用静默、变更块跟踪等等。&lt;/p&gt;
&lt;!--
## How can I learn more?

- The [design spec](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3476-volume-group-snapshot)
  for the volume group snapshot feature.
- The [code repository](https://github.com/kubernetes-csi/external-snapshotter) for volume group
  snapshot APIs and controller.
- CSI [documentation](https://kubernetes-csi.github.io/docs/) on the group snapshot feature.
--&gt;
&lt;h2 id=&#34;如何获取更多信息&#34;&gt;如何获取更多信息？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;有关卷组快照功能的&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3476-volume-group-snapshot&#34;&gt;设计规约&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;卷组快照 API 和控制器的&lt;a href=&#34;https://github.com/kubernetes-csi/external-snapshotter&#34;&gt;代码仓库&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;CSI 关于卷组快照功能的&lt;a href=&#34;https://kubernetes-csi.github.io/docs/&#34;&gt;文档&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How do I get involved?

This project, like all of Kubernetes, is the result of hard work by many contributors
from diverse backgrounds working together. On behalf of SIG Storage, I would like to
offer a huge thank you to the contributors who stepped up these last few quarters
to help the project reach alpha:
--&gt;
&lt;h2 id=&#34;如何参与其中&#34;&gt;如何参与其中？&lt;/h2&gt;
&lt;p&gt;这个项目，就像 Kubernetes 的所有项目一样，是许多不同背景的贡献者共同努力的结果。
我代表 SIG Storage，
向在过去几个季度中积极参与项目并帮助项目达到 Alpha 版本的贡献者们表示衷心的感谢：&lt;/p&gt;
&lt;!--
* Alex Meade ([ameade](https://github.com/ameade))
* Ben Swartzlander ([bswartz](https://github.com/bswartz))
* Humble Devassy Chirammal ([humblec](https://github.com/humblec))
* James Defelice ([jdef](https://github.com/jdef))
* Jan Šafránek ([jsafrane](https://github.com/jsafrane))
* Jing Xu ([jingxu97](https://github.com/jingxu97))
* Michelle Au ([msau42](https://github.com/msau42))
* Niels de Vos ([nixpanic](https://github.com/nixpanic))
* Rakshith R ([Rakshith-R](https://github.com/Rakshith-R))
* Raunak Shah ([RaunakShah](https://github.com/RaunakShah))
* Saad Ali ([saad-ali](https://github.com/saad-ali))
* Thomas Watson ([rbo54](https://github.com/rbo54))
* Xing Yang ([xing-yang](https://github.com/xing-yang))
* Yati Padia ([yati1998](https://github.com/yati1998))
--&gt;
&lt;ul&gt;
&lt;li&gt;Alex Meade (&lt;a href=&#34;https://github.com/ameade&#34;&gt;ameade&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ben Swartzlander (&lt;a href=&#34;https://github.com/bswartz&#34;&gt;bswartz&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Humble Devassy Chirammal (&lt;a href=&#34;https://github.com/humblec&#34;&gt;humblec&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;James Defelice (&lt;a href=&#34;https://github.com/jdef&#34;&gt;jdef&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;Jing Xu (&lt;a href=&#34;https://github.com/jingxu97&#34;&gt;jingxu97&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;Niels de Vos (&lt;a href=&#34;https://github.com/nixpanic&#34;&gt;nixpanic&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Rakshith R (&lt;a href=&#34;https://github.com/Rakshith-R&#34;&gt;Rakshith-R&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Raunak Shah (&lt;a href=&#34;https://github.com/RaunakShah&#34;&gt;RaunakShah&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Saad Ali (&lt;a href=&#34;https://github.com/saad-ali&#34;&gt;saad-ali&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Thomas Watson (&lt;a href=&#34;https://github.com/rbo54&#34;&gt;rbo54&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;li&gt;Yati Padia (&lt;a href=&#34;https://github.com/yati1998&#34;&gt;yati1998&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
We also want to thank everyone else who has contributed to the project, including others 
who helped review the [KEP](https://github.com/kubernetes/enhancements/pull/1551)
and the [CSI spec PR](https://github.com/container-storage-interface/spec/pull/519).

For those interested in getting involved with the design and development of CSI or
any part of the Kubernetes Storage system, join the
[Kubernetes Storage Special Interest Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG).
We always welcome new contributors.

We also hold regular [Data Protection Working Group meetings](https://docs.google.com/document/d/15tLCV3csvjHbKb16DVk-mfUmFry_Rlwo-2uG6KNGsfw/edit#).
New attendees are welcome to join our discussions.
--&gt;
&lt;p&gt;我们还要感谢其他为该项目做出贡献的人，
包括帮助审核 &lt;a href=&#34;https://github.com/kubernetes/enhancements/pull/1551&#34;&gt;KEP&lt;/a&gt;和
&lt;a href=&#34;https://github.com/container-storage-interface/spec/pull/519&#34;&gt;CSI 规约 PR&lt;/a&gt;的其他人员。&lt;/p&gt;
&lt;p&gt;对于那些对参与 CSI 设计和开发或 Kubernetes 存储系统感兴趣的人，
欢迎加入 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes存储特别兴趣小组&lt;/a&gt;（SIG）。
我们随时欢迎新的贡献者。&lt;/p&gt;
&lt;p&gt;我们还定期举行&lt;a href=&#34;https://docs.google.com/document/d/15tLCV3csvjHbKb16DVk-mfUmFry_Rlwo-2uG6KNGsfw/edit#&#34;&gt;数据保护工作组会议&lt;/a&gt;。
欢迎新的与会者加入我们的讨论。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：内存资源的服务质量（QoS）Alpha</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/05/qos-memory-resources/</link>
      <pubDate>Fri, 05 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/05/qos-memory-resources/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.27: Quality-of-Service for Memory Resources (alpha)&#39;
date: 2023-05-05
slug: qos-memory-resources
--&gt;
&lt;!--
**Authors:** Dixita Narang (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Dixita Narang (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
Kubernetes v1.27, released in April 2023, introduced changes to Memory QoS (alpha) to improve memory management capabilites in Linux nodes.
--&gt;
&lt;p&gt;Kubernetes v1.27 于 2023 年 4 月发布，引入了对内存 QoS（Alpha）的更改，用于提高 Linux 节点中的内存管理功能。&lt;/p&gt;
&lt;!--
Support for Memory QoS was initially added in Kubernetes v1.22, and later some
[limitations](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2570-memory-qos#reasons-for-changing-the-formula-of-memoryhigh-calculation-in-alpha-v127)
around the formula for calculating `memory.high` were identified. These limitations are addressed in Kubernetes v1.27.
--&gt;
&lt;p&gt;对内存 QoS 的支持最初是在 Kubernetes v1.22 中添加的，后来发现了关于计算 &lt;code&gt;memory.high&lt;/code&gt;
公式的一些&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2570-memory-qos#reasons-for-changing-the-formula-of-memoryhigh-calculation-in-alpha-v127&#34;&gt;不足&lt;/a&gt;。
这些不足在 Kubernetes v1.27 中得到解决。&lt;/p&gt;
&lt;!--
## Background
--&gt;
&lt;h2 id=&#34;background&#34;&gt;背景&lt;/h2&gt;
&lt;!--
Kubernetes allows you to optionally specify how much of each resources a container needs
in the Pod specification. The most common resources to specify are CPU and Memory.
--&gt;
&lt;p&gt;Kubernetes 允许你在 Pod 规约中设置某容器对每类资源的需求。通常要设置的资源是 CPU 和内存。&lt;/p&gt;
&lt;!--
For example, a Pod manifest that defines container resource requirements could look like:
--&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;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&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;nginx&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;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;memory&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;64Mi&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;cpu&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;250m&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;limits&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;memory&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;64Mi&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;cpu&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;500m&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;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;spec.containers[].resources.requests&lt;/code&gt;&lt;/p&gt;
&lt;!--
When you specify the resource request for containers in a Pod, the
[Kubernetes scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/#kube-scheduler)
uses this information to decide which node to place the Pod on. The scheduler
ensures that for each resource type, the sum of the resource requests of the
scheduled containers is less than the total allocatable resources on the node.
--&gt;
&lt;p&gt;当你为 Pod 中的容器设置资源请求时，
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/kube-scheduler/#kube-scheduler&#34;&gt;Kubernetes 调度器&lt;/a&gt;使用此信息来决定将 Pod 放置在哪个节点上。
调度器确保对于每种资源类型，已调度容器的资源请求总和小于节点上可分配资源的总量。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;spec.containers[].resources.limits&lt;/code&gt;&lt;/p&gt;
&lt;!--
When you specify the resource limit for containers in a Pod, the kubelet enforces
those limits so that the running containers are not allowed to use more of those
resources than the limits you set.
--&gt;
&lt;p&gt;当你为 Pod 中的容器设置资源限制时，kubelet 会强制实施这些限制，
以便运行的容器使用的资源不得超过你设置的限制。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
When the kubelet starts a container as a part of a Pod, kubelet passes the
container&#39;s requests and limits for CPU and memory to the container runtime.
The container runtime assigns both CPU request and CPU limit to a container.
Provided the system has free CPU time, the containers are guaranteed to be
allocated as much CPU as they request. Containers cannot use more CPU than
the configured limit i.e. containers CPU usage will be throttled if they
use more CPU than the specified limit within a given time slice.
--&gt;
&lt;p&gt;当 kubelet 将容器作为 Pod 的一部分启动时，kubelet 会将容器的 CPU 和内存请求和限制传递给容器运行时。
容器运行时将 CPU 请求和 CPU 限制设置到容器上。如果系统有空闲的 CPU 时间，
就保证为容器分配它们请求的 CPU 数量。容器使用的 CPU 数量不能超过配置的限制，
即，如果容器在给定时间片内使用的 CPU 数量超过指定的限制，则容器的 CPU 使用率将受到限制。&lt;/p&gt;
&lt;!--
Prior to Memory QoS feature, the container runtime only used the memory limit
and discarded the memory `request` (requests were, and still are, also used to
influence [scheduling](/docs/concepts/scheduling-eviction/#scheduling)).
If a container uses more memory than the configured limit, the Linux Out Of Memory (OOM) killer will be invoked.
--&gt;
&lt;p&gt;在内存 QoS 特性出现之前，容器运行时仅使用内存限制并忽略内存的 &lt;code&gt;request&lt;/code&gt;
（请求值从前到现在一直被用于影响&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/#scheduling&#34;&gt;调度&lt;/a&gt;）。
如果容器使用的内存超过所配置的限制，则会调用 Linux 内存不足（OOM）杀手机制。&lt;/p&gt;
&lt;!--
Let&#39;s compare how the container runtime on Linux typically configures memory request and limit in cgroups, with and without Memory QoS feature:
--&gt;
&lt;p&gt;让我们比较一下在有和没有内存 QoS 特性时，Linux 上的容器运行时通常如何在 cgroup 中配置内存请求和限制：&lt;/p&gt;
&lt;!--
* **Memory request**
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;内存请求&lt;/strong&gt;&lt;/p&gt;
&lt;!--
The memory request is mainly used by kube-scheduler during (Kubernetes) Pod scheduling.
In cgroups v1, there are no controls to specify the minimum amount of memory the cgroups
must always retain. Hence, the container runtime did not use the value of requested memory set in the Pod spec.
--&gt;
&lt;p&gt;内存请求主要由 kube-scheduler 在（Kubernetes）Pod 调度时使用。
在 cgroups v1 中，没有任何控件来设置 cgroup 必须始终保留的最小内存量。
因此，容器运行时不使用 Pod 规约中设置的内存请求值。&lt;/p&gt;
&lt;!--
cgroups v2 introduced a `memory.min` setting, used to specify the minimum amount of memory
that should remain available to the processes within a given cgroup.
If the memory usage of a cgroup is within its effective min boundary,
the cgroup’s memory won’t be reclaimed under any conditions.
If the kernel cannot maintain at least `memory.min` bytes of memory for the processes within the cgroup,
the kernel invokes its OOM killer. In other words, the kernel guarantees at least this
much memory is available or terminates processes (which may be outside the cgroup)
in order to make memory more available. Memory QoS maps `memory.min` to
`spec.containers[].resources.requests.memory` to ensure the availability of memory for containers in Kubernetes Pods.
--&gt;
&lt;p&gt;cgroups v2 中引入了一个 &lt;code&gt;memory.min&lt;/code&gt; 设置，用于设置给定 cgroup 中的进程确定可用的最小内存量。
如果 cgroup 的内存使用量在其有效最小边界内，则该 cgroup 的内存在任何情况下都不会被回收。
如果内核无法为 cgroup 中的进程维护至少 &lt;code&gt;memory.min&lt;/code&gt; 字节的内存，内核将调用其 OOM 杀手机制。
换句话说，内核保证至少有这么多内存可用，或者终止进程（可能在 cgroup 之外）以腾出更多内存。
MemoryQoS 机制将 &lt;code&gt;memory.min&lt;/code&gt; 映射到 &lt;code&gt;spec.containers[].resources.requests.memory&lt;/code&gt;，
以确保 Kubernetes Pod 中容器的内存可用性。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
* **Memory limit**
--&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;内存限制&lt;/strong&gt;&lt;/p&gt;
&lt;!--
The `memory.limit` specifies the memory limit, beyond which if the container
tries to allocate more memory, Linux kernel will terminate a process with an
OOM (Out of Memory) kill. If the terminated process was the main (or only)
process inside the container, the container may exit.
--&gt;
&lt;p&gt;&lt;code&gt;memory.limit&lt;/code&gt; 指定内存限制，如果容器尝试分配更多内存，超出该限制，
Linux 内核将通过 OOM（内存不足）来杀死并终止进程。如果终止的进程是容器内的主
（或唯一）进程，则容器可能会退出。&lt;/p&gt;
&lt;!--
In cgroups v1, `memory.limit_in_bytes` interface is used to set the memory usage limit.
However, unlike CPU, it was not possible to apply memory throttling: as soon as a container
crossed the memory limit, it would be OOM killed.
--&gt;
&lt;p&gt;在 cgroups v1 中，&lt;code&gt;memory.limit_in_bytes&lt;/code&gt; 接口用于设置内存用量限制。
然而，与 CPU 不同的是，内存用量是无法抑制的：一旦容器超过内存限制，它就会被 OOM 杀死。&lt;/p&gt;
&lt;!--
In cgroups v2, `memory.max` is analogous to `memory.limit_in_bytes` in cgroupv1.
Memory QoS maps `memory.max` to `spec.containers[].resources.limits.memory` to
specify the hard limit for memory usage. If the memory consumption goes above
this level, the kernel invokes its OOM Killer.
--&gt;
&lt;p&gt;在 cgroups v2 中，&lt;code&gt;memory.max&lt;/code&gt; 类似于 cgroupv1 中的 &lt;code&gt;memory.limit_in_bytes&lt;/code&gt;。
MemoryQoS 机制将 &lt;code&gt;memory.max&lt;/code&gt; 映射到 &lt;code&gt;spec.containers[].resources.limits.memory&lt;/code&gt;
以设置内存用量的硬性限制。如果内存消耗超过此水平，内核将调用其 OOM 杀手机制。&lt;/p&gt;
&lt;!--
cgroups v2 also added `memory.high` configuration . Memory QoS uses `memory.high`
to set memory usage throttle limit. If the `memory.high` limit is breached,
the offending cgroups are throttled, and the kernel tries to reclaim memory which may avoid an OOM kill.
--&gt;
&lt;p&gt;cgroups v2 中还添加了 &lt;code&gt;memory.high&lt;/code&gt; 配置。MemoryQoS 机制使用 &lt;code&gt;memory.high&lt;/code&gt; 来设置内存用量抑制上限。
如果超出了 &lt;code&gt;memory.high&lt;/code&gt; 限制，则违规的 cgroup 会受到抑制，并且内核会尝试回收内存，这可能会避免 OOM 终止。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How it works
--&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;如何工作&lt;/h2&gt;
&lt;!--
### Cgroups v2 memory controller interfaces &amp; Kubernetes container resources mapping
--&gt;
&lt;h3 id=&#34;cgroups-v2-memory-controller-interfaces-kubernetes-container-resources-mapping&#34;&gt;Cgroups v2 内存控制器接口和 Kubernetes 容器资源映&lt;/h3&gt;
&lt;!--
Memory QoS uses the memory controller of cgroups v2 to guarantee memory resources
in Kubernetes. cgroupv2 interfaces that this feature uses are:
--&gt;
&lt;p&gt;MemoryQoS 机制使用 cgroups v2 的内存控制器来保证 Kubernetes 中的内存资源。
此特性使用的 cgroupv2 接口有：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;memory.max&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;memory.min&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;memory.high&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/memory-qos-cal.svg&#34;
         alt=&#34;Memory QoS Levels&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;Memory QoS Levels&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

--&gt;

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/memory-qos-cal.svg&#34;
         alt=&#34;内存 QoS 级别&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;内存 QoS 级别&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

&lt;!--
`memory.max` is mapped to `limits.memory` specified in the Pod spec.
The kubelet and the container runtime configure the limit in the respective cgroup.
The kernel enforces the limit to prevent the container from using more than the
configured resource limit. If a process in a container tries to consume more
than the specified limit, kernel terminates a process(es) with an out of memory Out of Memory (OOM) error.
--&gt;
&lt;p&gt;&lt;code&gt;memory.max&lt;/code&gt; 映射到 Pod 规约中指定的 &lt;code&gt;limits.memory&lt;/code&gt;。
kubelet 和容器运行时在对应的 cgroup 中配置限制值。内核强制执行限制机制以防止容器用量超过所配置的资源限制。
如果容器中的进程尝试消耗的资源超过所设置的限制值，内核将终止进程并报告内存不足（OOM）错误。&lt;/p&gt;
&lt;!--

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-max.svg&#34;
         alt=&#34;memory.max maps to limits.memory&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.max maps to limits.memory&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

--&gt;

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-max.svg&#34;
         alt=&#34;memory.max 映射到 limit.memory&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.max 映射到 limit.memory&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

&lt;!--
`memory.min` is mapped to `requests.memory`, which results in reservation of
memory resources that should never be reclaimed by the kernel.
This is how Memory QoS ensures the availability of memory for Kubernetes pods.
If there&#39;s no unprotected reclaimable memory available, the OOM killer is
invoked to make more memory available.
--&gt;
&lt;p&gt;&lt;code&gt;memory.min&lt;/code&gt; 被映射到 &lt;code&gt;requests.memory&lt;/code&gt;，这会导致内存资源被预留而永远不会被内核回收。
这就是 MemoryQoS 机制确保 Kubernetes Pod 内存可用性的方式。
如果没有不受保护的、可回收的内存，则内核会调用 OOM 杀手以提供更多可用内存。&lt;/p&gt;
&lt;!--

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-min.svg&#34;
         alt=&#34;memory.min maps to requests.memory&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.min maps to requests.memory&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

--&gt;

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-min.svg&#34;
         alt=&#34;memory.min 映射到 requests.memory&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.min 映射到 requests.memory&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

&lt;!--
For memory protection, in addition to the original way of limiting memory usage,
Memory QoS throttles workload approaching its memory limit, ensuring that the system
is not overwhelmed by sporadic increases in memory usage. A new field, `memoryThrottlingFactor`,
is available in the KubeletConfiguration when you enable MemoryQoS feature. It is set to 0.9 by default.
`memory.high` is mapped to throttling limit calculated by using `memoryThrottlingFactor`,
`requests.memory` and `limits.memory` as in the formula below, and rounding down the value to the nearest page size:
--&gt;
&lt;p&gt;对于内存保护，除了原来的限制内存用量的方式之外，MemoryQoS 机制还会对用量接近其内存限制的工作负载进行抑制，
确保系统不会因内存使用的零星增加而不堪重负。当你启用 MemoryQoS 特性时，
KubeletConfiguration 中将提供一个新字段 &lt;code&gt;memoryThrottlingFactor&lt;/code&gt;。默认设置为 0.9。
&lt;code&gt;memory.high&lt;/code&gt; 被映射到通过 &lt;code&gt;memoryThrottlingFactor&lt;/code&gt;、&lt;code&gt;requests.memory&lt;/code&gt; 和 &lt;code&gt;limits.memory&lt;/code&gt;
计算得出的抑制上限，计算方法如下式所示，所得的值向下舍入到最接近的页面大小：&lt;/p&gt;
&lt;!--

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high.svg&#34;
         alt=&#34;memory.high formula&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.high formula&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

--&gt;

&lt;figure&gt;
    &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high.svg&#34;
         alt=&#34;memory.high 公式&#34;/&gt; &lt;figcaption&gt;
            &lt;h4&gt;memory.high 公式&lt;/h4&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

&lt;!--
**Note**: If a container has no memory limits specified, `limits.memory` is substituted for node allocatable memory.
--&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：如果容器没有指定内存限制，则 &lt;code&gt;limits.memory&lt;/code&gt; 将被替换为节点可分配内存的值。&lt;/p&gt;
&lt;!--
**Summary:**
--&gt;
&lt;p&gt;&lt;strong&gt;总结：&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
    &lt;tr&gt;
        &lt;!--
        &lt;th style=&#34;text-align:center&#34;&gt;File&lt;/th&gt;
        &lt;th style=&#34;text-align:center&#34;&gt;Description&lt;/th&gt;
        --&gt;
        &lt;th style=&#34;text-align:center&#34;&gt;文件&lt;/th&gt;
        &lt;th style=&#34;text-align:center&#34;&gt;描述&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;memory.max&lt;/td&gt;
        &lt;!-- &lt;td&gt;&lt;code&gt;memory.max&lt;/code&gt; specifies the maximum memory limit, a container
        is allowed to use. If a process within the container tries to consume more memory than the configured limit,
        the kernel terminates the process with an Out of Memory (OOM) error.
        &lt;br&gt;
        &lt;br&gt;
        &lt;i&gt;It is mapped to the container&#39;s memory limit specified in Pod manifest.&lt;/i&gt;
        &lt;/td&gt; --&gt;
        &lt;td&gt;&lt;code&gt;memory.max&lt;/code&gt; 指定允许容器使用的最大内存限制。
        如果容器内的进程尝试使用的内存量超过所配置的限制值，内核将终止该进程并显示内存不足（OOM）错误。
        &lt;br&gt;
        &lt;br&gt;
        &lt;i&gt;此配置映射到 Pod 清单中指定的容器内存限制。&lt;/i&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;memory.min&lt;/td&gt;
        &lt;!--
        &lt;td&gt;&lt;code&gt;memory.min&lt;/code&gt; specifies a minimum amount of memory the cgroups must always retain, i.e.,
        memory that should never be reclaimed by the system. If there&#39;s no unprotected reclaimable memory available, OOM kill is invoked.
        &lt;br&gt;
        &lt;br&gt;
        &lt;i&gt;It is mapped to the container&#39;s memory request specified in the Pod manifest.&lt;/i&gt;
        &lt;/td&gt;
        --&gt;
        &lt;td&gt;&lt;code&gt;memory.min&lt;/code&gt; 指定 cgroup 必须始终保留的最小内存量，
        即系统永远不应回收的内存。如果没有可用的未受保护的可回收内存，则会调用 OOM 终止程序。
        &lt;br&gt;
        &lt;br&gt;
        &lt;i&gt;此配置映射到 Pod 清单中指定的容器的内存请求。&lt;/i&gt;
        &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td&gt;memory.high&lt;/td&gt;
       &lt;!--
       &lt;td&gt;&lt;code&gt;memory.high&lt;/code&gt; specifies the memory usage throttle limit. This is the main
       mechanism to control a cgroup&#39;s memory use. If cgroups memory use goes over the high boundary
       specified here, the cgroups processes are throttled and put under heavy reclaim pressure.
       &lt;br&gt;
       &lt;br&gt;
       &lt;i&gt;Kubernetes uses a formula to calculate &lt;code&gt;memory.high&lt;/code&gt;, depending on container&#39;s memory request,
        memory limit or node allocatable memory (if container&#39;s memory limit is empty) and a throttling factor.
        Please refer to the &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2570-memory-qos&#34;&gt;KEP&lt;/a&gt; for more details on the formula.&lt;/i&gt;
       &lt;/td&gt;
       --&gt;
       &lt;td&gt;&lt;code&gt;memory.high&lt;/code&gt; 指定内存用量抑制上限。这是控制 cgroup 内存用量的主要机制。
       如果 cgroups 内存使用量超过此处指定的上限，则 cgroups 进程将受到抑制并标记回收压力较大。
       &lt;br&gt;
       &lt;br&gt;
       &lt;i&gt;Kubernetes 使用公式来计算 &lt;code&gt;memory.high&lt;/code&gt;，具体取决于容器的内存请求、
       内存限制或节点可分配内存（如果容器的内存限制为空）和抑制因子。有关公式的更多详细信息，
       请参阅 &lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2570-memory-qos&#34;&gt;KEP&lt;/a&gt;。&lt;/i&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;!--
**Note** `memory.high` is set only on container level cgroups while `memory.min` is set on container, pod, and node level cgroups.
--&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：&lt;code&gt;memory.high&lt;/code&gt; 仅可在容器级别的 cgroups 上设置，
而 &lt;code&gt;memory.min&lt;/code&gt; 则可在容器、Pod 和节点级别的 cgroups 上设置。&lt;/p&gt;
&lt;!--
### `memory.min` calculations for cgroups heirarchy
--&gt;
&lt;h3 id=&#34;memory-min-calculations-for-cgroups-heirarchy&#34;&gt;针对 cgroup 层次结构的 &lt;code&gt;memory.min&lt;/code&gt; 计算&lt;/h3&gt;
&lt;!--
When container memory requests are made, kubelet passes `memory.min` to the back-end CRI
runtime (such as containerd or CRI-O) via the `Unified` field in CRI during container creation.
The `memory.min` in container level cgroups will be set to:
--&gt;
&lt;p&gt;当发出容器内存请求时，kubelet 在创建容器期间通过 CRI 中的 &lt;code&gt;Unified&lt;/code&gt; 字段将 &lt;code&gt;memory.min&lt;/code&gt;
传递给后端 CRI 运行时（例如 containerd 或 CRI-O）。容器级别 cgroup 中的 &lt;code&gt;memory.min&lt;/code&gt; 将设置为：&lt;/p&gt;
&lt;p&gt;$memory.min =  pod.spec.containers[i].resources.requests[memory]$&lt;/p&gt;
&lt;!--
&lt;sub&gt;for every i&lt;sup&gt;th&lt;/sup&gt; container in a pod&lt;/sub&gt;
--&gt;
&lt;p&gt;&lt;sub&gt;对于 Pod 中每个 i&lt;sup&gt;th&lt;/sup&gt; 容器&lt;/sub&gt;
&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;!--
Since the `memory.min` interface requires that the ancestor cgroups directories are all set,
the pod and node cgroups directories need to be set correctly. 
--&gt;
&lt;p&gt;由于 &lt;code&gt;memory.min&lt;/code&gt; 接口要求祖先 cgroups 目录全部被设置，
因此需要正确设置 Pod 和节点的 cgroups 目录。&lt;/p&gt;
&lt;!--
`memory.min` in pod level cgroup:
--&gt;
&lt;p&gt;Pod 级别 cgroup 中的 &lt;code&gt;memory.min&lt;/code&gt;：&lt;/p&gt;
&lt;p&gt;$memory.min = \sum_{i=0}^{no. of pods}pod.spec.containers[i].resources.requests[memory]$&lt;/p&gt;
&lt;!--
&lt;sub&gt;for every i&lt;sup&gt;th&lt;/sup&gt; container in a pod&lt;/sub&gt;
--&gt;
&lt;p&gt;&lt;sub&gt;对于 Pod 中每个 i&lt;sup&gt;th&lt;/sup&gt; 容器&lt;/sub&gt;
&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;!--
`memory.min` in node level cgroup:
--&gt;
&lt;p&gt;节点级别 cgroup 中的 &lt;code&gt;memory.min&lt;/code&gt;：&lt;/p&gt;
&lt;p&gt;$memory.min = \sum_{i}^{no. of nodes}\sum_{j}^{no. of pods}pod[i].spec.containers[j].resources.requests[memory]$&lt;/p&gt;
&lt;!--
&lt;sub&gt;for every j&lt;sup&gt;th&lt;/sup&gt; container in every i&lt;sup&gt;th&lt;/sup&gt; pod on a node&lt;/sub&gt;
--&gt;
&lt;p&gt;&lt;sub&gt;对于节点中每个 i&lt;sup&gt;th&lt;/sup&gt; Pod 中的每个 j&lt;sup&gt;th&lt;/sup&gt; 容器&lt;/sub&gt;
&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;!--
Kubelet will manage the cgroups hierarchy of the pod level and node level cgroups directly
using the libcontainer library (from the runc project), while container cgroups limits are managed by the container runtime.
--&gt;
&lt;p&gt;Kubelet 将直接使用 libcontainer 库（来自 runc 项目）管理 Pod 级别和节点级别
cgroups 的层次结构，而容器 cgroups 限制由容器运行时管理。&lt;/p&gt;
&lt;!--
### Support for Pod QoS classes
--&gt;
&lt;h3 id=&#34;support-for-pod-qos-classes&#34;&gt;支持 Pod QoS 类别&lt;/h3&gt;
&lt;!--
Based on user feedback for the Alpha feature in Kubernetes v1.22, some users would like
to opt out of MemoryQoS on a per-pod basis to ensure there is no early memory throttling.
Therefore, in Kubernetes v1.27 Memory QOS also supports memory.high to be set as per
Quality of Service(QoS) for Pod classes. Following are the different cases for memory.high as per QOS classes:
--&gt;
&lt;p&gt;根据用户对 Kubernetes v1.22 中 Alpha 特性的反馈，一些用户希望在 Pod 层面选择不启用 MemoryQoS，
以确保不会出现早期内存抑制现象。因此，在 Kubernetes v1.27 中 MemoryQoS 还支持根据
服务质量（QoS）对 Pod 类设置 memory.high。以下是按 QoS 类设置 memory.high 的几种情况：&lt;/p&gt;
&lt;!--
1. **Guaranteed pods** by their QoS definition require memory requests=memory limits and are
   not overcommitted. Hence MemoryQoS feature is disabled on those pods by not setting
   memory.high. This ensures that Guaranteed pods can fully use their memory requests up
   to their set limit, and not hit any throttling.
--&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Guaranteed Pods&lt;/strong&gt;：根据其 QoS 定义，要求 Pod 的内存请求等于其内存限制，并且不允许超配。
因此，通过不设置 memory.high，MemoryQoS 特性会针对这些 Pod 被禁用。
这样做可以确保 &lt;strong&gt;Guaranteed Pod&lt;/strong&gt; 充分利用其内存请求，也就是其内存限制，并且不会被抑制。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. **Burstable pods** by their QoS definition require at least one container in the Pod with
   CPU or memory request or limit set.
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Burstable Pod&lt;/strong&gt;：根据其 QoS 定义，要求 Pod 中至少有一个容器具有 CPU 或内存请求或限制设置。&lt;/p&gt;
&lt;!--
* When requests.memory and limits.memory are set, the formula is used as-is:
--&gt;
&lt;ul&gt;
&lt;li&gt;当 requests.memory 和 limits.memory 都被设置时，公式按原样使用：&lt;/li&gt;
&lt;/ul&gt;
  &lt;!--
  
     &lt;figure&gt;
         &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-limit.svg&#34;
              alt=&#34;memory.high when requests and limits are set&#34;/&gt; &lt;figcaption&gt;
                 &lt;h4&gt;memory.high when requests and limits are set&lt;/h4&gt;
             &lt;/figcaption&gt;
     &lt;/figure&gt;

  --&gt;
&lt;pre&gt;&lt;code&gt; 
     &lt;figure&gt;
         &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-limit.svg&#34;
              alt=&#34;当请求和限制被设置时的 memory.high&#34;/&gt; &lt;figcaption&gt;
                 &lt;h4&gt;当请求和限制被设置时的 memory.high&lt;/h4&gt;
             &lt;/figcaption&gt;
     &lt;/figure&gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;!--
* When requests.memory is set and limits.memory is not set, limits.memory is substituted for node allocatable memory in the formula:
--&gt;
&lt;ul&gt;
&lt;li&gt;当设置了 requests.memory 但未设置 limits.memory 时，公式中的 limits.memory 替换为节点可分配内存：&lt;/li&gt;
&lt;/ul&gt;
  &lt;!--
  
     &lt;figure&gt;
         &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-no-limits.svg&#34;
              alt=&#34;memory.high when requests and limits are not set&#34;/&gt; &lt;figcaption&gt;
                 &lt;h4&gt;memory.high when requests and limits are not set&lt;/h4&gt;
             &lt;/figcaption&gt;
     &lt;/figure&gt;

  --&gt;
&lt;pre&gt;&lt;code&gt; 
     &lt;figure&gt;
         &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-no-limits.svg&#34;
              alt=&#34;当请求和限制未被设置时的 memory.high&#34;/&gt; &lt;figcaption&gt;
                 &lt;h4&gt;当请求和限制未被设置时的 memory.high&lt;/h4&gt;
             &lt;/figcaption&gt;
     &lt;/figure&gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. **BestEffort** by their QoS definition do not require any memory or CPU limits or requests.
   For this case, kubernetes sets requests.memory = 0 and substitute limits.memory for node allocatable
   memory in the formula:
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;BestEffort Pod&lt;/strong&gt;：根据其 QoS 定义，不需要设置内存或 CPU 限制或请求。对于这种情况，
kubernetes 设置 requests.memory = 0 并将公式中的 limits.memory 替换为节点可分配内存：&lt;/p&gt;
&lt;!--

   &lt;figure&gt;
       &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-best-effort.svg&#34;
            alt=&#34;memory.high for BestEffort Pod&#34;/&gt; &lt;figcaption&gt;
               &lt;h4&gt;memory.high for BestEffort Pod&lt;/h4&gt;
           &lt;/figcaption&gt;
   &lt;/figure&gt;

--&gt;

   &lt;figure&gt;
       &lt;img src=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2023/05/05/qos-memory-resources/container-memory-high-best-effort.svg&#34;
            alt=&#34;BestEffort Pod 的 memory.high&#34;/&gt; &lt;figcaption&gt;
               &lt;h4&gt;BestEffort Pod 的 memory.high&lt;/h4&gt;
           &lt;/figcaption&gt;
   &lt;/figure&gt;

&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
**Summary**: Only Pods in Burstable and BestEffort QoS classes will set `memory.high`. Guaranteed QoS pods do not set `memory.high` as their memory is guaranteed.
--&gt;
&lt;p&gt;&lt;strong&gt;总结&lt;/strong&gt;：只有 Burstable 和 BestEffort QoS 类别中的 Pod 才会设置 &lt;code&gt;memory.high&lt;/code&gt;。
Guaranteed QoS 的 Pod 不会设置 &lt;code&gt;memory.high&lt;/code&gt;，因为它们的内存是有保证的。&lt;/p&gt;
&lt;!--
## How do I use it?
--&gt;
&lt;h2 id=&#34;how-do-i-use-it&#34;&gt;我该如何使用它？&lt;/h2&gt;
&lt;!--
The prerequisites for enabling Memory QoS feature on your Linux node are:
--&gt;
&lt;p&gt;在 Linux 节点上启用 MemoryQoS 特性的先决条件是：&lt;/p&gt;
&lt;!--
1. Verify the [requirements](/docs/concepts/architecture/cgroups/#requirements)
   related to [Kubernetes support for cgroups v2](/docs/concepts/architecture/cgroups)
   are met.
2. Ensure CRI Runtime supports Memory QoS. At the time of writing, only containerd
   and CRI-O provide support compatible with Memory QoS (alpha). This was implemented in the following PRs:
   * Containerd: [Feature: containerd-cri support LinuxContainerResources.Unified #5627](https://github.com/containerd/containerd/pull/5627).
   * CRI-O: [implement kube alpha features for 1.22 #5207](https://github.com/cri-o/cri-o/pull/5207).
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;验证是否满足
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cgroups&#34;&gt;Kubernetes 对 cgroup v2 支持&lt;/a&gt;的相关&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/cgroups/#requirements&#34;&gt;要求&lt;/a&gt;。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;确保 CRI 运行时支持内存 QoS。在撰写本文时，
只有 Containerd 和 CRI-O 提供与内存 QoS（alpha）兼容的支持。是在以下 PR 中实现的：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Containerd：&lt;a href=&#34;https://github.com/containerd/containerd/pull/5627&#34;&gt;Feature: containerd-cri support LinuxContainerResources.Unified #5627&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;CRI-O：&lt;a href=&#34;https://github.com/cri-o/cri-o/pull/5207&#34;&gt;implement kube alpha features for 1.22 #5207&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
Memory QoS remains an alpha feature for Kubernetes v1.27. You can enable the feature by setting `MemoryQoS=true` in the kubelet configuration file:
--&gt;
&lt;p&gt;MemoryQoS 在 Kubernetes v1.27 中仍然是 Alpha 特性。
你可以通过在 kubelet 配置文件中设置 &lt;code&gt;MemoryQoS=true&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;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;featureGates&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;MemoryQoS&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;!--
## How do I get involved?
--&gt;
&lt;h2 id=&#34;how-do-i-get-involved&#34;&gt;我如何参与？&lt;/h2&gt;
&lt;!--
Huge thank you to all the contributors who helped with the design, implementation, and review of this feature:
--&gt;
&lt;p&gt;非常感谢所有帮助设计、实施和审查此功能的贡献者：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dixita Narang (&lt;a href=&#34;https://github.com/ndixita&#34;&gt;ndixita&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tim Xu (&lt;a href=&#34;https://github.com/xiaoxubeii&#34;&gt;xiaoxubeii&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;David Porter(&lt;a href=&#34;https://github.com/bobbypage&#34;&gt;bobbypage&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Mrunal Patel(&lt;a href=&#34;https://github.com/mrunalp&#34;&gt;mrunalp&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
For those interested in getting involved in future discussions on Memory QoS feature,
you can reach out SIG Node by several means:
--&gt;
&lt;p&gt;对于那些有兴趣参与未来内存 QoS 特性讨论的人，你可以通过多种方式联系 SIG Node：&lt;/p&gt;
&lt;!--
- 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;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;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27: StatefulSet PVC 自动删除(beta)</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/04/kubernetes-1-27-statefulset-pvc-auto-deletion-beta/</link>
      <pubDate>Thu, 04 May 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/04/kubernetes-1-27-statefulset-pvc-auto-deletion-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#39;Kubernetes 1.27: StatefulSet PVC Auto-Deletion (beta)&#39;
date: 2023-05-04
slug: kubernetes-1-27-statefulset-pvc-auto-deletion-beta
--&gt;
&lt;!--
**Author:** Matthew Cary (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Matthew Cary (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：顾欣 (ICBC)&lt;/p&gt;
&lt;!--
Kubernetes v1.27 graduated to beta a new policy mechanism for
[`StatefulSets`](/docs/concepts/workloads/controllers/statefulset/) that controls the lifetime of
their [`PersistentVolumeClaims`](/docs/concepts/storage/persistent-volumes/) (PVCs). The new PVC
retention policy lets users specify if the PVCs generated from the `StatefulSet` spec template should
be automatically deleted or retrained when the `StatefulSet` is deleted or replicas in the `StatefulSet`
are scaled down.
--&gt;
&lt;p&gt;Kubernetes v1.27 将一种新的策略机制升级到 Beta 阶段，这一策略用于控制
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/statefulset/&#34;&gt;&lt;code&gt;StatefulSets&lt;/code&gt;&lt;/a&gt;
的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/&#34;&gt;&lt;code&gt;PersistentVolumeClaims&lt;/code&gt;&lt;/a&gt;（PVCs）的生命周期。
这种新的 PVC 保留策略允许用户指定当删除 &lt;code&gt;StatefulSet&lt;/code&gt; 或者缩减 &lt;code&gt;StatefulSet&lt;/code&gt; 中的副本时，
是自动删除还是保留从 &lt;code&gt;StatefulSet&lt;/code&gt; 规约模板生成的 PVC。&lt;/p&gt;
&lt;!--
## What problem does this solve?

A `StatefulSet` spec can include `Pod` and PVC templates. When a replica is first created, the
Kubernetes control plane creates a PVC for that replica if one does not already exist. The behavior
before the PVC retention policy was that the control plane never cleaned up the PVCs created for
`StatefulSets` - this was left up to the cluster administrator, or to some add-on automation that
you’d have to find, check suitability, and deploy. The common pattern for managing PVCs, either
manually or through tools such as Helm, is that the PVCs are tracked by the tool that manages them,
with explicit lifecycle. Workflows that use `StatefulSets` must determine on their own what PVCs are
created by a `StatefulSet` and what their lifecycle should be.
--&gt;
&lt;h2 id=&#34;所解决的问题&#34;&gt;所解决的问题&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;StatefulSet&lt;/code&gt; 规约可以包含 &lt;code&gt;Pod&lt;/code&gt; 和 PVC 模板。
当首次创建副本时，Kubernetes 控制平面会为该副本创建一个 PVC （如果不存在）。
在 PVC 保留策略出现之前，控制平面不会清理为 &lt;code&gt;StatefulSets&lt;/code&gt; 创建的 PVC，
该任务通常由集群管理员负责，或者通过一些附加的自动化工具来处理。
你需要寻找这些工具，并检查其适用性，然后进行部署。
通常管理 PVC 的常见模式，无论是手动管理还是通过诸如 Helm 等工具进行管理，
都是由负责管理它们的工具跟踪，具有明确的生命周期。
使用 &lt;code&gt;StatefulSets&lt;/code&gt; 的工作流必须自行确定由 &lt;code&gt;StatefulSet&lt;/code&gt; 创建的 PVC，
并确定其生命周期。&lt;/p&gt;
&lt;!--
Before this new feature, when a StatefulSet-managed replica disappears, either because the
`StatefulSet` is reducing its replica count, or because its `StatefulSet` is deleted, the PVC and its
backing volume remains and must be manually deleted. While this behavior is appropriate when the
data is critical, in many cases the persistent data in these PVCs is either temporary, or can be
reconstructed from another source. In those cases, PVCs and their backing volumes remaining after
their `StatefulSet` or replicas have been deleted are not necessary, incur cost, and require manual
cleanup.
--&gt;
&lt;p&gt;在引入这个新特性之前，当一个由 StatefulSet 管理的副本消失时，
无论是因为 &lt;code&gt;StatefulSet&lt;/code&gt; 正在减少其副本数量，还是因为其 &lt;code&gt;StatefulSet&lt;/code&gt; 被删除，
PVC 及其支持卷仍然存在，必须手动删除。尽管在数据至关重要时这种行为是合适的，
但在许多情况下，这些 PVC 中的持久数据要么是临时的，要么可以从其他来源重建。
在这些情况下，删除 &lt;code&gt;StatefulSet&lt;/code&gt; 或副本后仍保留 PVC 及其支持卷是不必要的，
这会产生成本，并且需要手动清理。&lt;/p&gt;
&lt;!--
## The new `StatefulSet` PVC retention policy

The new `StatefulSet` PVC retention policy is used to control if and when PVCs created from a
`StatefulSet`’s `volumeClaimTemplate` are deleted.  There are two contexts when this may occur.
--&gt;
&lt;h2 id=&#34;新的-statefulset-pvc-保留策略&#34;&gt;新的 &lt;code&gt;StatefulSet&lt;/code&gt; PVC 保留策略&lt;/h2&gt;
&lt;p&gt;新的 &lt;code&gt;StatefulSet&lt;/code&gt; PVC 保留策略用于控制是否以及何时删除从 &lt;code&gt;StatefulSet&lt;/code&gt;
的 &lt;code&gt;volumeClaimTemplate&lt;/code&gt; 创建的 PVC。有两种情况可能需要就此作出决定。&lt;/p&gt;
&lt;!--
The first context is when the `StatefulSet` resource is deleted (which implies that all replicas are
also deleted). This is controlled by the `whenDeleted` policy. The second context, controlled by
`whenScaled` is when the `StatefulSet` is scaled down, which removes some but not all of the replicas
in a `StatefulSet`. In both cases the policy can either be `Retain`, where the corresponding PVCs are
not touched, or `Delete`, which means that PVCs are deleted. The deletion is done with a normal
[object deletion](/docs/concepts/architecture/garbage-collection/), so that, for example, all
retention policies for the underlying PV are respected.

This policy forms a matrix with four cases. I’ll walk through and give an example for each one.
--&gt;
&lt;p&gt;第一种是当删除 &lt;code&gt;StatefulSet&lt;/code&gt; 资源时（意味着所有副本也会被删除）。
这时的行为由 &lt;code&gt;whenDeleted&lt;/code&gt; 策略控制。第二种场景由 &lt;code&gt;whenScaled&lt;/code&gt; 控制，
即当 &lt;code&gt;StatefulSet&lt;/code&gt; 缩减规模时，它会移除一部分而不是全部副本。在这两种情况下，
策略可以是 &lt;code&gt;Retain&lt;/code&gt;，表示相应的 PVC 不受影响，或者是 &lt;code&gt;Delete&lt;/code&gt;，表示 PVC 将被删除。
删除操作是通过普通的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/architecture/garbage-collection/&#34;&gt;对象删除&lt;/a&gt;完成的，
这样可以确保对底层 PV 的所有保留策略都得到遵守。&lt;/p&gt;
&lt;p&gt;这个策略形成了一个矩阵，包括四种情况。接下来，我将逐一介绍每种情况并给出一个示例。&lt;/p&gt;
  &lt;!--
  * **`whenDeleted` and `whenScaled` are both `Retain`.** 
  
    This matches the existing behavior for `StatefulSets`, where no PVCs are deleted. This is also
    the default retention policy. It’s appropriate to use when data on `StatefulSet` volumes may be
    irreplaceable and should only be deleted manually.
  --&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;whenDeleted&lt;/code&gt; 和 &lt;code&gt;whenScaled&lt;/code&gt; 都是 &lt;code&gt;Retain&lt;/code&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;这与现有的 &lt;code&gt;StatefulSets&lt;/code&gt; 行为相匹配，所有 PVC 都不会被删除。这也是默认的保留策略。
当 &lt;code&gt;StatefulSet&lt;/code&gt; 卷上的数据可能是不可替代的，并且应该仅在手动情况下删除时，这种策略是适当的。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
  &lt;!--
  * **`whenDeleted` is `Delete` and `whenScaled` is `Retain`.** 
  
    In this case, PVCs are deleted only when the entire `StatefulSet` is deleted. If the
    `StatefulSet` is scaled down, PVCs are not touched, meaning they are available to be reattached
    if a scale-up occurs with any data from the previous replica. This might be used for a temporary
    `StatefulSet`, such as in a CI instance or ETL pipeline, where the data on the `StatefulSet` is
    needed only during the lifetime of the `StatefulSet` lifetime, but while the task is running the
    data is not easily reconstructible. Any retained state is needed for any replicas that scale
    down and then up.
  --&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;whenDeleted&lt;/code&gt; 是 &lt;code&gt;Delete&lt;/code&gt;，&lt;code&gt;whenScaled&lt;/code&gt; 是 &lt;code&gt;Retain&lt;/code&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在这种情况下，只有在整个 &lt;code&gt;StatefulSet&lt;/code&gt; 被删除时，PVC 才会被删除。
如果 &lt;code&gt;StatefulSet&lt;/code&gt; 进行缩减操作，PVC 将不会受到影响，这意味着如果缩减后再进行扩展，
并且使用了来自之前副本的任何数据，PVC 可以被重新关联。这种情况适用于临时的 &lt;code&gt;StatefulSet&lt;/code&gt;，
例如在 CI 实例或 ETL 流水线中，&lt;code&gt;StatefulSet&lt;/code&gt; 上的数据只在其生命周期内需要，
但在任务运行时，数据不容易重建。对于先被缩容后被扩容的副本而言，所有已保留的状态都是需要的。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
  &lt;!--
  * **`whenDeleted` and `whenScaled` are both `Delete`.** 
  
    PVCs are deleted immediately when their replica is no longer needed. Note this does not include
    when a `Pod` is deleted and a new version rescheduled, for example when a node is drained and
    `Pods` need to migrate elsewhere. The PVC is deleted only when the replica is no longer needed
    as signified by a scale-down or `StatefulSet` deletion. This use case is for when data does not
    need to live beyond the life of its replica. Perhaps the data is easily reconstructable and the
    cost savings of deleting unused PVCs is more important than quick scale-up, or perhaps that when
    a new replica is created, any data from a previous replica is not usable and must be
    reconstructed anyway.
  --&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;whenDeleted&lt;/code&gt; 和 &lt;code&gt;whenScaled&lt;/code&gt; 都是 &lt;code&gt;Delete&lt;/code&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;当副本不再需要时，PVC 会立即被删除。需要注意的是，
这不包括当删除一个 Pod 并重新调度一个新版本时的情况，
例如当一个节点被排空并且 Pods 需要迁移到其他地方时。只有在副本不再被需要时，
即通过缩减规模或删除 &lt;code&gt;StatefulSet&lt;/code&gt; 时，PVC 才会被删除。
这种情况适用于数据不需要在其副本的生命周期之外存在的情况。也许数据很容易重建，
删除未使用的 PVC 可以节省成本比快速扩展更重要，或者当创建一个新副本时，
来自前一个副本的任何数据都无法使用，必须进行重建。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
  &lt;!--
  * **`whenDeleted` is `Retain` and `whenScaled` is `Delete`.** 
  
    This is similar to the previous case, when there is little benefit to keeping PVCs for fast
    reuse during scale-up. An example of a situation where you might use this is an Elasticsearch
    cluster. Typically you would scale that workload up and down to match demand, whilst ensuring a
    minimum number of replicas (for example: 3). When scaling down, data is migrated away from
    removed replicas and there is no benefit to retaining those PVCs. However, it can be useful to
    bring the entire Elasticsearch cluster down temporarily for maintenance. If you need to take the
    Elasticsearch system offline, you can do this by temporarily deleting the `StatefulSet`, and
    then bringing the Elasticsearch cluster back by recreating the `StatefulSet`. The PVCs holding
    the Elasticsearch data will still exist and the new replicas will automatically use them.
  --&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;whenDeleted&lt;/code&gt; 是 &lt;code&gt;Retain&lt;/code&gt;，&lt;code&gt;whenScaled&lt;/code&gt; 是 &lt;code&gt;Delete&lt;/code&gt;。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;这与前面的情况类似，保留 PVC 以便在扩容时进行快速重用的好处微乎其微。
一个使用这种策略的例子是 Elasticsearch 集群。通常，你会根据需求调整该工作负载的规模，
同时确保有一定数量的副本（例如：3个）一直存在。在缩容时，数据会从被删除的副本迁移走，
保留这些 PVC 没有好处。然而，如果需要临时关闭整个 Elasticsearch 集群进行维护，
可以通过暂时删除 &lt;code&gt;StatefulSet&lt;/code&gt; 然后重建 &lt;code&gt;StatefulSet&lt;/code&gt; 来恢复 Elasticsearch 集群。
持有 Elasticsearch 数据的 PVC 仍然存在，新的副本将自动使用它们。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Visit the
[documentation](/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-policies) to
see all the details.

## What’s next?

Try it out! The `StatefulSetAutoDeletePVC` feature gate is beta and enabled by default on
cluster running Kubernetes 1.27. Create a `StatefulSet` using the new policy, test it out and tell
us what you think!
--&gt;
&lt;p&gt;请访问&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-policies&#34;&gt;文档&lt;/a&gt;
以查看所有详细信息。&lt;/p&gt;
&lt;h2 id=&#34;下一步是什么&#34;&gt;下一步是什么？&lt;/h2&gt;
&lt;p&gt;试一试吧！在 Kubernetes 1.27 的集群中，&lt;code&gt;StatefulSetAutoDeletePVC&lt;/code&gt; 特性门控是 Beta 阶段，
使用新的策略创建一个 &lt;code&gt;StatefulSet&lt;/code&gt;，进行测试并告诉我们你的想法！&lt;/p&gt;
&lt;!--
I&#39;m very curious to see if this owner reference mechanism works well in practice. For example, I
realized there is no mechanism in Kubernetes for knowing who set a reference, so it’s possible that
the `StatefulSet` controller may fight with custom controllers that set their own
references. Fortunately, maintaining the existing retention behavior does not involve any new owner
references, so default behavior will be compatible.

Please tag any issues you report with the label `sig/apps` and assign them to Matthew Cary
([@mattcary](https://github.com/mattcary) at GitHub).

Enjoy!
--&gt;
&lt;p&gt;我非常好奇这个所有者引用机制在实践中是否运行良好。例如，
我意识到在 Kubernetes 中没有机制可以知道是谁设置了引用，
因此 &lt;code&gt;StatefulSet&lt;/code&gt; 控制器可能会与设置自己引用的自定义控制器产生冲突。
幸运的是，保持现有的保留行为不涉及任何新的所有者引用，因此默认行为将是兼容的。&lt;/p&gt;
&lt;p&gt;请在你报告的任何 issue 上标记标签 sig/apps，
并将它们指派给 Matthew Cary (@mattcary at GitHub)。&lt;/p&gt;
&lt;p&gt;祝您使用愉快！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：HorizontalPodAutoscaler ContainerResource 类型指标进阶至 Beta</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/02/hpa-container-resource-metric/</link>
      <pubDate>Tue, 02 May 2023 12:00:00 +0800</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/05/02/hpa-container-resource-metric/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: HorizontalPodAutoscaler ContainerResource type metric moves to beta&#34;
date: 2023-05-02T12:00:00+0800
slug: hpa-container-resource-metric
--&gt;
&lt;!--
**Author:** [Kensei Nakada](https://github.com/sanposhiho) (Mercari)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; &lt;a href=&#34;https://github.com/sanposhiho&#34;&gt;Kensei Nakada&lt;/a&gt; (Mercari)&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;!--
Kubernetes 1.20 introduced the [`ContainerResource` type metric](/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics)
in HorizontalPodAutoscaler (HPA).

In Kubernetes 1.27, this feature moves to beta and the corresponding feature gate (`HPAContainerMetrics`) gets enabled by default.
--&gt;
&lt;p&gt;Kubernetes 1.20 在 HorizontalPodAutoscaler (HPA) 中引入了
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics&#34;&gt;&lt;code&gt;ContainerResource&lt;/code&gt; 类型指标&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;在 Kubernetes 1.27 中，此特性进阶至 Beta，相应的特性门控 (&lt;code&gt;HPAContainerMetrics&lt;/code&gt;) 默认被启用。&lt;/p&gt;
&lt;!--
## What is the ContainerResource type metric

The ContainerResource type metric allows us to configure the autoscaling based on resource usage of individual containers.

In the following example, the HPA controller scales the target 
so that the average utilization of the cpu in the application container of all the pods is around 60%.
(See [the algorithm details](/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details)
to know how the desired replica number is calculated exactly)
--&gt;
&lt;h2 id=&#34;什么是-containerresource-类型指标&#34;&gt;什么是 ContainerResource 类型指标&lt;/h2&gt;
&lt;p&gt;ContainerResource 类型指标允许我们根据各个容器的资源使用量来配置自动扩缩。&lt;/p&gt;
&lt;p&gt;在下面的示例中，HPA 控制器扩缩目标，以便所有 Pod 的应用程序容器的 CPU 平均利用率约为 60％
（请参见&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details&#34;&gt;算法详情&lt;/a&gt;以了解预期副本数的确切计算方式）。&lt;/p&gt;
&lt;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;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;ContainerResource&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;containerResource&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;cpu&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;container&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;application&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;target&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;Utilization&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;averageUtilization&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;60&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
## The difference from the Resource type metric

HPA already had a [Resource type metric](/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-resource-metrics).

You can define the target resource utilization like the following,
and then HPA will scale up/down the replicas based on the current utilization.
--&gt;
&lt;h2 id=&#34;与-resource-类型指标的区别&#34;&gt;与 Resource 类型指标的区别&lt;/h2&gt;
&lt;p&gt;HPA 已具有 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-resource-metrics&#34;&gt;Resource 类型指标&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;你可以定义如下的目标资源利用率，然后 HPA 将基于当前利用率扩缩副本。&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;type&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;Resource&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;resource&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;cpu&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;target&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;Utilization&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;averageUtilization&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;60&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
But, this Resource type metric refers to the average utilization of the **Pods**.

In case a Pod has multiple containers, the utilization calculation would be:
--&gt;
&lt;p&gt;但这个 Resource 类型指标指的是 &lt;strong&gt;Pod&lt;/strong&gt; 的平均利用率。&lt;/p&gt;
&lt;p&gt;如果一个 Pod 有多个容器，则利用率计算公式为：&lt;/p&gt;
&lt;!--
```
sum{the resource usage of each container} / sum{the resource request of each container}
```
--&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sum{每个容器的资源使用量} / sum{每个容器的资源请求}
&lt;/code&gt;&lt;/pre&gt;&lt;!--
The resource utilization of each container may not have a direct correlation or may grow at different rates as the load changes.
--&gt;
&lt;p&gt;每个容器的资源利用率可能没有直接关系，或可能随着负载变化而以不同的速度增长。&lt;/p&gt;
&lt;!--
For example:
- A sidecar container is only providing an auxiliary service such as log shipping.
  If the application does not log very frequently or does not produce logs in its hotpath
  then the usage of the log shipper will not grow.
- A sidecar container which provides authentication. Due to heavy caching
  the usage will only increase slightly when the load on the main container increases.
  In the current blended usage calculation approach this usually results in
  the HPA not scaling up the deployment because the blended usage is still low.
- A sidecar may be injected without resources set which prevents scaling
  based on utilization. In the current logic the HPA controller can only scale
  on absolute resource usage of the pod when the resource requests are not set.
--&gt;
&lt;p&gt;例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;边车容器仅提供日志传输这类辅助服务。
如果应用程序不经常记录日志或在其频繁执行的路径中不生成日志，则日志发送器的使用量不会增长。&lt;/li&gt;
&lt;li&gt;提供身份验证的边车容器。由于重度缓存，当主要容器的负载增加时，使用量只会略微增加。
在当前的混合用量计算方法中，这通常导致 HPA 不会对 Deployment 向上扩容，因为混合的使用量仍然很低。&lt;/li&gt;
&lt;li&gt;边车可能在未设置资源的情况下被注入，这会阻止基于利用率进行扩缩。
在当前的逻辑中，当未设置资源请求时，HPA 控制器只能根据 Pod 的绝对资源使用量进行扩缩。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
And, in such case, if only one container&#39;s resource utilization goes high, 
the Resource type metric may not suggest scaling up.

So, for the accurate autoscaling, you may want to use the ContainerResource type metric for such Pods instead.
--&gt;
&lt;p&gt;在这种情况下，如果仅有一个容器的资源利用率增加，则 Resource 类型指标可能不会建议扩容。&lt;/p&gt;
&lt;p&gt;因此，为了实现准确的自动扩缩，你可能需要改为使用 ContainerResource 类型指标来替代这些 Pod。&lt;/p&gt;
&lt;!--
## What&#39;s new for the beta?

For Kubernetes v1.27, the ContainerResource type metric is available by default as described at the beginning
of this article.
(You can still disable it by the `HPAContainerMetrics` feature gate.)
--&gt;
&lt;h2 id=&#34;beta-版本有哪些新内容&#34;&gt;Beta 版本有哪些新内容？&lt;/h2&gt;
&lt;p&gt;在 Kubernetes v1.27 中，正如本文开头所述，ContainerResource 类型指标默认可用。
（你仍然可以通过 &lt;code&gt;HPAContainerMetrics&lt;/code&gt; 特性门禁用它。）&lt;/p&gt;
&lt;!--
Also, we&#39;ve improved the observability of HPA controller by exposing some metrics from the kube-controller-manager:
- `metric_computation_total`: Number of metric computations. 
- `metric_computation_duration_seconds`: The time that the HPA controller takes to calculate one metric.
- `reconciliations_total`: Number of reconciliation of HPA controller. 
- `reconciliation_duration_seconds`: The time that the HPA controller takes to reconcile a HPA object once.
--&gt;
&lt;p&gt;另外，我们已通过从 kube-controller-manager 中公开一些指标来改进 HPA 控制器的可观测性：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;metric_computation_total&lt;/code&gt;：指标计算的数量。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;metric_computation_duration_seconds&lt;/code&gt;：HPA 控制器计算一个指标所需的时间。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;reconciliations_total&lt;/code&gt;：HPA 控制器的协调次数。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;reconciliation_duration_seconds&lt;/code&gt;：HPA 控制器协调一次 HPA 对象所需的时间。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
These metrics have labels `action` (`scale_up`, `scale_down`, `none`) and `error` (`spec`, `internal`, `none`).
And, in addition to them, the first two metrics have the `metric_type` label
which corresponds to `.spec.metrics[*].type` for a HorizontalPodAutoscaler.
--&gt;
&lt;p&gt;这些指标具有 &lt;code&gt;action&lt;/code&gt;（&lt;code&gt;scale_up&lt;/code&gt;、&lt;code&gt;scale_down&lt;/code&gt;、&lt;code&gt;none&lt;/code&gt;）和
&lt;code&gt;error&lt;/code&gt;（&lt;code&gt;spec&lt;/code&gt;、&lt;code&gt;internal&lt;/code&gt;、&lt;code&gt;none&lt;/code&gt;）标签。
除此之外，前两个指标还具有 &lt;code&gt;metric_type&lt;/code&gt; 标签，该标签对应于
HorizontalPodAutoscaler 的 &lt;code&gt;.spec.metrics[*].type&lt;/code&gt;。&lt;/p&gt;
&lt;!--
All metrics are useful for general monitoring of HPA controller,
you can get deeper insight into which part has a problem, where it takes time, how much scaling tends to happen at which time on your cluster etc.
--&gt;
&lt;p&gt;所有指标都可用于 HPA 控制器的常规监控，你可以深入洞察哪部分存在问题，在哪里耗时，
集群在哪个时间倾向于发生多少次扩缩等问题。&lt;/p&gt;
&lt;!--
Another minor stuff, we&#39;ve changed the `SuccessfulRescale` event&#39;s messages
so that everyone can check whether the events came from the resource metric or
the container resource metric (See [the related PR](https://github.com/kubernetes/kubernetes/pull/116045)).
--&gt;
&lt;p&gt;另一件小事是，我们已更改了 &lt;code&gt;SuccessfulRescale&lt;/code&gt; 事件的消息，
这样每个人都可以检查事件是否来自资源指标或容器资源指标
（请参见&lt;a href=&#34;https://github.com/kubernetes/kubernetes/pull/116045&#34;&gt;相关 PR&lt;/a&gt;）。&lt;/p&gt;
&lt;!--
## Getting involved 

This feature is managed by [SIG Autoscaling](https://github.com/kubernetes/community/tree/master/sig-autoscaling). 
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;此特性由 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-autoscaling&#34;&gt;SIG Autoscaling&lt;/a&gt;
进行管理。请加入我们分享反馈。我们期待聆听你的声音！&lt;/p&gt;
&lt;!--
## How can I learn more?

- [The official document of the ContainerResource type metric](/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics)
- [KEP-1610: Container Resource based Autoscaling](https://github.com/kubernetes/enhancements/tree/master/keps/sig-autoscaling/1610-container-resource-autoscaling)
--&gt;
&lt;h2 id=&#34;了解更多&#34;&gt;了解更多&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/#container-resource-metrics&#34;&gt;ContainerResource 类型指标的正式文档&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-autoscaling/1610-container-resource-autoscaling&#34;&gt;KEP-1610：Container Resource based Autoscaling（基于容器资源的自动扩缩）&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27: StatefulSet 启动序号简化了迁移</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/28/statefulset-start-ordinal/</link>
      <pubDate>Fri, 28 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/28/statefulset-start-ordinal/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: StatefulSet Start Ordinal Simplifies Migration&#34;
date: 2023-04-28
slug: statefulset-start-ordinal
--&gt;
&lt;!--
**Author**: Peter Schuurman (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Peter Schuurman (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
Kubernetes v1.26 introduced a new, alpha-level feature for
[StatefulSets](/docs/concepts/workloads/controllers/statefulset/) that controls
the ordinal numbering of Pod replicas. As of Kubernetes v1.27, this feature is
now beta. Ordinals can start from arbitrary
non-negative numbers. This blog post will discuss how this feature can be
used.
--&gt;
&lt;p&gt;Kubernetes v1.26 为 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/workloads/controllers/statefulset/&#34;&gt;StatefulSet&lt;/a&gt;
引入了一个新的 Alpha 级别特性，可以控制 Pod 副本的序号。
从 Kubernetes v1.27 开始，此特性进级到 Beta 阶段。序数可以从任意非负数开始，
这篇博文将讨论如何使用此功能。&lt;/p&gt;
&lt;!--
## Background

StatefulSets ordinals provide sequential identities for pod replicas. When using
[`OrderedReady` Pod management](/docs/tutorials/stateful-application/basic-stateful-set/#orderedready-pod-management)
Pods are created from ordinal index `0` up to `N-1`.
--&gt;
&lt;h2 id=&#34;背景&#34;&gt;背景&lt;/h2&gt;
&lt;p&gt;StatefulSet 序号为 Pod 副本提供顺序标识。当使用
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/docs/tutorials/stateful-application/basic-stateful-set/#orderedready-pod-management&#34;&gt;&lt;code&gt;OrderedReady&lt;/code&gt; Pod 管理策略&lt;/a&gt;时，
Pod 是从序号索引 &lt;code&gt;0&lt;/code&gt; 到 &lt;code&gt;N-1&lt;/code&gt; 顺序创建的。&lt;/p&gt;
&lt;!--
With Kubernetes today, orchestrating a StatefulSet migration across clusters is
challenging. Backup and restore solutions exist, but these require the
application to be scaled down to zero replicas prior to migration. In today&#39;s
fully connected world, even planned application downtime may not allow you to
meet your business goals. You could use
[Cascading Delete](/docs/tutorials/stateful-application/basic-stateful-set/#cascading-delete)
or
[On Delete](/docs/tutorials/stateful-application/basic-stateful-set/#on-delete)
to migrate individual pods, however this is error prone and tedious to manage.
You lose the self-healing benefit of the StatefulSet controller when your Pods
fail or are evicted.
--&gt;
&lt;p&gt;如今使用 Kubernetes 跨集群编排 StatefulSet 迁移具有挑战性。
虽然存在备份和恢复解决方案，但这些解决方案需要在迁移之前将应用程序的副本数缩为 0。
在当今这个完全互联的世界中，即使是计划内的应用停机可能也无法实现你的业务目标。&lt;/p&gt;
&lt;p&gt;你可以使用&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tutorials/stateful-application/basic-stateful-set/#cascading-delete&#34;&gt;级联删除&lt;/a&gt;或
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tutorials/stateful-application/basic-stateful-set/#on-delete&#34;&gt;OnDelete 策略&lt;/a&gt;来迁移单个 Pod，
但是这很容易出错并且管理起来很乏味。
当你的 Pod 出现故障或被逐出时，你将失去 StatefulSet 控制器的自我修复优势。&lt;/p&gt;
&lt;!--
Kubernetes v1.26 enables a StatefulSet to be responsible for a range of ordinals
within a range {0..N-1} (the ordinals 0, 1, ... up to N-1).
With it, you can scale down a range
{0..k-1} in a source cluster, and scale up the complementary range {k..N-1}
in a destination cluster, while maintaining application availability. This
enables you to retain *at most one* semantics (meaning there is at most one Pod
with a given identity running in a StatefulSet) and
[Rolling Update](/docs/tutorials/stateful-application/basic-stateful-set/#rolling-update)
behavior when orchestrating a migration across clusters.
--&gt;
&lt;p&gt;Kubernetes v1.26 使 StatefulSet 能够负责 {0..N-1} 范围内的一系列序数（序数 0、1、... 直到 N-1）。
有了它，你可以缩小源集群中的范围 {0..k-1}，并扩大目标集群中的互补范围 {k..N-1}，同时保证应用程序可用性。
这使你在编排跨集群迁移时保留&lt;strong&gt;至多一个&lt;/strong&gt;语义（意味着最多有一个具有给定身份的
Pod 在 StatefulSet 中运行）和[滚动更新](/zh-cn/docs/tutorials/stateful-application/basic-stateful-set/#rolling-update）行为。&lt;/p&gt;
&lt;!--
## Why would I want to use this feature?

Say you&#39;re running your StatefulSet in one cluster, and need to migrate it out
to a different cluster. There are many reasons why you would need to do this:
 * **Scalability**: Your StatefulSet has scaled too large for your cluster, and
   has started to disrupt the quality of service for other workloads in your
   cluster.
 * **Isolation**: You&#39;re running a StatefulSet in a cluster that is accessed 
   by multiple users, and namespace isolation isn&#39;t sufficient.
 * **Cluster Configuration**: You want to move your StatefulSet to a different
   cluster to use some environment that is not available on your current
   cluster.
 * **Control Plane Upgrades**: You want to move your StatefulSet to a cluster
   running an upgraded control plane, and can&#39;t handle the risk or downtime of
   in-place control plane upgrades.
--&gt;
&lt;h2 id=&#34;我为什么要使用此功能&#34;&gt;我为什么要使用此功能？&lt;/h2&gt;
&lt;p&gt;假设你在一个集群中运行 StatefulSet，并且需要将其迁移到另一个集群。你需要这样做的原因有很多：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;可扩展性&lt;/strong&gt;：你的 StatefulSet 对于你的集群而言规模过大，并且已经开始破坏集群中其他工作负载的服务质量。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;隔离性&lt;/strong&gt;：你在一个供多个用户访问的集群中运行 StatefulSet，而命名空间隔离是不够的。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;集群配置&lt;/strong&gt;：你想将 StatefulSet 迁移到另一个集群，以使用在当前集群上不存在的某些环境。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;控制平面升级&lt;/strong&gt;：你想将 StatefulSet 迁移到运行着较高版本控制平面，
并且无法处承担就地升级控制平面所产生的风险或预留停机时间。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## How do I use it?

Enable the `StatefulSetStartOrdinal` feature gate on a cluster, and create a
StatefulSet with a customized `.spec.ordinals.start`.
--&gt;
&lt;h2 id=&#34;我该如何使用它&#34;&gt;我该如何使用它？&lt;/h2&gt;
&lt;p&gt;在集群上启用 &lt;code&gt;StatefulSetStartOrdinal&lt;/code&gt; 特性门控，并使用自定义的
&lt;code&gt;.spec.ordinals.start&lt;/code&gt; 创建一个 StatefulSet。&lt;/p&gt;
&lt;!--
## Try it out

In this demo, I&#39;ll use the new mechanism to migrate a
StatefulSet from one Kubernetes cluster to another. The
[redis-cluster](https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster)
Bitnami Helm chart will be used to install Redis.
--&gt;
&lt;h2 id=&#34;试试看吧&#34;&gt;试试看吧&lt;/h2&gt;
&lt;p&gt;在此演示中，我将使用新机制将 StatefulSet 从一个 Kubernetes 集群迁移到另一个。
&lt;a href=&#34;https://github.com/bitnami/charts/tree/main/bitnami/redis-cluster&#34;&gt;redis-cluster&lt;/a&gt;
Bitnami Helm chart 将用于安装 Redis。&lt;/p&gt;
&lt;!--
Tools Required:
 * [yq](https://github.com/mikefarah/yq)
 * [helm](https://helm.sh/docs/helm/helm_install/)
--&gt;
&lt;p&gt;所需工具：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/mikefarah/yq&#34;&gt;yq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://helm.sh/docs/helm/helm_install/&#34;&gt;helm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
### Pre-requisites {#demo-pre-requisites}

To do this, I need two Kubernetes clusters that can both access common
networking and storage; I&#39;ve named my clusters `source` and `destination`.
Specifically, I need:
--&gt;
&lt;h3 id=&#34;demo-pre-requisites&#34;&gt;先决条件   &lt;/h3&gt;
&lt;p&gt;为此，我需要两个可以访问公共网络和存储的 Kubernetes 集群；
我已将集群命名为 &lt;code&gt;source&lt;/code&gt; 和 &lt;code&gt;destination&lt;/code&gt;。具体来说，我需要：&lt;/p&gt;
&lt;!--
* The `StatefulSetStartOrdinal` feature gate enabled on both clusters.
* Client configuration for `kubectl` that lets me access both clusters as an
  administrator.
* The same `StorageClass` installed on both clusters, and set as the default
  StorageClass for both clusters. This `StorageClass` should provision
  underlying storage that is accessible from either or both clusters.
* A flat network topology that allows for pods to send and receive packets to
  and from Pods in either clusters. If you are creating clusters on a cloud
  provider, this configuration may be called private cloud or private network.
--&gt;
&lt;ul&gt;
&lt;li&gt;在两个集群上都启用 &lt;code&gt;StatefulSetStartOrdinal&lt;/code&gt; 特性门控。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubectl&lt;/code&gt; 的客户端配置允许我以管理员身份访问这两个集群。&lt;/li&gt;
&lt;li&gt;两个集群上都安装了相同的 &lt;code&gt;StorageClass&lt;/code&gt;，并设置为两个集群的默认 &lt;code&gt;StorageClass&lt;/code&gt;。
这个 &lt;code&gt;StorageClass&lt;/code&gt; 应该提供可从一个或两个集群访问的底层存储。&lt;/li&gt;
&lt;li&gt;一种扁平的网络拓扑，允许 Pod 向任一集群中的 Pod 发送数据包和从中接收数据包。
如果你在云提供商上创建集群，则此配置可能被称为私有云或私有网络。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
1. Create a demo namespace on both clusters:
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在两个集群上创建一个用于演示的命名空间：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl create ns kep-3335
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
2. Deploy a Redis cluster with six replicas in the source cluster:
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;在 &lt;code&gt;source&lt;/code&gt; 集群中部署一个有六个副本的 Redis 集群：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;helm repo add bitnami https://charts.bitnami.com/bitnami
helm install redis --namespace kep-3335 \
  bitnami/redis-cluster \
  --set persistence.size=1Gi \
  --set cluster.nodes=6
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
3. Check the replication status in the source cluster:
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;检查 &lt;code&gt;source&lt;/code&gt; 集群中的副本状态：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl exec -it redis-redis-cluster-0 -- /bin/bash -c \
  &amp;#34;redis-cli -c -h redis-redis-cluster -a $(kubectl get secret redis-redis-cluster -o jsonpath=&amp;#34;{.data.redis-password}&amp;#34; | base64 -d) CLUSTER NODES;&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2ce30362c188aabc06f3eee5d92892d95b1da5c3 10.104.0.14:6379@16379 myself,master - 0 1669764411000 3 connected 10923-16383                                                                                                                                              
7743661f60b6b17b5c71d083260419588b4f2451 10.104.0.16:6379@16379 slave 2ce30362c188aabc06f3eee5d92892d95b1da5c3 0 1669764410000 3 connected                                                                                             
961f35e37c4eea507cfe12f96e3bfd694b9c21d4 10.104.0.18:6379@16379 slave a8765caed08f3e185cef22bd09edf409dc2bcc61 0 1669764411000 1 connected                                                                                                             
7136e37d8864db983f334b85d2b094be47c830e5 10.104.0.15:6379@16379 slave 2cff613d763b22c180cd40668da8e452edef3fc8 0 1669764412595 2 connected                                                                                                                    
a8765caed08f3e185cef22bd09edf409dc2bcc61 10.104.0.19:6379@16379 master - 0 1669764411592 1 connected 0-5460                                                                                                                                                   
2cff613d763b22c180cd40668da8e452edef3fc8 10.104.0.17:6379@16379 master - 0 1669764410000 2 connected 5461-10922
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
4. Deploy a Redis cluster with zero replicas in the destination cluster:
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;在 &lt;code&gt;destination&lt;/code&gt; 集群中部署一个零副本的 Redis 集群：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;helm install redis --namespace kep-3335 \
  bitnami/redis-cluster \
  --set persistence.size=1Gi \
  --set cluster.nodes=0 \
  --set redis.extraEnvVars\[0\].name=REDIS_NODES,redis.extraEnvVars\[0\].value=&amp;#34;redis-redis-cluster-headless.kep-3335.svc.cluster.local&amp;#34; \
  --set existingSecret=redis-redis-cluster
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
5. Scale down the `redis-redis-cluster` StatefulSet in the source cluster by 1,
   to remove the replica `redis-redis-cluster-5`:
--&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;
&lt;p&gt;将源集群中的 &lt;code&gt;redis-redis-cluster&lt;/code&gt; StatefulSet 副本数缩小 1，
以删除副本 &lt;code&gt;redis-redis-cluster-5&lt;/code&gt;：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl patch sts redis-redis-cluster -p &amp;#39;{&amp;#34;spec&amp;#34;: {&amp;#34;replicas&amp;#34;: 5}}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
6. Migrate dependencies from the source cluster to the destination cluster:

   The following commands copy resources from `source` to `destionation`. Details
   that are not relevant in `destination` cluster are removed (eg: `uid`,
   `resourceVersion`, `status`).

   **Steps for the source cluster**
--&gt;
&lt;ol start=&#34;6&#34;&gt;
&lt;li&gt;
&lt;p&gt;将依赖从 &lt;code&gt;source&lt;/code&gt; 集群迁移到 &lt;code&gt;destionation&lt;/code&gt; 集群：
以下命令将依赖资源从 &lt;code&gt;source&lt;/code&gt; 复制到 &lt;code&gt;destionation&lt;/code&gt;，其中与 &lt;code&gt;destionation&lt;/code&gt;
集群无关的详细信息已被删除（例如：&lt;code&gt;uid&lt;/code&gt;、&lt;code&gt;resourceVersion&lt;/code&gt;、&lt;code&gt;status&lt;/code&gt;）。&lt;/p&gt;
&lt;!--
Note: If using a `StorageClass` with `reclaimPolicy: Delete` configured, you
      should patch the PVs in `source` with `reclaimPolicy: Retain` prior to
      deletion to retain the underlying storage used in `destination`. See
      [Change the Reclaim Policy of a PersistentVolume](/docs/tasks/administer-cluster/change-pv-reclaim-policy/)
      for more details.
--&gt;
&lt;p&gt;说明：如果使用配置了 &lt;code&gt;reclaimPolicy: Delete&lt;/code&gt; 的 &lt;code&gt;StorageClass&lt;/code&gt;，
你应该在删除之前使用 &lt;code&gt;reclaimPolicy: Retain&lt;/code&gt; 修补 &lt;code&gt;source&lt;/code&gt; 中的 PV，
以保留 &lt;code&gt;destination&lt;/code&gt; 中使用的底层存储。
有关详细信息，请参阅&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/tasks/administer-cluster/change-pv-reclaim-policy/&#34;&gt;更改 PersistentVolume&lt;/a&gt;
的回收策略。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl get pvc redis-data-redis-redis-cluster-5 -o yaml | yq &amp;#39;del(.metadata.uid, .metadata.resourceVersion, .metadata.annotations, .metadata.finalizers, .status)&amp;#39; &amp;gt; /tmp/pvc-redis-data-redis-redis-cluster-5.yaml
kubectl get pv $(yq &amp;#39;.spec.volumeName&amp;#39; /tmp/pvc-redis-data-redis-redis-cluster-5.yaml) -o yaml | yq &amp;#39;del(.metadata.uid, .metadata.resourceVersion, .metadata.annotations, .metadata.finalizers, .spec.claimRef, .status)&amp;#39; &amp;gt; /tmp/pv-redis-data-redis-redis-cluster-5.yaml
kubectl get secret redis-redis-cluster -o yaml | yq &amp;#39;del(.metadata.uid, .metadata.resourceVersion)&amp;#39; &amp;gt; /tmp/secret-redis-redis-cluster.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;!--
**Steps for the destination cluster**

Note: For the PV/PVC, this procedure only works if the underlying storage system
      that your PVs use can support being copied into `destination`. Storage
      that is associated with a specific node or topology may not be supported.
      Additionally, some storage systems may store addtional metadata about
      volumes outside of a PV object, and may require a more specialized
      sequence to import a volume.
--&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;destination&lt;/code&gt; 集群中的步骤&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;说明：对于 PV/PVC，此过程仅在你的 PV 使用的底层存储系统支持复制到 &lt;code&gt;destination&lt;/code&gt;
集群时才有效。可能不支持与特定节点或拓扑关联的存储。此外，某些存储系统可能会在 PV
对象之外存储有关卷的附加元数据，并且可能需要更专门的序列来导入卷。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl create -f /tmp/pv-redis-data-redis-redis-cluster-5.yaml
kubectl create -f /tmp/pvc-redis-data-redis-redis-cluster-5.yaml
kubectl create -f /tmp/secret-redis-redis-cluster.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
7. Scale up the `redis-redis-cluster` StatefulSet in the destination cluster by
   1, with a start ordinal of 5:
--&gt;
&lt;ol start=&#34;7&#34;&gt;
&lt;li&gt;
&lt;p&gt;将 &lt;code&gt;destination&lt;/code&gt; 集群中的 &lt;code&gt;redis-redis-cluster&lt;/code&gt; StatefulSet 扩容 1，起始序号为 5：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl patch sts redis-redis-cluster -p &amp;#39;{&amp;#34;spec&amp;#34;: {&amp;#34;ordinals&amp;#34;: {&amp;#34;start&amp;#34;: 5}, &amp;#34;replicas&amp;#34;: 1}}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
8. Check the replication status in the destination cluster:
--&gt;
&lt;ol start=&#34;8&#34;&gt;
&lt;li&gt;
&lt;p&gt;检查 &lt;code&gt;destination&lt;/code&gt; 集群中的副本状态：&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kubectl exec -it redis-redis-cluster-5 -- /bin/bash -c \
  &amp;#34;redis-cli -c -h redis-redis-cluster -a $(kubectl get secret redis-redis-cluster -o jsonpath=&amp;#34;{.data.redis-password}&amp;#34; | base64 -d) CLUSTER NODES;&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;!--
I should see that the new replica (labeled `myself`) has joined the Redis
cluster (the IP address belongs to a different CIDR block than the
replicas in the source cluster).
--&gt;
&lt;p&gt;我应该看到新副本（标记为 &lt;code&gt;myself&lt;/code&gt;）已加入 Redis 集群（IP
地址与 &lt;code&gt;source&lt;/code&gt; 集群中的副本归属于不同的 CIDR 块）。&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2cff613d763b22c180cd40668da8e452edef3fc8 10.104.0.17:6379@16379 master - 0 1669766684000 2 connected 5461-10922
7136e37d8864db983f334b85d2b094be47c830e5 10.108.0.22:6379@16379 myself,slave 2cff613d763b22c180cd40668da8e452edef3fc8 0 1669766685609 2 connected
2ce30362c188aabc06f3eee5d92892d95b1da5c3 10.104.0.14:6379@16379 master - 0 1669766684000 3 connected 10923-16383
961f35e37c4eea507cfe12f96e3bfd694b9c21d4 10.104.0.18:6379@16379 slave a8765caed08f3e185cef22bd09edf409dc2bcc61 0 1669766683600 1 connected
a8765caed08f3e185cef22bd09edf409dc2bcc61 10.104.0.19:6379@16379 master - 0 1669766685000 1 connected 0-5460
7743661f60b6b17b5c71d083260419588b4f2451 10.104.0.16:6379@16379 slave 2ce30362c188aabc06f3eee5d92892d95b1da5c3 0 1669766686613 3 connected
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
9. Repeat steps #5 to #7 for the remainder of the replicas, until the
   Redis StatefulSet in the source cluster is scaled to 0, and the Redis
   StatefulSet in the destination cluster is healthy with 6 total replicas.
--&gt;
&lt;ol start=&#34;9&#34;&gt;
&lt;li&gt;对剩余的副本重复 #5 到 #7 的步骤，直到 &lt;code&gt;source&lt;/code&gt; 集群中的 Redis StatefulSet 副本缩放为 0，
并且 &lt;code&gt;destination&lt;/code&gt; 集群中的 Redis StatefulSet 健康，总共有 6 个副本。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
## What&#39;s Next?

This feature provides a building block for a StatefulSet to be split up across
clusters, but does not prescribe the mechanism as to how the StatefulSet should
be migrated. Migration requires coordination of StatefulSet replicas, along with
orchestration of the storage and network layer. This is dependent on the storage
and connectivity requirements of the application installed by the StatefulSet.
Additionally, many StatefulSets are managed by
[operators](/docs/concepts/extend-kubernetes/operator/), which adds another
layer of complexity to migration.
--&gt;
&lt;h2 id=&#34;接下来&#34;&gt;接下来？&lt;/h2&gt;
&lt;p&gt;此特性为跨集群拆分 StatefulSet 提供了一项基本支撑技术，但没有规定 StatefulSet 的迁移机制。
迁移需要对 StatefulSet 副本的协调，以及对存储和网络层的编排。这取决于使用 StatefulSet
安装的应用程序的存储和网络连接要求。此外，许多 StatefulSet 由
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/extend-kubernetes/operator/&#34;&gt;operator&lt;/a&gt; 管理，这也增加了额外的迁移复杂性。&lt;/p&gt;
&lt;!--
If you&#39;re interested in building enhancements to make these processes easier,
get involved with
[SIG Multicluster](https://github.com/kubernetes/community/blob/master/sig-multicluster)
to contribute!
--&gt;
&lt;p&gt;如果你有兴趣构建增强功能以简化这些过程，请参与
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-multicluster&#34;&gt;SIG Multicluster&lt;/a&gt;
做出贡献！&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>官方自动刷新 CVE 订阅源的更新</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/25/k8s-cve-feed-beta/</link>
      <pubDate>Tue, 25 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/25/k8s-cve-feed-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: Updates to the Auto-refreshing Official CVE Feed
date: 2023-04-25
slug: k8s-cve-feed-beta
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Cailyn Edwards (Shopify), Mahé Tardy (Isovalent), Pushkar Joglekar&lt;/p&gt;
&lt;!--
**Authors**: Cailyn Edwards (Shopify), Mahé Tardy (Isovalent), Pushkar Joglekar
--&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
Since launching the [Auto-refreshing Official CVE feed](/docs/reference/issues-security/official-cve-feed/) as an alpha
feature in the 1.25 release, we have made significant improvements and updates. We are excited to announce the release of the
beta version of the feed. This blog post will outline the feedback received, the changes made, and talk about how you can help 
as we prepare to make this a stable feature in a future Kubernetes Release.
--&gt;
&lt;p&gt;自从在 1.25 版本中将&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/issues-security/official-cve-feed/&#34;&gt;官方自动刷新 CVE 订阅源&lt;/a&gt;作为 Alpha
功能启用以来，我们已经做了一些重大改进和更新。我们很高兴宣布该订阅源的 Beta 版现已发布。这篇博文将列举收到的反馈、所做的更改，
还讨论了在未来 Kubernetes 版本中准备使其进阶成为一个稳定功能时你可以如何提供帮助。&lt;/p&gt;
&lt;!--
## Feedback from end-users
--&gt;
&lt;h2 id=&#34;feadback-from-end-users&#34;&gt;来自最终用户的反馈&lt;/h2&gt;
&lt;!--
SIG Security received some feedback from end-users:
- The JSON CVE Feed [did not comply](https://github.com/kubernetes/website/issues/36808)
  with the [JSON Feed specification](https://www.jsonfeed.org/) as its name would suggest.
- The feed could also [support RSS](https://github.com/kubernetes/sig-security/issues/77)
  in addition to JSON Feed format.
- Some metadata could be [added](https://github.com/kubernetes/sig-security/issues/72) to indicate the freshness of
  the feed overall, or [specific CVEs](https://github.com/kubernetes/sig-security/issues/63). Another suggestion was 
  to [indicate](https://github.com/kubernetes/sig-security/issues/71) which Prow job recently updated the feed. See 
  more ideas directly on the [the umbrella issue](https://github.com/kubernetes/sig-security/issues/1).
- The feed Markdown table on the website [should be ordered](https://github.com/kubernetes/sig-security/issues/73)
  from the most recent to the least recently announced CVE.
--&gt;
&lt;p&gt;SIG Security 收到了一些最终用户的反馈：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;JSON CVE Feed 的名称与在 &lt;a href=&#34;https://www.jsonfeed.org/&#34;&gt;JSON Feed 规范&lt;/a&gt;中所建议的&lt;a href=&#34;https://github.com/kubernetes/website/issues/36808&#34;&gt;不符&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;除了 JSON Feed 格式之外，订阅源还可以&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/77&#34;&gt;支持 RSS&lt;/a&gt; 格式。&lt;/li&gt;
&lt;li&gt;可以&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/72&#34;&gt;添加&lt;/a&gt;一些元数据来表示整体订阅的实时性，
或者&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/63&#34;&gt;特殊 CVE&lt;/a&gt; 内容。
另一个建议是希望&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/71&#34;&gt;指出&lt;/a&gt;哪个 Prow 作业最近对订阅源进行了更新。
可以直接在&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/1&#34;&gt;问题汇总&lt;/a&gt;中查看更多想法。&lt;/li&gt;
&lt;li&gt;网站上的订阅源 Markdown 表应按照 CVE 发布的时间顺序由近到远&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/73&#34;&gt;排列&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Summary of changes
--&gt;
&lt;h2 id=&#34;summary-of-changes&#34;&gt;变更摘要&lt;/h2&gt;
&lt;!--
In response, the SIG did a [rework of the script generating the JSON feed](https://github.com/kubernetes/sig-security/pull/76)
to comply with the JSON Feed specification from generation and add a
`last_updated` root field to indicate overall freshness. This redesign needed a
[corresponding fix on the Kubernetes website side](https://github.com/kubernetes/website/pull/38579)
for the CVE feed page to continue to work with the new format.
--&gt;
&lt;p&gt;在回应中，SIG 对&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/76&#34;&gt;生成 JSON 格式订阅源的脚本进行了修改&lt;/a&gt;，
让生成的内容符合 JSON Feed 规范，并添加 &lt;code&gt;last_updated&lt;/code&gt; 根字段表示整体实时性。此重新设计需要
&lt;a href=&#34;https://github.com/kubernetes/website/pull/38579&#34;&gt;Kubernetes 网站的相应修复&lt;/a&gt;，以便 CVE 订阅源页面基于新格式继续工作。&lt;/p&gt;
&lt;!--
After that, [RSS feed support](https://github.com/kubernetes/website/pull/39513)
could be added transparently so that end-users can consume the feed in their
preferred format.
--&gt;
&lt;p&gt;之后，完全透明的添加了 &lt;a href=&#34;https://github.com/kubernetes/website/pull/39513&#34;&gt;RSS 订阅源支持&lt;/a&gt;，以便最终用户使用订阅源时可以将其作为首选格式。&lt;/p&gt;
&lt;!--
Overall, the redesign based on the JSON Feed specification, which this time broke
backward compatibility, will allow updates in the future to address the rest of
the issue while being more transparent and less disruptive to end-users.
--&gt;
&lt;p&gt;总而言之，基于 JSON Feed 规范的重新设计（打破了向后兼容性）将允许后续进行更新以解决其余问题，同时令其更加透明且对最终用户的干扰做到较小。&lt;/p&gt;
&lt;!--
### Updates
--&gt;
&lt;h3 id=&#34;updates&#34;&gt;更新&lt;/h3&gt;
&lt;!--
| **Title**                                                                                                    | **Issue**                                                       | **Status**                                                                                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CVE Feed: JSON feed should pass jsonfeed spec validator | [kubernetes/webite#36808](https://github.com/kubernetes/website/issues/36808) | closed, addressed by [kubernetes/sig-security#76](https://github.com/kubernetes/sig-security/pull/76) |
| CVE Feed: Add lastUpdatedAt as a metadata field | [kubernetes/sig-security#72](https://github.com/kubernetes/sig-security/issues/72) | closed, addressed by [kubernetes/sig-security#76](https://github.com/kubernetes/sig-security/pull/76) |
| Support RSS feeds by generating data in Atom format | [kubernetes/sig-security#77](https://github.com/kubernetes/sig-security/issues/77) | closed, addressed by [kubernetes/website#39513](https://github.com/kubernetes/website/pull/39513)|
| CVE Feed: Sort Markdown Table from most recent to least recently announced CVE | [kubernetes/sig-security#73](https://github.com/kubernetes/sig-security/issues/73) | closed, addressed by [kubernetes/sig-security#76](https://github.com/kubernetes/sig-security/pull/76) |
| CVE Feed: Include a timestamp field for each CVE indicating when it was last updated | [kubernetes/sig-security#63](https://github.com/kubernetes/sig-security/issues/63) | closed, addressed by [kubernetes/sig-security#76](https://github.com/kubernetes/sig-security/pull/76) |
| CVE Feed: Add Prow job link as a metadata field | [kubernetes/sig-security#71](https://github.com/kubernetes/sig-security/issues/71) | closed, addressed by [kubernetes/sig-security#83](https://github.com/kubernetes/sig-security/pull/83) |
--&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;标题&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Issue&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;状态&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CVE Feed: JSON feed should pass jsonfeed spec validator&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/website/issues/36808&#34;&gt;kubernetes/webite#36808&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/76&#34;&gt;kubernetes/sig-security#76&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CVE Feed: Add lastUpdatedAt as a metadata field&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/72&#34;&gt;kubernetes/sig-security#72&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/76&#34;&gt;kubernetes/sig-security#76&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Support RSS feeds by generating data in Atom format&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/77&#34;&gt;kubernetes/sig-security#77&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/website/pull/39513&#34;&gt;kubernetes/website#39513&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CVE Feed: Sort Markdown Table from most recent to least recently announced CVE&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/73&#34;&gt;kubernetes/sig-security#73&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/76&#34;&gt;kubernetes/sig-security#76&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CVE Feed: Include a timestamp field for each CVE indicating when it was last updated&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/63&#34;&gt;kubernetes/sig-security#63&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/76&#34;&gt;kubernetes/sig-security#76&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CVE Feed: Add Prow job link as a metadata field&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/71&#34;&gt;kubernetes/sig-security#71&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;已关闭，详见：&lt;a href=&#34;https://github.com/kubernetes/sig-security/pull/83&#34;&gt;kubernetes/sig-security#83&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!--
## What&#39;s next?
--&gt;
&lt;h2 id=&#34;whats-next&#34;&gt;接下来要做什么？&lt;/h2&gt;
&lt;!--
In preparation to [graduate](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-stages) the feed 
to stable i.e. `General Availability` stage, SIG Security is still gathering feedback from end users who are using the updated beta feed.
--&gt;
&lt;p&gt;为了此订阅源&lt;a href=&#34;https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-stages&#34;&gt;进阶至&lt;/a&gt;稳定阶段做准备，
即 &lt;code&gt;General Availability&lt;/code&gt; 阶段，SIG Security 仍将从最终用户持续收集他们使用最新 Beta 版订阅源后的反馈。&lt;/p&gt;
&lt;!--
To help us continue to improve the feed in future Kubernetes Releases please share feedback by adding a comment to
this [tracking issue](https://github.com/kubernetes/sig-security/issues/1) or
let us know on [#sig-security-tooling](https://kubernetes.slack.com/archives/C01CUSVMHPY)
Kubernetes Slack channel, join [Kubernetes Slack here](https://slack.k8s.io).
--&gt;
&lt;p&gt;为了帮助我们在未来的 Kubernetes 版本中继续改进订阅源，请通过对此&lt;a href=&#34;https://github.com/kubernetes/sig-security/issues/1&#34;&gt;跟踪 Issue&lt;/a&gt;
添加评论来分享反馈，或者通过 &lt;a href=&#34;https://kubernetes.slack.com/archives/C01CUSVMHPY&#34;&gt;#sig-security-tooling&lt;/a&gt;
Kubernetes Slack 频道让我们获得更多信息，由此加入 &lt;a href=&#34;https://slack.k8s.io&#34;&gt;Kubernetes Slack&lt;/a&gt;。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：服务器端字段校验和 OpenAPI V3 进阶至 GA</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/24/openapi-v3-field-validation-ga/</link>
      <pubDate>Mon, 24 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/24/openapi-v3-field-validation-ga/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Server Side Field Validation and OpenAPI V3 move to GA&#34;
date: 2023-04-24
slug: openapi-v3-field-validation-ga
--&gt;
&lt;!--
**Author**: Jeffrey Ying (Google), Antoine Pelisse (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Jeffrey Ying (Google), Antoine Pelisse (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Michael Yao (DaoCloud)&lt;/p&gt;
&lt;!--
Before Kubernetes v1.8 (!), typos, mis-indentations or minor errors in
YAMLs could have catastrophic consequences (e.g. a typo like
forgetting the trailing s in `replica: 1000` could cause an outage,
because the value would be ignored and missing, forcing a reset of
replicas back to 1). This was solved back then by fetching the OpenAPI
v2 in kubectl and using it to verify that fields were correct and
present before applying. Unfortunately, at that time, Custom Resource
Definitions didn’t exist, and the code was written under that
assumption. When CRDs were later introduced, the lack of flexibility
in the validation code forced some hard decisions in the way CRDs
exposed their schema, leaving us in a cycle of bad validation causing
bad OpenAPI and vice-versa. With the new OpenAPI v3 and Server Field
Validation being GA in 1.27, we’ve now solved both of these problems.
--&gt;
&lt;p&gt;在 Kubernetes v1.8 之前，YAML 文件中的拼写错误、缩进错误或其他小错误可能会产生灾难性后果
（例如像在 &lt;code&gt;replica: 1000&lt;/code&gt; 中忘记了结尾的字母 “s”，可能会导致宕机。
因为该值会被忽略并且丢失，并强制将副本重置回 1）。当时解决这个问题的办法是：
在 kubectl 中获取 OpenAPI v2 并在应用之前使用 OpenAPI v2 来校验字段是否正确且存在。
不过当时没有自定义资源定义 (CRD)，相关代码是在当时那样的假设下编写的。
之后引入了 CRD，发现校验代码缺乏灵活性，迫使 CRD 在公开其模式定义时做出了一些艰难的决策，
使得我们进入了不良校验造成不良 OpenAPI，不良 OpenAPI 无法校验的循环。
随着新的 OpenAPI v3 和服务器端字段校验在 1.27 中进阶至 GA，我们现在已经解决了这两个问题。&lt;/p&gt;
&lt;!--
Server Side Field Validation offers resource validation on create,
update and patch requests to the apiserver and was added to Kubernetes
in v1.25, beta in v1.26 and is now GA in v1.27. It provides all the
functionality of kubectl validate on the server side.
--&gt;
&lt;p&gt;服务器端字段校验针对通过 create、update 和 patch 请求发送到 apiserver 上的资源进行校验，
此特性是在 Kubernetes v1.25 中添加的，在 v1.26 时进阶至 Beta，
如今在 v1.27 进阶至 GA。它在服务器端提供了 kubectl 校验的所有功能。&lt;/p&gt;
&lt;!--
[OpenAPI](https://swagger.io/specification/) is a standard, language
agnostic interface for discovering the set of operations and types
that a Kubernetes cluster supports. OpenAPI V3 is the latest standard
of the OpenAPI and is an improvement upon [OpenAPI
V2](https://kubernetes.io/blog/2016/12/kubernetes-supports-openapi/)
which has been supported since Kubernetes 1.5. OpenAPI V3 support was
added in Kubernetes in v1.23, moved to beta in v1.24 and is now GA in
v1.27.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://swagger.io/specification/&#34;&gt;OpenAPI&lt;/a&gt; 是一个标准的、与编程语言无关的接口，
用于发现 Kubernetes 集群支持的操作集和类型集。
OpenAPI v3 是 OpenAPI 的最新标准，它是自 Kubernetes 1.5 开始支持的
&lt;a href=&#34;https://kubernetes.io/blog/2016/12/kubernetes-supports-openapi/&#34;&gt;OpenAPI v2&lt;/a&gt;
的改进版本。对 OpenAPI v3 的支持是在 Kubernetes v1.23 中添加的，
v1.24 时进阶至 Beta，如今在 v1.27 进阶至 GA。&lt;/p&gt;
&lt;!--
## OpenAPI V3

### What does OpenAPI V3 offer over V2

#### Built-in types
--&gt;
&lt;h2 id=&#34;openapi-v3&#34;&gt;OpenAPI v3&lt;/h2&gt;
&lt;h3 id=&#34;openapi-v3-相比-v2-提供了什么&#34;&gt;OpenAPI v3 相比 v2 提供了什么？&lt;/h3&gt;
&lt;h4 id=&#34;插件类型&#34;&gt;插件类型&lt;/h4&gt;
&lt;!--
Kubernetes offers certain annotations on fields that are not
representable in OpenAPI V2, or sometimes not represented in the
OpenAPI v2 that Kubernetes generate. Most notably, the &#34;default&#34; field
is published in OpenAPI V3 while omitted in OpenAPI V2. A single type
that can represent multiple types is also expressed correctly in
OpenAPI V3 with the oneOf field. This includes proper representations
for IntOrString and Quantity.
--&gt;
&lt;p&gt;Kubernetes 对 OpenAPI v2 中不能表示或有时在 Kubernetes 生成的 OpenAPI v2
中未表示的某些字段提供了注解。最明显地，OpenAPI v3 发布了 “default” 字段，
而在 OpenAPI v2 中被省略。表示多种类型的单个类型也能在 OpenAPI v3 中使用
oneOf 字段被正确表达。这包括针对 IntOrString 和 Quantity 的合理表示。&lt;/p&gt;
&lt;!--
#### Custom Resource Definitions

In Kubernetes, Custom Resource Definitions use a structural OpenAPI V3
schema that cannot be represented as OpenAPI V2 without a loss of
certain fields. Some of these include nullable, default, anyOf, oneOf,
not, etc. OpenAPI V3 is a completely lossless representation of the
CustomResourceDefinition structural schema.
--&gt;
&lt;h4 id=&#34;crd&#34;&gt;CRD&lt;/h4&gt;
&lt;p&gt;在 Kubernetes 中，自定义资源定义 (CRD) 使用结构化的 OpenAPI v3 模式定义，
无法在不损失某些字段的情况下将其表示为 OpenAPI v2。这些包括
nullable、default、anyOf、oneOf、not 等等。OpenAPI v3 是
CustomResourceDefinition 结构化模式定义的完全无损表示。&lt;/p&gt;
&lt;!--
### How do I use it?

The OpenAPI V3 root discovery can be found at the `/openapi/v3`
endpoint of a Kubernetes API server. OpenAPI V3 documents are grouped
by group-version to reduce the size of the data transported, the
separate documents can be accessed at
`/openapi/v3/apis/&lt;group&gt;/&lt;version&gt;` and `/openapi/v3/api/v1`
representing the legacy group version. Please refer to the [Kubernetes
API Documentation](/docs/concepts/overview/kubernetes-api/) for more
information around this endpoint.
--&gt;
&lt;h3 id=&#34;如何使用&#34;&gt;如何使用？&lt;/h3&gt;
&lt;p&gt;Kubernetes API 服务器的 &lt;code&gt;/openapi/v3&lt;/code&gt; 端点包含了 OpenAPI v3 的根发现文档。
为了减少传输的数据量，OpenAPI v3 文档以 group-version 的方式进行分组，
不同的文档可以通过 &lt;code&gt;/openapi/v3/apis/&amp;lt;group&amp;gt;/&amp;lt;version&amp;gt;&lt;/code&gt; 和 &lt;code&gt;/openapi/v3/api/v1&lt;/code&gt;
（表示旧版 group）进行访问。有关此端点的更多信息请参阅
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/overview/kubernetes-api/&#34;&gt;Kubernetes API 文档&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Various consumers of the OpenAPI have already been updated to consume
v3, including the entirety of kubectl, and server side apply. An
OpenAPI V3 Golang client is available in
[client-go](https://github.com/kubernetes/client-go/blob/release-1.27/openapi3/root.go).
--&gt;
&lt;p&gt;众多使用 OpenAPI 的客户侧组件已更新到了 v3，包括整个 kubectl 和服务器端应用。
在 &lt;a href=&#34;https://github.com/kubernetes/client-go/blob/release-1.27/openapi3/root.go&#34;&gt;client-go&lt;/a&gt;
中也提供了 OpenAPI V3 Golang 客户端。&lt;/p&gt;
&lt;!--
## Server Side Field Validation

The query parameter `fieldValidation` may be used to indicate the
level of field validation the server should perform. If the parameter
is not passed, server side field validation is in `Warn` mode by
default.
--&gt;
&lt;h2 id=&#34;服务器端字段校验&#34;&gt;服务器端字段校验&lt;/h2&gt;
&lt;p&gt;查询参数 &lt;code&gt;fieldValidation&lt;/code&gt; 可用于指示服务器应执行的字段校验级别。
如果此参数未被传递，服务器端字段校验默认采用 &lt;code&gt;Warn&lt;/code&gt; 模式。&lt;/p&gt;
&lt;!--
- Strict: Strict field validation, errors on validation failure
- Warn: Field validation is performed, but errors are exposed as
  warnings rather than failing the request
- Ignore: No server side field validation is performed
--&gt;
&lt;ul&gt;
&lt;li&gt;Strict：严格的字段校验，在验证失败时报错&lt;/li&gt;
&lt;li&gt;Warn：执行字段校验，但错误会以警告的形式给出，而不是使请求失败&lt;/li&gt;
&lt;li&gt;Ignore：不执行服务器端的字段校验&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
kubectl will skip client side validation and will automatically use
server side field validation in `Strict` mode. Controllers by default
use server side field validation in `Warn` mode.

With client side validation, we had to be extra lenient because some
fields were missing from OpenAPI V2 and we didn’t want to reject
possibly valid objects. This is all fixed in server side validation.
Additional documentation may be found
[here](/docs/reference/using-api/api-concepts/#field-validation)
--&gt;
&lt;p&gt;kubectl 将跳过客户端校验，并将自动使用 &lt;code&gt;Strict&lt;/code&gt; 模式下的服务器端字段校验。
控制器默认使用 &lt;code&gt;Warn&lt;/code&gt; 模式进行服务器端字段校验。&lt;/p&gt;
&lt;p&gt;使用客户端校验时，由于 OpenAPI v2 中缺少某些字段，所以我们必须更加宽容，
以免拒绝可能有效的对象。而在服务器端校验中，所有这些问题都被修复了。
可以在&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/api-concepts/#field-validation&#34;&gt;此处&lt;/a&gt;找到更多文档。&lt;/p&gt;
&lt;!--
## What&#39;s next?

With Server Side Field Validation and OpenAPI V3 released as GA, we
introduce more accurate representations of Kubernetes resources. It is
recommended to use server side field validation over client side, but
with OpenAPI V3, clients are free to implement their own validation if
necessary (to “shift things left”) and we guarantee a full lossless
schema published by OpenAPI.
--&gt;
&lt;h2 id=&#34;未来展望&#34;&gt;未来展望&lt;/h2&gt;
&lt;p&gt;随着服务器端字段校验和 OpenAPI v3 以 GA 发布，我们引入了更准确的 Kubernetes 资源表示。
建议使用服务器端字段校验而非客户端校验，但是通过 OpenAPI v3，
客户端可以在必要时自行实现其自身的校验（“左移”），我们保证 OpenAPI 发布的是完全无损的模式定义。&lt;/p&gt;
&lt;!--
Some existing efforts will further improve the information available
through OpenAPI including [CEL validation and
admission](/docs/reference/using-api/cel/), along with OpenAPI
annotations on built-in types.

Many other tools can be built for authoring and transforming resources
using the type information found in the OpenAPI v3.
--&gt;
&lt;p&gt;现在的一些工作将进一步改善通过 OpenAPI 提供的信息，例如
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/using-api/cel/&#34;&gt;CEL 校验和准入&lt;/a&gt;以及对内置类型的 OpenAPI 注解。&lt;/p&gt;
&lt;p&gt;使用在 OpenAPI v3 中的类型信息还可以构建许多其他工具来编写和转换资源。&lt;/p&gt;
&lt;!--
## How to get involved?

These two features are driven by the SIG API Machinery community,
available on the slack channel \#sig-api-machinery, through the
[mailing
list](https://groups.google.com/g/kubernetes-sig-api-machinery) and we
meet every other Wednesday at 11:00 AM PT on Zoom.
--&gt;
&lt;h2 id=&#34;如何参与&#34;&gt;如何参与？&lt;/h2&gt;
&lt;p&gt;这两个特性由 SIG API Machinery 社区驱动，欢迎加入 Slack 频道 #sig-api-machinery，
请查阅&lt;a href=&#34;https://groups.google.com/g/kubernetes-sig-api-machinery&#34;&gt;邮件列表&lt;/a&gt;，
我们每周三 11:00 AM PT 在 Zoom 上召开例会。&lt;/p&gt;
&lt;!--
We offer a huge thanks to all the contributors who helped design,
implement, and review these two features.
--&gt;
&lt;p&gt;我们对所有曾帮助设计、实现和审查这两个特性的贡献者们表示衷心的感谢。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Alexander Zielenski&lt;/li&gt;
&lt;li&gt;Antoine Pelisse&lt;/li&gt;
&lt;li&gt;Daniel Smith&lt;/li&gt;
&lt;li&gt;David Eads&lt;/li&gt;
&lt;li&gt;Jeffrey Ying&lt;/li&gt;
&lt;li&gt;Jordan Liggitt&lt;/li&gt;
&lt;li&gt;Kevin Delgado&lt;/li&gt;
&lt;li&gt;Sean Sullivan&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27: 使用 Kubelet API 查询节点日志</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/21/node-log-query-alpha/</link>
      <pubDate>Fri, 21 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/21/node-log-query-alpha/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Query Node Logs Using The Kubelet API&#34;
date: 2023-04-21
slug: node-log-query-alpha
--&gt;
&lt;!--
**Author:** Aravindh Puthiyaparambil (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;作者：&lt;/strong&gt; Aravindh Puthiyaparambil (Red Hat)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者：&lt;/strong&gt; Xin Li (DaoCloud)&lt;/p&gt;
&lt;!--
Kubernetes 1.27 introduced a new feature called _Node log query_ that allows
viewing logs of services running on the node.
--&gt;
&lt;p&gt;Kubernetes 1.27 引入了一个名为&lt;strong&gt;节点日志查询&lt;/strong&gt;的新功能，
可以查看节点上运行的服务的日志。&lt;/p&gt;
&lt;!--
## What problem does it solve?
Cluster administrators face issues when debugging malfunctioning services
running on the node. They usually have to SSH or RDP into the node to view the
logs of the service to debug the issue. The _Node log query_ feature helps with
this scenario by allowing the cluster administrator to view the logs using
_kubectl_. This is especially useful with Windows nodes where you run into the
issue of the node going to the ready state but containers not coming up due to
CNI misconfigurations and other issues that are not easily identifiable by
looking at the Pod status.
--&gt;
&lt;h2 id=&#34;它解决了什么问题&#34;&gt;它解决了什么问题？&lt;/h2&gt;
&lt;p&gt;集群管理员在调试节点上运行的表现不正常的服务时会遇到问题。
他们通常必须通过 SSH 或 RDP 进入节点以查看服务日志以调试问题。
&lt;strong&gt;节点日志查询&lt;/strong&gt;功能通过允许集群管理员使用 &lt;strong&gt;kubectl&lt;/strong&gt;
查看日志的方式来帮助解决这种情况。这对于 Windows 节点特别有用，
在 Windows 节点中，你会遇到节点进入就绪状态但由于 CNI
错误配置和其他不易通过查看 Pod 状态来辨别的问题而导致容器无法启动的情况。&lt;/p&gt;
&lt;!--
## How does it work?

The kubelet already has a _/var/log/_ viewer that is accessible via the node
proxy endpoint. The feature supplements this endpoint with a shim that shells
out to `journalctl`, on Linux nodes, and the `Get-WinEvent` cmdlet on Windows
nodes. It then uses the existing filters provided by the commands to allow
filtering the logs. The kubelet also uses heuristics to retrieve the logs.
If the user is not aware if a given system services logs to a file or to the
native system logger, the heuristics first checks the native operating system
logger and if that is not available it attempts to retrieve the first logs
from `/var/log/&lt;servicename&gt;` or `/var/log/&lt;servicename&gt;.log` or
`/var/log/&lt;servicename&gt;/&lt;servicename&gt;.log`.
--&gt;
&lt;h2 id=&#34;它是如何工作的&#34;&gt;它是如何工作的？&lt;/h2&gt;
&lt;p&gt;kubelet 已经有一个 &lt;strong&gt;/var/log/&lt;/strong&gt; 查看器，可以通过节点代理端点访问。
本功能特性通过一个隔离层对这个端点进行增强，在 Linux 节点上通过
&lt;code&gt;journalctl&lt;/code&gt; Shell 调用获得日志，在 Windows 节点上通过 &lt;code&gt;Get-WinEvent&lt;/code&gt; CmdLet 获取日志。
然后它使用命令提供的过滤器来过滤日志。kubelet 还使用启发式方法来检索日志。
如果用户不知道给定的系统服务是记录到文件还是本机系统记录器，
启发式方法首先检查本机操作系统记录器，如果不可用，它会尝试先从 &lt;code&gt;/var/log/&amp;lt;servicename&amp;gt;&lt;/code&gt;
或 &lt;code&gt;/var/log/&amp;lt;servicename&amp;gt;.log&lt;/code&gt; 或 &lt;code&gt;/var/log/&amp;lt;servicename&amp;gt;/&amp;lt;servicename&amp;gt;.log&lt;/code&gt; 检索日志。&lt;/p&gt;
&lt;!--
On Linux we assume that service logs are available via journald, and that
`journalctl` is installed. On Windows we assume that service logs are available
in the application log provider. Also note that fetching node logs is only
available if you are authorized to do so (in RBAC, that&#39;s **get** and
**create** access to `nodes/proxy`). The privileges that you need to fetch node
logs also allow elevation-of-privilege attacks, so be careful about how you
manage them.
--&gt;
&lt;p&gt;在 Linux 上，我们假设服务日志可通过 journald 获得，
并且安装了 &lt;code&gt;journalctl&lt;/code&gt;。 在 Windows 上，我们假设服务日志在应用程序日志提供程序中可用。
另请注意，只有在你被授权的情况下才能获取节点日志（在 RBAC 中，
这是对 &lt;code&gt;nodes/proxy&lt;/code&gt; 的 &lt;strong&gt;get&lt;/strong&gt; 和 &lt;strong&gt;create&lt;/strong&gt; 访问）。
获取节点日志所需的特权也允许特权提升攻击（elevation-of-privilege），
因此请谨慎管理它们。&lt;/p&gt;
&lt;!--
## How do I use it?

To use the feature, ensure that the `NodeLogQuery`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is
enabled for that node, and that the kubelet configuration options
`enableSystemLogHandler` and `enableSystemLogQuery` are both set to true. You can
then query the logs from all your nodes or just a subset. Here is an example to
retrieve the kubelet service logs from a node:
--&gt;
&lt;h2 id=&#34;该如何使用它&#34;&gt;该如何使用它&lt;/h2&gt;
&lt;p&gt;要使用该功能，请确保为该节点启用了 &lt;code&gt;NodeLogQuery&lt;/code&gt;
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;，
并且 kubelet 配置选项 &lt;code&gt;enableSystemLogHandler&lt;/code&gt; 和 &lt;code&gt;enableSystemLogQuery&lt;/code&gt; 都设置为 true。
然后，你可以查询所有节点或部分节点的日志。下面是一个从节点检索 kubelet 服务日志的示例：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# Fetch kubelet logs from a node named node-1.example&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get --raw &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;/api/v1/nodes/node-1.example/proxy/logs/?query=kubelet&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can further filter the query to narrow down the results:
--&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;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# Fetch kubelet logs from a node named node-1.example that have the word &amp;#34;error&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kubectl get --raw &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;/api/v1/nodes/node-1.example/proxy/logs/?query=kubelet&amp;amp;pattern=error&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can also fetch files from `/var/log/` on a Linux node:
--&gt;
&lt;p&gt;你还可以从 Linux 节点上的 &lt;code&gt;/var/log/&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 --raw &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;/api/v1/nodes/&amp;lt;insert-node-name-here&amp;gt;/proxy/logs/?query=/&amp;lt;insert-log-file-name-here&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
You can read the
[documentation](/docs/concepts/cluster-administration/system-logs/#log-query)
for all the available options.
--&gt;
&lt;p&gt;你可以阅读&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/cluster-administration/system-logs/#log-query&#34;&gt;文档&lt;/a&gt;获取所有可用选项。&lt;/p&gt;
&lt;!--
## How do I help?

Please use the feature and provide feedback by opening GitHub issues or
reaching out to us on the
[#sig-windows](https://kubernetes.slack.com/archives/C0SJ4AFB7) channel on the
Kubernetes Slack or the SIG Windows
[mailing list](https://groups.google.com/g/kubernetes-sig-windows).
--&gt;
&lt;h2 id=&#34;如何提供帮助&#34;&gt;如何提供帮助&lt;/h2&gt;
&lt;p&gt;请使用该功能并通过在 GitHub 上登记问题或通过 Kubernetes Slack
的 &lt;a href=&#34;https://kubernetes.slack.com/archives/C0SJ4AFB7&#34;&gt;#sig-windows&lt;/a&gt; 频道
或 SIG Windows &lt;a href=&#34;https://groups.google.com/g/kubernetes-sig-windows&#34;&gt;邮件列表&lt;/a&gt;
联系我们来提供反馈。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：持久卷的单个 Pod 访问模式升级到 Beta</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/20/read-write-once-pod-access-mode-beta/</link>
      <pubDate>Thu, 20 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/20/read-write-once-pod-access-mode-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Single Pod Access Mode for PersistentVolumes Graduates to Beta&#34;
date: 2023-04-20
slug: read-write-once-pod-access-mode-beta
--&gt;
&lt;!--
**Author:** Chris Henzie (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Chris Henzie (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：顾欣 (ICBC)&lt;/p&gt;
&lt;!--
With the release of Kubernetes v1.27 the ReadWriteOncePod feature has graduated
to beta. In this blog post, we&#39;ll take a closer look at this feature, what it
does, and how it has evolved in the beta release.
--&gt;
&lt;p&gt;随着 Kubernetes v1.27 的发布，ReadWriteOncePod 功能已经升级为 Beta 版。
在这篇博客文章中，我们将更详细地介绍这个功能，作用以及在 Beta 版本中的发展。&lt;/p&gt;
&lt;!--
## What is ReadWriteOncePod?
--&gt;
&lt;h2 id=&#34;what-is-readwriteoncepod&#34;&gt;什么是 ReadWriteOncePod &lt;/h2&gt;
&lt;!--
ReadWriteOncePod is a new access mode for
[PersistentVolumes](/docs/concepts/storage/persistent-volumes/#persistent-volumes) (PVs)
and [PersistentVolumeClaims](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVCs)
introduced in Kubernetes v1.22. This access mode enables you to restrict volume
access to a single pod in the cluster, ensuring that only one pod can write to
the volume at a time. This can be particularly useful for stateful workloads
that require single-writer access to storage.
--&gt;
&lt;p&gt;ReadWriteOncePod 是 Kubernetes 在 v1.22 中引入的一种新的访问模式，
适用于 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#persistent-volumes&#34;&gt;PersistentVolume&lt;/a&gt;(PVs)
和 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims&#34;&gt;PersistentVolumeClaim&lt;/a&gt;(PVCs)。
此访问模式使你能够将存储卷访问限制在集群中的单个 Pod 上，确保一次只有一个 Pod 可以写入存储卷。
这可能对需要单一写入者访问存储的有状态工作负载特别有用。&lt;/p&gt;
&lt;!--
For more context on access modes and how ReadWriteOncePod works read
[What are access modes and why are they important?](/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#what-are-access-modes-and-why-are-they-important)
in the _Introducing Single Pod Access Mode for PersistentVolumes_ article from 2021.
--&gt;
&lt;p&gt;要了解有关访问模式和 ReadWriteOncePod 如何工作的更多背景信息，
请阅读 2021 年介绍 PersistentVolume 的单个 Pod 访问模式的文章中的&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#what-are-access-modes-and-why-are-they-important&#34;&gt;什么是访问模式和为什么它们如此重要？&lt;/a&gt;。&lt;/p&gt;
&lt;!--
## Changes in the ReadWriteOncePod beta
--&gt;
&lt;h2 id=&#34;changes-in-the-readwriteoncepod-beta&#34;&gt;ReadWriteOncePod 的 Beta 版中变化 &lt;/h2&gt;
&lt;!--
The ReadWriteOncePod beta adds support for
[scheduler preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/)
of pods using ReadWriteOncePod PVCs.
--&gt;
&lt;p&gt;ReadWriteOncePod Beta 版为使用 ReadWriteOncePod PVC 的 Pod 添加&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption/&#34;&gt;调度器抢占&lt;/a&gt;。&lt;/p&gt;
&lt;!--
Scheduler preemption allows higher-priority pods to preempt lower-priority pods,
so that they can start running on the same node. With this release, pods using
ReadWriteOncePod PVCs can also be preempted if a higher-priority pod requires
the same PVC.
--&gt;
&lt;p&gt;调度器抢占允许更高优先级的 Pod 抢占较低优先级的 Pod，以便它们可以在同一节点上运行。
在此版本中，如果更高优先级的 Pod 需要相同的 PVC，使用 ReadWriteOncePod PVCs 的 Pod 也可以被抢占。&lt;/p&gt;
&lt;!--
## How can I start using ReadWriteOncePod?
--&gt;
&lt;h2 id=&#34;how-can-i-start-using-readwriteoncepod&#34;&gt;如何开始使用 ReadWriteOncePod？ &lt;/h2&gt;
&lt;!--
With ReadWriteOncePod now in beta, it will be enabled by default in cluster
versions v1.27 and beyond.
--&gt;
&lt;p&gt;随着 ReadWriteOncePod 现已升级为 Beta 版，在 v1.27 及更高版本的集群中将默认启用该功能。&lt;/p&gt;
&lt;!--
Note that ReadWriteOncePod is
[only supported for CSI volumes](/docs/concepts/storage/persistent-volumes/#access-modes).
Before using this feature you will need to update the following
[CSI sidecars](https://kubernetes-csi.github.io/docs/sidecar-containers.html)
to these versions or greater:
--&gt;
&lt;p&gt;请注意，ReadWriteOncePod &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#access-modes&#34;&gt;仅支持 CSI 卷&lt;/a&gt;。
在使用此功能之前，你需要将以下 &lt;a href=&#34;https://kubernetes-csi.github.io/docs/sidecar-containers.html&#34;&gt;CSI Sidecars&lt;/a&gt;更新至以下版本或更高版本：&lt;/p&gt;
&lt;!--
- [csi-provisioner:v3.0.0+](https://github.com/kubernetes-csi/external-provisioner/releases/tag/v3.0.0)
- [csi-attacher:v3.3.0+](https://github.com/kubernetes-csi/external-attacher/releases/tag/v3.3.0)
- [csi-resizer:v1.3.0+](https://github.com/kubernetes-csi/external-resizer/releases/tag/v1.3.0)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-csi/external-provisioner/releases/tag/v3.0.0&#34;&gt;csi-provisioner:v3.0.0+&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-csi/external-attacher/releases/tag/v3.3.0&#34;&gt;csi-attacher:v3.3.0+&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes-csi/external-resizer/releases/tag/v1.3.0&#34;&gt;csi-resizer:v1.3.0+&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
To start using ReadWriteOncePod, create a PVC with the ReadWriteOncePod access mode:
--&gt;
&lt;p&gt;要开始使用 ReadWriteOncePod，请创建具有 ReadWriteOncePod 访问模式的 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;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;apiVersion&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;v1&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;metadata&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;name&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;single-writer-only&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;- ReadWriteOncePod&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;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;1Gi&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;!--
If your storage plugin supports
[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/),
new PersistentVolumes will be created with the ReadWriteOncePod access mode applied.

Read [Migrating existing PersistentVolumes](/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#migrating-existing-persistentvolumes)
for details on migrating existing volumes to use ReadWriteOncePod.
--&gt;
&lt;p&gt;如果你的存储插件支持&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/dynamic-provisioning/&#34;&gt;动态制备&lt;/a&gt;，
新创建的持久卷将应用 ReadWriteOncePod 访问模式。&lt;/p&gt;
&lt;p&gt;阅读&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#migrating-existing-persistentvolumes&#34;&gt;迁移现有持久卷&lt;/a&gt;
以了解如何迁移现有卷以使用 ReadWriteOncePod。&lt;/p&gt;
&lt;!--
## How can I learn more?
--&gt;
&lt;h2 id=&#34;how-can-i-learn-more&#34;&gt;如何了解更多信息？&lt;/h2&gt;
&lt;!--
Please see the [alpha blog post](/blog/2021/09/13/read-write-once-pod-access-mode-alpha)
and [KEP-2485](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/2485-read-write-once-pod-pv-access-mode/README.md)
for more details on the ReadWriteOncePod access mode and motivations for CSI spec changes.
--&gt;
&lt;p&gt;请查看 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/blog/2021/09/13/read-write-once-pod-access-mode-alpha&#34;&gt;Alpha 版博客&lt;/a&gt;和
&lt;a href=&#34;https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/2485-read-write-once-pod-pv-access-mode/README.md&#34;&gt;KEP-2485&lt;/a&gt;
以了解关于 ReadWriteOncePod 访问模式的更多详细信息以及对 CSI 规约作更改的动机。&lt;/p&gt;
&lt;!--
## How do I get involved?
--&gt;
&lt;h2 id=&#34;how-do-i-get-involved&#34;&gt;如何参与？&lt;/h2&gt;
&lt;!--
The [Kubernetes #csi Slack channel](https://kubernetes.slack.com/messages/csi)
and any of the standard
[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 the CSI teams.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://kubernetes.slack.com/messages/csi&#34;&gt;Kubernetes #csi Slack&lt;/a&gt;频道以及任何常规的
&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact&#34;&gt;SIG 存储沟通渠道&lt;/a&gt;
都是联系 SIG 存储和 CSI 团队的最佳途径。&lt;/p&gt;
&lt;!--
Special thanks to the following people whose thoughtful reviews and feedback helped shape this feature:
--&gt;
&lt;p&gt;特别感谢以下人士的仔细的审查和反馈，帮助完成了这个功能：&lt;/p&gt;
&lt;!--
* Abdullah Gharaibeh (ahg-g)
* Aldo Culquicondor (alculquicondor)
* Antonio Ojea (aojea)
* David Eads (deads2k)
* Jan Šafránek (jsafrane)
* Joe Betz (jpbetz)
* Kante Yin (kerthcet)
* Michelle Au (msau42)
* Tim Bannister (sftim)
* Xing Yang (xing-yang)
--&gt;
&lt;ul&gt;
&lt;li&gt;Abdullah Gharaibeh (ahg-g)&lt;/li&gt;
&lt;li&gt;Aldo Culquicondor (alculquicondor)&lt;/li&gt;
&lt;li&gt;Antonio Ojea (aojea)&lt;/li&gt;
&lt;li&gt;David Eads (deads2k)&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;Kante Yin (kerthcet)&lt;/li&gt;
&lt;li&gt;Michelle Au (msau42)&lt;/li&gt;
&lt;li&gt;Tim Bannister (sftim)&lt;/li&gt;
&lt;li&gt;Xing Yang (xing-yang)&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
If you’re interested in getting involved with the design and development of CSI
or any part of the Kubernetes storage system, join the
[Kubernetes Storage Special Interest Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG).
We’re rapidly growing and always welcome new contributors.
--&gt;
&lt;p&gt;如果您有兴趣参与 CSI 或 Kubernetes 存储系统的任何部分的设计和开发，
请加入 &lt;a href=&#34;https://github.com/kubernetes/community/tree/master/sig-storage&#34;&gt;Kubernetes 存储特别兴趣小组&lt;/a&gt;(SIG)。
我们正在迅速发展，始终欢迎新的贡献者。&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：高效的 SELinux 卷重新标记（Beta 版）</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/18/kubernetes-1-27-efficient-selinux-relabeling-beta/</link>
      <pubDate>Tue, 18 Apr 2023 10:00:00 -0800</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/18/kubernetes-1-27-efficient-selinux-relabeling-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: Efficient SELinux volume relabeling (Beta)&#34;
date: 2023-04-18T10:00:00-08:00
slug: kubernetes-1-27-efficient-selinux-relabeling-beta
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：Jan Šafránek (Red Hat)&lt;/p&gt;
&lt;!--
**Author:** Jan Šafránek (Red Hat)
--&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：Wilson Wu (DaoCloud)&lt;/p&gt;
&lt;!--
## The problem
--&gt;
&lt;h2 id=&#34;the-problem&#34;&gt;问题&lt;/h2&gt;
&lt;!--
On Linux with Security-Enhanced Linux (SELinux) enabled, it&#39;s traditionally the container runtime that applies SELinux labels to a Pod and all its volumes. Kubernetes only passes the SELinux label from a Pod&#39;s `securityContext` fields to the container runtime.
--&gt;
&lt;p&gt;在启用了 Security-Enhancled Linux（SELinux）系统上，传统做法是让容器运行时负责为
Pod 及所有卷应用 SELinux 标签。
Kubernetes 仅将 SELinux 标签从 Pod 的 &lt;code&gt;securityContext&lt;/code&gt; 字段传递给容器运行时。&lt;/p&gt;
&lt;!--
The container runtime then recursively changes SELinux label on all files that are visible to the Pod&#39;s containers. This can be time-consuming if there are many files on the volume, especially when the volume is on a remote filesystem.
--&gt;
&lt;p&gt;然后，容器运行时以递归的方式更改 Pod 容器可见的所有文件上的 SELinux 标签。
如果卷上有许多文件，这一过程可能会非常耗时，尤其是当卷位于远程文件系统上时。&lt;/p&gt;


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

    &lt;!--
If a container uses `subPath` of a volume, only that `subPath` of the whole volume is relabeled. This allows two pods that have two different SELinux labels to use the same volume, as long as they use different subpaths of it.
--&gt;
&lt;p&gt;如果容器使用卷的 &lt;code&gt;subPath&lt;/code&gt;，则系统仅重新标记整个卷的 &lt;code&gt;subPath&lt;/code&gt;。
这样，使用不同 SELinux 标签的两个 Pod 可以使用同一卷，只要它们使用该卷的不同子路径即可。

&lt;/div&gt;

&lt;!--
If a Pod does not have any SELinux label assigned in Kubernetes API, the container runtime assigns a unique random one, so a process that potentially escapes the container boundary cannot access data of any other container on the host. The container runtime still recursively relabels all pod volumes with this random SELinux label.
--&gt;
&lt;p&gt;如果 Pod 没有从 Kubernetes API 中获得任何 SELinux 标签，则容器运行时会分配一个唯一的随机标签，
因此可能逃离容器边界的进程将无法访问主机上任何其他容器的数据。
容器运行时仍然使用此随机 SELinux 标签递归地重新标记所有 Pod 卷。&lt;/p&gt;
&lt;!--
## Improvement using mount options
--&gt;
&lt;h2 id=&#34;improvement-using-mount-options&#34;&gt;使用挂载选项进行改进&lt;/h2&gt;
&lt;!--
If a Pod and its volume meet **all** of the following conditions, Kubernetes will _mount_ the volume directly with the right SELinux label. Such mount will happen in a constant time and the container runtime will not need to recursively relabel any files on it.
--&gt;
&lt;p&gt;如果 Pod 及其卷满足以下所有条件，Kubernetes 将直接使用正确的 SELinux 标签挂载该卷。
这种挂载将在确定时间内完成，容器运行时不需要递归地重新标记其上的任何文件。&lt;/p&gt;
&lt;!--
1. The operating system must support SELinux.

   Without SELinux support detected, kubelet and the container runtime do not do anything with regard to SELinux.
--&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;操作系统必须支持 SELinux。&lt;/p&gt;
&lt;p&gt;如果没有检测到 SELinux 支持，kubelet 和容器运行时不会对 SELinux 执行任何操作。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
1. The [feature gates](/docs/reference/command-line-tools-reference/feature-gates/) `ReadWriteOncePod` and `SELinuxMountReadWriteOncePod` must be enabled. These feature gates are Beta in Kubernetes 1.27 and Alpha in 1.25.

   With any of these feature gates disabled, SELinux labels will be always applied by the container runtime by a recursive walk through the volume (or its subPaths).
--&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;必须启用&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/command-line-tools-reference/feature-gates/&#34;&gt;特性门控&lt;/a&gt;
&lt;code&gt;ReadWriteOncePod&lt;/code&gt; 和 &lt;code&gt;SELinuxMountReadWriteOncePod&lt;/code&gt;。这些特性门控在 Kubernetes 1.27 中是 Beta 版，在 1.25 中是 Alpha 版。&lt;/p&gt;
&lt;p&gt;禁用这些功能中任何一个后，SELinux 标签将始终由容器运行时通过递归遍历卷（或其 subPath）来应用。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
1. The Pod must have at least `seLinuxOptions.level` assigned in its [Pod Security Context](/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context) or all Pod containers must have it set in their [Security Contexts](/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1). Kubernetes will read the default `user`, `role` and `type` from the operating system defaults (typically `system_u`, `system_r` and `container_t`).

   Without Kubernetes knowing at least the SELinux `level`, the container runtime will assign a random one _after_ the volumes are mounted. The container runtime will still relabel the volumes recursively in that case.
--&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;
&lt;p&gt;Pod 必须在其 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context&#34;&gt;Pod 安全上下文&lt;/a&gt;中至少设置
&lt;code&gt;seLinuxOptions.level&lt;/code&gt;，或者所有 Pod 容器必须在&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1&#34;&gt;安全上下文&lt;/a&gt;中对其进行设置。
否则 Kubernetes 将从操作系统默认值（通常是 &lt;code&gt;system_u&lt;/code&gt;、&lt;code&gt;system_r&lt;/code&gt; 和 &lt;code&gt;container_t&lt;/code&gt;）中读取默认的 &lt;code&gt;user&lt;/code&gt;、&lt;code&gt;role&lt;/code&gt; 和 &lt;code&gt;type&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;如果 Kubernetes 不了解任何 SELinux &lt;code&gt;level&lt;/code&gt;，容器运行时将在卷挂载&lt;strong&gt;后&lt;/strong&gt;为其分配一个随机级别。
在这种情况下，容器运行时仍会递归地对卷进行重新标记。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
1. The volume must be a Persistent Volume with [Access Mode](/docs/concepts/storage/persistent-volumes/#access-modes) `ReadWriteOncePod`.

   This is a limitation of the initial implementation. As described above, two Pods can have a different SELinux label and still use the same volume, as long as they use a different `subPath` of it. This use case is not possible when the volumes are _mounted_ with the SELinux label, because the whole volume is mounted and most filesystems don&#39;t support mounting a single volume multiple times with multiple SELinux labels.

   If running two Pods with two different SELinux contexts and using different `subPaths` of the same volume is necessary in your deployments, please comment in the [KEP](https://github.com/kubernetes/enhancements/issues/1710) issue (or upvote any existing comment - it&#39;s best not to duplicate). Such pods may not run when the feature is extended to cover all volume access modes.
--&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;存储卷必须是&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/storage/persistent-volumes/#access-modes&#34;&gt;访问模式&lt;/a&gt;
为 &lt;code&gt;ReadWriteOncePod&lt;/code&gt; 的持久卷。&lt;/p&gt;
&lt;p&gt;这是最初的实现的限制。如上所述，两个 Pod 可以具有不同的 SELinux 标签，但仍然使用相同的卷，
只要它们使用不同的 &lt;code&gt;subPath&lt;/code&gt; 即可。对于&lt;strong&gt;已挂载的&lt;/strong&gt;带有 SELinux 标签的卷，此场景是无法支持的，
因为整个卷已挂载，并且大多数文件系统不支持使用不同的 SELinux 标签多次挂载同一个卷。&lt;/p&gt;
&lt;p&gt;如果在你的环境中需要使用两个不同的 SELinux 上下文运行两个 Pod 并使用同一卷的不同 &lt;code&gt;subPath&lt;/code&gt;，
请在 &lt;a href=&#34;https://github.com/kubernetes/enhancements/issues/1710&#34;&gt;KEP&lt;/a&gt; 问题中发表评论（或对任何现有评论进行投票 - 最好不要重复）。
当此特性扩展到覆盖所有卷访问模式时，这类 Pod 可能无法运行。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
1. The volume plugin or the CSI driver responsible for the volume supports mounting with SELinux mount options.

   These in-tree volume plugins support mounting with SELinux mount options: `fc`, `iscsi`, and `rbd`.

   CSI drivers that support mounting with SELinux mount options must announce that in their [CSIDriver](/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/) instance by setting `seLinuxMount` field.

   Volumes managed by other volume plugins or CSI drivers that don&#39;t set `seLinuxMount: true` will be recursively relabelled by the container runtime.
--&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;
&lt;p&gt;卷插件或负责卷的 CSI 驱动程序支持使用 SELinux 挂载选项进行挂载。&lt;/p&gt;
&lt;p&gt;这些树内卷插件支持使用 SELinux 挂载选项进行挂载：&lt;code&gt;fc&lt;/code&gt;、&lt;code&gt;iscsi&lt;/code&gt; 和 &lt;code&gt;rbd&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;支持使用 SELinux 挂载选项挂载的 CSI 驱动程序必须通过设置 &lt;code&gt;seLinuxMount&lt;/code&gt;
字段在其 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/&#34;&gt;CSIDriver&lt;/a&gt; 实例中声明这一点。&lt;/p&gt;
&lt;p&gt;由其他未设置 &lt;code&gt;seLinuxMount: true&lt;/code&gt; 的卷插件或 CSI 驱动程序管理的卷将由容器运行时递归地重新标记。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
### Mounting with SELinux context
--&gt;
&lt;h3 id=&#34;mounting-with-selinux-context&#34;&gt;使用 SELinux 上下文挂载&lt;/h3&gt;
&lt;!--
When all aforementioned conditions are met, kubelet will pass `-o context=&lt;SELinux label&gt;` mount option to the volume plugin or CSI driver. CSI driver vendors must ensure that this mount option is supported by their CSI driver and, if necessary, the CSI driver appends other mount options that are needed for `-o context` to work.
--&gt;
&lt;p&gt;当满足所有上述条件时，kubelet 会将 &lt;code&gt;-o context=&amp;lt;SELinux label&amp;gt;&lt;/code&gt; 挂载选项传递给卷插件或 CSI 驱动程序。
CSI 驱动程序提供者必须确保其 CSI 驱动程序支持此安装选项，并且如有必要，CSI 驱动程序要附加
&lt;code&gt;-o context&lt;/code&gt; 所需的其他安装选项。&lt;/p&gt;
&lt;!--
For example, NFS may need `-o context=&lt;SELinux label&gt;,nosharecache`, so each volume mounted from the same NFS server can have a different SELinux label value. Similarly, CIFS may need `-o context=&lt;SELinux label&gt;,nosharesock`.
--&gt;
&lt;p&gt;例如，NFS 可能需要 &lt;code&gt;-o context=&amp;lt;SELinux label&amp;gt;,nosharecache&lt;/code&gt;，这样来自同一
NFS 服务器的多个卷被挂载时可以具有不同的 SELinux 标签值。
类似地，CIFS 可能需要 &lt;code&gt;-o context=&amp;lt;SELinux label&amp;gt;,nosharesock&lt;/code&gt;。&lt;/p&gt;
&lt;!--
It&#39;s up to the CSI driver vendor to test their CSI driver in a SELinux enabled environment before setting `seLinuxMount: true` in the CSIDriver instance.
--&gt;
&lt;p&gt;在 CSIDriver 实例中设置 &lt;code&gt;seLinuxMount: true&lt;/code&gt; 之前，CSI 驱动程序提供者需要在启用 SELinux
的环境中测试其 CSI 驱动程序。&lt;/p&gt;
&lt;!--
## How can I learn more?
--&gt;
&lt;h2 id=&#34;how-can-i-learn-more&#34;&gt;如何了解更多？&lt;/h2&gt;
&lt;!--
SELinux in containers: see excellent [visual SELinux guide](https://opensource.com/business/13/11/selinux-policy-guide) by Daniel J Walsh. Note that the guide is older than Kubernetes, it describes *Multi-Category Security* (MCS) mode using virtual machines as an example, however, a similar concept is used for containers.
--&gt;
&lt;p&gt;容器中的 SELinux：请参阅 Daniel J Walsh 撰写的&lt;a href=&#34;https://opensource.com/business/13/11/selinux-policy-guide&#34;&gt;可视化 SELinux 指南（英文）&lt;/a&gt;。
请注意，该指南早于 Kubernetes，它以虚拟机为例描述了&lt;strong&gt;多类别安全&lt;/strong&gt;（MCS）模式，但是，类似的概念也适用于容器。&lt;/p&gt;
&lt;!--
See a series of blog posts for details how exactly SELinux is applied to containers by container runtimes:
--&gt;
&lt;p&gt;请参阅以下系列博客文章，详细了解容器运行时如何将 SELinux 应用于容器：&lt;/p&gt;
&lt;!--
* [How SELinux separates containers using Multi-Level Security](https://www.redhat.com/en/blog/how-selinux-separates-containers-using-multi-level-security)
* [Why you should be using Multi-Category Security for your Linux containers](https://www.redhat.com/en/blog/why-you-should-be-using-multi-category-security-your-linux-containers)
--&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.redhat.com/en/blog/how-selinux-separates-containers-using-multi-level-security&#34;&gt;SELinux 如何使用多级安全性分离容器&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.redhat.com/en/blog/why-you-should-be-using-multi-category-security-your-linux-containers&#34;&gt;为什么应该为 Linux 容器使用多类别安全性&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Read the KEP: [Speed up SELinux volume relabeling using mounts](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1710-selinux-relabeling)
--&gt;
&lt;p&gt;阅读 KEP：&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1710-selinux-relabeling&#34;&gt;使用挂载加速 SELinux 卷重新标记&lt;/a&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kubernetes 1.27：更多精细粒度的 Pod 拓扑分布策略进阶至 Beta</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/17/fine-grained-pod-topology-spread-features-beta/</link>
      <pubDate>Mon, 17 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/17/fine-grained-pod-topology-spread-features-beta/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Kubernetes 1.27: More fine-grained pod topology spread policies reached beta&#34;
date: 2023-04-17
slug: fine-grained-pod-topology-spread-features-beta
--&gt;
&lt;!--
**Authors:** [Alex Wang](https://github.com/denkensk) (Shopee), [Kante Yin](https://github.com/kerthcet) (DaoCloud), [Kensei Nakada](https://github.com/sanposhiho) (Mercari)
--&gt;
&lt;p&gt;&lt;strong&gt;作者:&lt;/strong&gt; &lt;a href=&#34;https://github.com/denkensk&#34;&gt;Alex Wang&lt;/a&gt; (Shopee),
&lt;a href=&#34;https://github.com/kerthcet&#34;&gt;Kante Yin&lt;/a&gt; (DaoCloud),
&lt;a href=&#34;https://github.com/sanposhiho&#34;&gt;Kensei Nakada&lt;/a&gt; (Mercari)&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;!--
In Kubernetes v1.19, [Pod topology spread constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/)
went to general availability (GA).

As time passed, we - SIG Scheduling - received feedback from users,
and, as a result, we&#39;re actively working on improving the Topology Spread feature via three KEPs.
All of these features have reached beta in Kubernetes v1.27 and are enabled by default.

This blog post introduces each feature and the use case behind each of them.
--&gt;
&lt;p&gt;在 Kubernetes v1.19 中，
&lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/&#34;&gt;Pod 拓扑分布约束&lt;/a&gt;进阶至正式发布 (GA)。&lt;/p&gt;
&lt;p&gt;随着时间的流逝，SIG Scheduling 收到了许多用户的反馈，
随后通过 3 个 KEP 积极改进了 Topology Spread（拓扑分布）特性。
所有这些特性在 Kubernetes v1.27 中已进阶至 Beta 且默认被启用。&lt;/p&gt;
&lt;p&gt;这篇博文介绍了这些特性及其背后的使用场景。&lt;/p&gt;
&lt;!--
## KEP-3022: min domains in Pod Topology Spread

Pod Topology Spread has the `maxSkew` parameter to define the degree to which Pods may be unevenly distributed.
--&gt;
&lt;h2 id=&#34;kep-3022-pod-拓扑分布中的最小域数&#34;&gt;KEP-3022：Pod 拓扑分布中的最小域数&lt;/h2&gt;
&lt;p&gt;Pod 拓扑分布使用 &lt;code&gt;maxSkew&lt;/code&gt; 参数来定义 Pod 可以不均匀分布的程度。&lt;/p&gt;
&lt;!--
But, there wasn&#39;t a way to control the number of domains over which we should spread.
Some users want to force spreading Pods over a minimum number of domains, and if there aren&#39;t enough already present, make the cluster-autoscaler provision them.

Kubernetes v1.24 introduced the `minDomains` parameter for pod topology spread constraints,
as an alpha feature.
Via `minDomains` parameter, you can define the minimum number of domains.

For example, assume there are 3 Nodes with the enough capacity,
and a newly created ReplicaSet has the following `topologySpreadConstraints` in its Pod template.
--&gt;
&lt;p&gt;但还有没有一种方式可以控制应分布到的域数。
一些用户想要强制在至少指定个数的若干域内分布 Pod；并且如果目前存在的域个数还不够，
则使用 cluster-autoscaler 制备新的域。&lt;/p&gt;
&lt;p&gt;Kubernetes v1.24 以 Alpha 特性的形式为 Pod 拓扑分布约束引入了 &lt;code&gt;minDomains&lt;/code&gt; 参数。
通过 &lt;code&gt;minDomains&lt;/code&gt; 参数，你可以定义最小域数。&lt;/p&gt;
&lt;p&gt;例如，假设有 3 个 Node 具有足够的容量，
且新建的 ReplicaSet 在其 Pod 模板中带有以下 &lt;code&gt;topologySpreadConstraints&lt;/code&gt;。&lt;/p&gt;
&lt;!--
```yaml
...
topologySpreadConstraints:
- maxSkew: 1
  minDomains: 5 # requires 5 Nodes at least (because each Node has a unique hostname).
  whenUnsatisfiable: DoNotSchedule # minDomains is valid only when DoNotSchedule is used.
  topologyKey: kubernetes.io/hostname
  labelSelector:
    matchLabels:
        foo: bar
```
--&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;topologySpreadConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;maxSkew&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;minDomains&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 需要至少 5 个 Node（因为每个 Node 都有唯一的 hostname）&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;whenUnsatisfiable&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;DoNotSchedule&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# 只有使用 DoNotSchedule 时 minDomains 才有效&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;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;kubernetes.io/hostname&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;foo&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;bar&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
In this case, 3 Pods will be scheduled to those 3 Nodes,
but other 2 Pods from this replicaset will be unschedulable until more Nodes join the cluster.

You can imagine that the cluster autoscaler provisions new Nodes based on these unschedulable Pods,
and as a result, the replicas are finally spread over 5 Nodes.
--&gt;
&lt;p&gt;在这个场景中，3 个 Pod 将被分别调度到这 3 个 Node 上，
但 ReplicaSet 中的其它 2 个 Pod 在更多 Node 接入到集群之前将无法被调度。&lt;/p&gt;
&lt;p&gt;你可以想象集群自动扩缩器基于这些不可调度的 Pod 制备新的 Node，
因此这些副本最后将分布到 5 个 Node 上。&lt;/p&gt;
&lt;!--
## KEP-3094: Take taints/tolerations into consideration when calculating podTopologySpread skew

Before this enhancement, when you deploy a pod with `podTopologySpread` configured, kube-scheduler would
take the Nodes that satisfy the Pod&#39;s nodeAffinity and nodeSelector into consideration
in filtering and scoring, but would not care about whether the node taints are tolerated by the incoming pod or not.
This may lead to a node with untolerated taint as the only candidate for spreading, and as a result,
the pod will stuck in Pending if it doesn&#39;t tolerate the taint.
--&gt;
&lt;h2 id=&#34;kep-3094-计算-podtopologyspread-偏差时考虑污点-容忍度&#34;&gt;KEP-3094：计算 podTopologySpread 偏差时考虑污点/容忍度&lt;/h2&gt;
&lt;p&gt;在本次增强之前，当你部署已经配置了 &lt;code&gt;topologySpreadConstraints&lt;/code&gt; 的 Pod 时，kube-scheduler
将在过滤和评分时考虑满足 Pod 的 nodeAffinity 和 nodeSelector 的节点，
但不关心传入的 Pod 是否容忍节点污点。这可能会导致具有不可容忍污点的节点成为唯一的分布候选，
因此如果 Pod 不容忍污点，则该 Pod 将卡在 Pending 状态。&lt;/p&gt;
&lt;!--
To allow more fine-gained decisions about which Nodes to account for when calculating spreading skew,
Kubernetes 1.25 introduced two new fields within `topologySpreadConstraints` to define node inclusion policies:
`nodeAffinityPolicy` and `nodeTaintPolicy`.

A manifest that applies these policies looks like the following:
--&gt;
&lt;p&gt;为了能够在计算分布偏差时针对要考虑的节点作出粒度更精细的决策，Kubernetes 1.25
在 &lt;code&gt;topologySpreadConstraints&lt;/code&gt; 中引入了两个新字段 &lt;code&gt;nodeAffinityPolicy&lt;/code&gt;
和 &lt;code&gt;nodeTaintPolicy&lt;/code&gt; 来定义节点包含策略。&lt;/p&gt;
&lt;p&gt;应用这些策略的清单如下所示：&lt;/p&gt;
&lt;!--
```yaml
apiVersion: v1
kind: Pod
metadata:
  name: example-pod
spec:
  # Configure a topology spread constraint
  topologySpreadConstraints:
    - maxSkew: &lt;integer&gt;
      # ...
      nodeAffinityPolicy: [Honor|Ignore]
      nodeTaintsPolicy: [Honor|Ignore]
  # other Pod fields go here
```
--&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:#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;topologySpreadConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;maxSkew&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&amp;lt;integer&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:#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;nodeAffinityPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[Honor|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;nodeTaintsPolicy&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;[Honor|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:#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
The `nodeAffinityPolicy` field indicates how Kubernetes treats a Pod&#39;s `nodeAffinity` or `nodeSelector` for
pod topology spreading.
If `Honor`, kube-scheduler filters out nodes not matching `nodeAffinity`/`nodeSelector` in the calculation of
spreading skew.
If `Ignore`, all nodes will be included, regardless of whether they match the Pod&#39;s `nodeAffinity`/`nodeSelector`
or not.

For backwards compatibility, `nodeAffinityPolicy` defaults to `Honor`.
--&gt;
&lt;p&gt;&lt;code&gt;nodeAffinityPolicy&lt;/code&gt; 字段指示 Kubernetes 如何处理 Pod 的 &lt;code&gt;nodeAffinity&lt;/code&gt; 或 &lt;code&gt;nodeSelector&lt;/code&gt;
以计算 Pod 拓扑分布。如果是 &lt;code&gt;Honor&lt;/code&gt;，则 kube-scheduler 在计算分布偏差时会过滤掉不匹配
&lt;code&gt;nodeAffinity&lt;/code&gt;/&lt;code&gt;nodeSelector&lt;/code&gt; 的节点。如果是 &lt;code&gt;Ignore&lt;/code&gt;，则会包括所有节点，不会管它们是否与
Pod 的 &lt;code&gt;nodeAffinity&lt;/code&gt;/&lt;code&gt;nodeSelector&lt;/code&gt; 匹配。&lt;/p&gt;
&lt;p&gt;为了向后兼容，&lt;code&gt;nodeAffinityPolicy&lt;/code&gt; 默认为 &lt;code&gt;Honor&lt;/code&gt;。&lt;/p&gt;
&lt;!--
The `nodeTaintsPolicy` field defines how Kubernetes considers node taints for pod topology spreading.
If `Honor`, only tainted nodes for which the incoming pod has a toleration, will be included in the calculation of spreading skew.
If `Ignore`, kube-scheduler will not consider the node taints at all in the calculation of spreading skew, so a node with
pod untolerated taint will also be included.

For backwards compatibility, `nodeTaintsPolicy` defaults to `Ignore`.
--&gt;
&lt;p&gt;&lt;code&gt;nodeTaintsPolicy&lt;/code&gt; 字段定义 Kubernetes 计算 Pod 拓扑分布时如何对待节点污点。
如果是 &lt;code&gt;Honor&lt;/code&gt;，则只有配置了污点的节点上的传入 Pod 带有容忍标签时该节点才会被包括在分布偏差的计算中。
如果是 &lt;code&gt;Ignore&lt;/code&gt;，则在计算分布偏差时 kube-scheduler 根本不会考虑节点污点，
因此带有未容忍污点的 Pod 的节点也会被包括进去。&lt;/p&gt;
&lt;p&gt;为了向后兼容，&lt;code&gt;nodeTaintsPolicy&lt;/code&gt; 默认为 &lt;code&gt;Ignore&lt;/code&gt;。&lt;/p&gt;
&lt;!--
The feature was introduced in v1.25 as alpha. By default, it was disabled, so if you want to use this feature in v1.25,
you had to explictly enable the feature gate `NodeInclusionPolicyInPodTopologySpread`. In the following v1.26
release, that associated feature graduated to beta and is enabled by default.
--&gt;
&lt;p&gt;该特性在 v1.25 中作为 Alpha 引入。默认被禁用，因此如果要在 v1.25 中使用此特性，
则必须显式启用特性门控 &lt;code&gt;NodeInclusionPolicyInPodTopologySpread&lt;/code&gt;。
在接下来的 v1.26 版本中，相关特性进阶至 Beta 并默认被启用。&lt;/p&gt;
&lt;!--
## KEP-3243: Respect Pod topology spread after rolling upgrades
--&gt;
&lt;h2 id=&#34;kep-3243-滚动升级后关注-pod-拓扑分布&#34;&gt;KEP-3243：滚动升级后关注 Pod 拓扑分布&lt;/h2&gt;
&lt;!--
Pod Topology Spread uses the field `labelSelector` to identify the group of pods over which
spreading will be calculated. When using topology spreading with Deployments, it is common
practice to use the `labelSelector` of the Deployment as the `labelSelector` in the topology
spread constraints. However, this implies that all pods of a Deployment are part of the spreading
calculation, regardless of whether they belong to different revisions. As a result, when a new revision
is rolled out, spreading will apply across pods from both the old and new ReplicaSets, and so by the
time the new ReplicaSet is completely rolled out and the old one is rolled back, the actual spreading
we are left with may not match expectations because the deleted pods from the older ReplicaSet will cause
skewed distribution for the remaining pods. To avoid this problem, in the past users needed to add a
revision label to Deployment and update it manually at each rolling upgrade (both the label on the
pod template and the `labelSelector` in the `topologySpreadConstraints`).
--&gt;
&lt;p&gt;Pod 拓扑分布使用 &lt;code&gt;labelSelector&lt;/code&gt; 字段来标识要计算分布的 Pod 组。
在针对 Deployment 进行拓扑分布时，通常会使用 Deployment 的
&lt;code&gt;labelSelector&lt;/code&gt; 作为拓扑分布约束中的 &lt;code&gt;labelSelector&lt;/code&gt;。
但这意味着 Deployment 的所有 Pod 都参与分布计算，与这些 Pod 是否属于不同的版本无关。
因此，在发布新版本时，分布将同时应用到新旧 ReplicaSet 的 Pod，
并在新的 ReplicaSet 完全发布且旧的 ReplicaSet 被下线时，我们留下的实际分布可能与预期不符，
这是因为旧 ReplicaSet 中已删除的 Pod 将导致剩余 Pod 的分布不均匀。
为了避免这个问题，过去用户需要向 Deployment 添加修订版标签，并在每次滚动升级时手动更新
（包括 Pod 模板上的标签和 &lt;code&gt;topologySpreadConstraints&lt;/code&gt; 中的 &lt;code&gt;labelSelector&lt;/code&gt;）。&lt;/p&gt;
&lt;!--
To solve this problem with a simpler API, Kubernetes v1.25 introduced a new field named
`matchLabelKeys` to `topologySpreadConstraints`. `matchLabelKeys` is a list of pod label keys to select
the pods over which spreading will be calculated. The keys are used to lookup values from the labels of
the Pod being scheduled, those key-value labels are ANDed with `labelSelector` to select the group of
existing pods over which spreading will be calculated for the incoming pod.
--&gt;
&lt;p&gt;为了通过更简单的 API 解决这个问题，Kubernetes v1.25 引入了一个名为 &lt;code&gt;matchLabelKeys&lt;/code&gt;
的新字段到 &lt;code&gt;topologySpreadConstraints&lt;/code&gt; 中。&lt;code&gt;matchLabelKeys&lt;/code&gt; 是一个 Pod 标签键列表，
用于选择计算分布方式的 Pod。这些键用于查找 Pod 被调度时的标签值，
这些键值标签与 &lt;code&gt;labelSelector&lt;/code&gt; 进行逻辑与运算，为新增 Pod 计算分布方式选择现有 Pod 组。&lt;/p&gt;
&lt;!--
With `matchLabelKeys`, you don&#39;t need to update the `pod.spec` between different revisions.
The controller or operator managing rollouts just needs to set different values to the same label key for different revisions.
The scheduler will assume the values automatically based on `matchLabelKeys`.
For example, if you are configuring a Deployment, you can use the label keyed with
[pod-template-hash](/docs/concepts/workloads/controllers/deployment/#pod-template-hash-label),
which is added automatically by the Deployment controller, to distinguish between different
revisions in a single Deployment.
--&gt;
&lt;p&gt;借助 &lt;code&gt;matchLabelKeys&lt;/code&gt;，你无需在修订版变化时更新 &lt;code&gt;pod.spec&lt;/code&gt;。
控制器或 Operator 管理滚动升级时只需针对不同修订版为相同的标签键设置不同的值即可。
调度程序将基于 &lt;code&gt;matchLabelKeys&lt;/code&gt; 自动完成赋值。例如，如果你正配置 Deployment，
则可以使用由 Deployment 控制器自动添加的
&lt;a href=&#34;https://deploy-preview-57407--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;
的标签键来区分单个 Deployment 中的不同修订版。&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;topologySpreadConstraints&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;- &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;maxSkew&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;topologyKey&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;kubernetes.io/hostname&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;whenUnsatisfiable&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;DoNotSchedule&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;labelSelector&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;matchLabels&lt;/span&gt;:&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;          &lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;app&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;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;!--
## 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?

- [Pod Topology Spread Constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/) in the Kubernetes documentation
- [KEP-3022: min domains in Pod Topology Spread](https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3022-min-domains-in-pod-topology-spread)
- [KEP-3094: Take taints/tolerations into consideration when calculating PodTopologySpread skew](https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3094-pod-topology-spread-considering-taints)
- [KEP-3243: Respect PodTopologySpread after rolling upgrades](https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades)
--&gt;
&lt;h2 id=&#34;了解更多&#34;&gt;了解更多&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Kubernetes 文档中的 &lt;a href=&#34;https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/&#34;&gt;Pod 拓扑分布约束&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3022-min-domains-in-pod-topology-spread&#34;&gt;KEP-3022：Pod 拓扑分布中的最小域数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3094-pod-topology-spread-considering-taints&#34;&gt;KEP-3094：计算 podTopologySpread 偏差时考虑污点/容忍度&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades&#34;&gt;KEP-3243：滚动升级后关注 Pod 拓扑分布&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>“使用更新后的 Go 版本保持 Kubernetes 安全”</title>
      <link>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/06/keeping-kubernetes-secure-with-updated-go-versions/</link>
      <pubDate>Thu, 06 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://deploy-preview-57407--kubernetes-io-main-staging.netlify.app/zh-cn/blog/2023/04/06/keeping-kubernetes-secure-with-updated-go-versions/</guid>
      <description>
        
        
        &lt;!--
layout: blog
title: &#34;Keeping Kubernetes Secure with Updated Go Versions&#34;
date: 2023-04-06
slug: keeping-kubernetes-secure-with-updated-go-versions
--&gt;
&lt;!--
**Author**: [Jordan Liggitt](https://github.com/liggitt) (Google)
--&gt;
&lt;p&gt;&lt;strong&gt;作者&lt;/strong&gt;：&lt;a href=&#34;https://github.com/liggitt&#34;&gt;Jordan Liggitt&lt;/a&gt; (Google)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;译者&lt;/strong&gt;：顾欣 (ICBC)&lt;/p&gt;
&lt;h3 id=&#34;the-problem&#34;&gt;问题&lt;/h3&gt;
&lt;!--
Since v1.19 (released in 2020), the Kubernetes project provides 12-14 months of patch releases for each minor version.
This enables users to qualify and adopt Kubernetes versions in an annual upgrade cycle and receive security fixes for a year.
--&gt;
&lt;p&gt;从 2020 年发布的 v1.19 版本以来，Kubernetes 项目为每个次要版本提供 12-14 个月的补丁维护期。
这使得用户可以按照年度升级周期来评估和选用 Kubernetes 版本，并持续一年获得安全修复。&lt;/p&gt;
&lt;!--
The [Go project](https://github.com/golang/go/wiki/Go-Release-Cycle#release-maintenance) releases new minor versions twice a year,
and provides security fixes for the last two minor versions, resulting in about a year of support for each Go version.
Even though each new Kubernetes minor version is built with a supported Go version when it is first released,
that Go version falls out of support before the Kubernetes minor version does,
and the lengthened Kubernetes patch support since v1.19 only widened that gap.
--&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/golang/go/wiki/Go-Release-Cycle#release-maintenance&#34;&gt;Go 项目&lt;/a&gt;每年发布两个新的次要版本，
并为最近的两个版本提供安全修复，每个 Go 版本的维护期约为一年。
尽管每个新的 Kubernetes 次要版本在最初发布时都是使用受支持的 Go 版本编译构建的，
但在这一 Kubernetes 次要版本被停止支持之前，对应的 Go 版本就已经不被支持，
并且由于 Kubernetes 从 v1.19 开始延长了补丁支持期，这个差距被进一步扩大。&lt;/p&gt;
&lt;!--
At the time this was written, just over half of all [Go patch releases](https://go.dev/doc/devel/release) (88/171) have contained fixes for issues with possible security implications.
Even though many of these issues were not relevant to Kubernetes, some were, so it remained important to use supported Go versions that received those fixes.
--&gt;
&lt;p&gt;在编写本文时，包含了可能对安全产生影响的问题修复的 &lt;a href=&#34;https://go.dev/doc/devel/release&#34;&gt;Go 补丁发布版本&lt;/a&gt;
刚刚过半（88/171）。尽管这些问题中很多都与 Kubernetes 无关，但有些确实相关，
因此使用受支持的、已包含了这类修复的 Go 版本是非常重要的。&lt;/p&gt;
&lt;!--
An obvious solution would be to simply update Kubernetes release branches to new minor versions of Go.
However, Kubernetes avoids [destabilizing changes in patch releases](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md#what-kind-of-prs-are-good-for-cherry-picks),
and historically, this prevented updating existing release branches to new minor versions of Go, due to changes that were considered prohibitively complex, risky, or breaking to include in a patch release.
Examples include:
--&gt;
&lt;p&gt;显而易见的解决方案之一是直接更新 Kubernetes 的发布分支，使用 Go 的新次要版本。
然而，Kubernetes 避免在&lt;a href=&#34;https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md#what-kind-of-prs-are-good-for-cherry-picks&#34;&gt;补丁发布中引入破坏稳定性的变更&lt;/a&gt;，
过去，因为这些变更被认为包含过高的复杂性、风险或破坏性，不适合包含在补丁发布中，
所以不能将现有发布分支更新到 Go 的新次要版本。
示例包括：&lt;/p&gt;
&lt;!--
* Go 1.6: enabling http/2 by default
* Go 1.14: EINTR handling issues
* Go 1.17: dropping x509 CN support, ParseIP changes
* Go 1.18: disabling x509 SHA-1 certificate support by default
* Go 1.19: dropping current-dir LookPath behavior
--&gt;
&lt;ul&gt;
&lt;li&gt;Go 1.6: 默认支持 http/2&lt;/li&gt;
&lt;li&gt;Go 1.14: EINTR 问题处理&lt;/li&gt;
&lt;li&gt;Go 1.17: 取消 x509 CN 支持, ParseIP 更改&lt;/li&gt;
&lt;li&gt;Go 1.18: 默认禁用 x509 SHA-1 证书支持&lt;/li&gt;
&lt;li&gt;Go 1.19: 取消当前目录 LookPath 行为&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
Some of these changes could be easily mitigated in Kubernetes code,
some could only be opted out of via a user-specified `GODEBUG` envvar,
and others required invasive code changes or could not be avoided at all.
Because of this inconsistency, Kubernetes release branches have typically remained on a single Go minor version,
and risked being unable to pick up relevant Go security fixes for the last several months of each Kubernetes minor version&#39;s support lifetime.
--&gt;
&lt;p&gt;其中一些更改可以基本不会影响 Kubernetes 代码，
有些只能通过用户指定的 &lt;code&gt;GODEBUG&lt;/code&gt; 环境变量来选择放弃更新，
而其他变更则需要侵入式的代码变更或完全无法避免。
由于这种不一致性，Kubernetes 的发布分支通常保持使用某个固定的 Go 次要版本，
并在每个 Kubernetes 次要版本支持生命周期的最后几个月内，面临无法得到重要的 Go 安全修复的风险。&lt;/p&gt;
&lt;!--
When a relevant Go security fix was only available in newer Kubernetes minor versions,
users would have to upgrade away from older Kubernetes minor versions before their 12-14 month support period ended, just to pick up those fixes.
If a user was not prepared to do that upgrade, it could result in vulnerable Kubernetes clusters.
Even if a user could accommodate the unexpected upgrade, the uncertainty made Kubernetes&#39; annual support less reliable for planning.
--&gt;
&lt;p&gt;当某项重要的 Go 安全修复仅出现在较新的 Kubernetes 次要版本时，
用户必须在旧的 Kubernetes 次要版本的 12-14 个月支持期结束之前完成升级，以获取这些修复。
如果用户没有准备好升级，可能导致 Kubernetes 集群的安全漏洞。
即使用户可以接受这种意外升级，这种不确定性也使得 Kubernetes 在年度支持从规划角度看变得不太可靠。&lt;/p&gt;
&lt;h3 id=&#34;the-solution&#34;&gt;解决方案&lt;/h3&gt;
&lt;!--
We&#39;re happy to announce that the gap between supported Kubernetes versions and supported Go versions has been resolved as of January 2023.
--&gt;
&lt;p&gt;我们很高兴地宣布，自2023年1月起，受支持的 Kubernetes 版本与受支持的 Go 版本之间的差距已得到解决。&lt;/p&gt;
&lt;!--
We worked closely with the Go team over the past year to address the difficulties adopting new Go versions.
This prompted a [discussion](https://github.com/golang/go/discussions/55090), [proposal](https://github.com/golang/go/issues/56986),
[talk at GopherCon](https://www.youtube.com/watch?v=v24wrd3RwGo), and a [design](https://go.dev/design/56986-godebug) for improving backward compatibility in Go,
ensuring new Go versions can maintain compatible runtime behavior with previous Go versions for a minimum of two years (four Go releases).
This allows projects like Kubernetes to update release branches to supported Go versions without exposing users to behavior changes.
--&gt;
&lt;p&gt;在过去的一年里，我们与 Go 团队密切合作，以解决采用新的 Go 版本的困难。
这些工作推动了一场&lt;a href=&#34;https://github.com/golang/go/discussions/55090&#34;&gt;讨论&lt;/a&gt;、
&lt;a href=&#34;https://github.com/golang/go/issues/56986&#34;&gt;提案&lt;/a&gt;、
&lt;a href=&#34;https://www.youtube.com/watch?v=v24wrd3RwGo&#34;&gt;GopherCon 演讲&lt;/a&gt;和&lt;a href=&#34;https://go.dev/design/56986-godebug&#34;&gt;设计&lt;/a&gt;，
以提高 Go 的向后兼容性，
确保新的 Go 版本至少在两年（四个 Go 版本）内能够与之前的 Go 版本保持兼容的运行时行为。
这使得像 Kubernetes 这样的项目能够将发布分支更新到受支持的 Go 版本，
而不是将行为上的变更暴露给用户。&lt;/p&gt;
&lt;!--
The proposed improvements are on track to be [included in Go 1.21](https://tip.golang.org/doc/godebug), and the Go team already delivered targeted compatibility improvements in a Go 1.19 patch release in late 2022.
Those changes enabled Kubernetes 1.23+ to update to Go 1.19 in January of 2023, while avoiding any user-facing configuration or behavior changes.
All supported Kubernetes release branches now use supported Go versions, and can pick up new Go patch releases with available security fixes.
--&gt;
&lt;p&gt;所提议的改进正按计划&lt;a href=&#34;https://tip.golang.org/doc/godebug&#34;&gt;包含在 Go 1.21 中&lt;/a&gt;，
而且 Go 团队已经在 2022 年底的 Go 1.19 补丁发布中提供了针对兼容性的改进。
这些更改使 Kubernetes 1.23+ 在 2023 年 1 月升级到 Go 1.19，并避免了任何用户可见的配置或行为变化。
现在所有受支持的 Kubernetes 发布分支都使用受支持的 Go 版本，
并且可以使用包含可用的安全修复的、新的 Go 补丁发布。&lt;/p&gt;
&lt;!--
Going forward, Kubernetes maintainers remain committed to making Kubernetes patch releases as safe and non-disruptive as possible,
so there are several requirements a new Go minor version must meet before existing Kubernetes release branches will update to use it:
--&gt;
&lt;p&gt;展望未来，Kubernetes 维护者仍致力于使 Kubernetes 补丁发布尽可能安全且不会造成破坏，
因此在现有的 Kubernetes 发布分支更新使用新的 Go 次要版本之前，新的 Go 次要版本必须满足几个要求：&lt;/p&gt;
&lt;!--
1. The new Go version must be available for at least 3 months.
   This gives time for adoption by the Go community, and for reports of issues or regressions.
2. The new Go version must be used in a new Kubernetes minor release for at least 1 month.
   This ensures all Kubernetes release-blocking tests pass on the new Go version,
   and gives time for feedback from the Kubernetes community on release candidates and early adoption of the new minor release.
3. There must be no regressions from the previous Go version known to impact Kubernetes.
4. Runtime behavior must be preserved by default, without requiring any action by Kubernetes users / administrators.
5. Kubernetes libraries like `k8s.io/client-go` must remain compatible with the original Go version used for each minor release,
   so consumers won&#39;t *have* to update Go versions to pick up a library patch release (though they are encouraged to build with supported Go versions,
   which is made even easier with the [compatibility improvements](https://go.dev/design/56986-godebug) planned in Go 1.21).
--&gt;
&lt;ol&gt;
&lt;li&gt;新的 Go 版本必须至少已经推出 3 个月。
这给了 Go 社区足够的时间进行报告并解决问题。&lt;/li&gt;
&lt;li&gt;新的 Go 版本在新的 Kubernetes 次要版本中至少已经使用了 1 个月。
这确保 Kubernetes 所有可能阻塞发布的测试都需要能在新的 Go 版本下通过，
并在早期为 Kubernetes 社区对发布候选版本和新次要版本提供反馈时间。&lt;/li&gt;
&lt;li&gt;与先前的 Go 版本相比，不能出现新的已知会影响 Kubernetes 的问题。&lt;/li&gt;
&lt;li&gt;默认情况下必须保持运行时行为，而无需 Kubernetes 用户/管理员采取任何操作。&lt;/li&gt;
&lt;li&gt;Kubernetes 库，如 &lt;code&gt;k8s.io/client-go&lt;/code&gt; 必须与每个次要版本最初使用的 Go 版本保持兼容，
以便在获取库补丁时，用户不必更新 Go 版本（不过还是鼓励他们使用受支持的 Go 版本构建，
因为 Go 1.21 计划中的&lt;a href=&#34;https://go.dev/design/56986-godebug&#34;&gt;兼容性改进&lt;/a&gt;会使得这一操作变简单）。&lt;/li&gt;
&lt;/ol&gt;
&lt;!--
The goal of all of this work is to unobtrusively make Kubernetes patch releases safer and more secure,
and to make Kubernetes minor versions safe to use for the entire duration of their support lifetime.
--&gt;
&lt;p&gt;所有这些工作的目标是在不引人注意的情况下使 Kubernetes 补丁发布更加安全可靠，
并确保在整个支持周期内 Kubernetes 次要版本用起来都是安全的。&lt;/p&gt;
&lt;!--
Many thanks to the Go team, especially Russ Cox, for helping drive these improvements in ways that will benefit all Go users, not just Kubernetes.
--&gt;
&lt;p&gt;非常感谢 Go 团队，尤其是 Russ Cox，他们推动了这些改进，
使所有 Go 用户受益，而不仅仅是 Kubernetes。&lt;/p&gt;

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