Skip to content

Commit 1eae49a

Browse files
authored
[zh] Add 2022-02-17-updated-dockershim-faq.md (#32342)
* [zh] Add 2022-02-17-updated-dockershim-faq.md #32270 * [zh] Add 2022-02-17-updated-dockershim-faq.md * [zh] Add 2022-02-17-updated-dockershim-faq.md * [zh] Add 2022-02-17-updated-dockershim-faq.md
1 parent 7a1cc8a commit 1eae49a

File tree

1 file changed

+373
-0
lines changed

1 file changed

+373
-0
lines changed
Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
1+
---
2+
layout: blog
3+
title: "更新:弃用 Dockershim 的常见问题"
4+
date: 2022-02-17
5+
slug: dockershim-faq
6+
aliases: [ '/dockershim' ]
7+
---
8+
<!--
9+
layout: blog
10+
title: "Updated: Dockershim Removal FAQ"
11+
date: 2022-02-17
12+
slug: dockershim-faq
13+
aliases: [ '/dockershim' ]
14+
-->
15+
16+
<!--
17+
**This is an update to the original [Dockershim Deprecation FAQ](/blog/2020/12/02/dockershim-faq/) article,
18+
published in late 2020.**
19+
-->
20+
**本文是针对2020年末发布的[弃用 Dockershim 的常见问题](/zh/blog/2020/12/02/dockershim-faq/)的博客更新。**
21+
22+
<!--
23+
This document goes over some frequently asked questions regarding the
24+
deprecation and removal of _dockershim_, that was
25+
[announced](/blog/2020/12/08/kubernetes-1-20-release-announcement/)
26+
as a part of the Kubernetes v1.20 release. For more detail
27+
on what that means, check out the blog post
28+
[Don't Panic: Kubernetes and Docker](/blog/2020/12/02/dont-panic-kubernetes-and-docker/).
29+
-->
30+
本文回顾了自 Kubernetes v1.20 版本[宣布](/zh/blog/2020/12/08/kubernetes-1-20-release-announcement/)弃用
31+
Dockershim 以来所引发的一些常见问题。关于弃用细节以及这些细节背后的含义,请参考博文
32+
[别慌: Kubernetes 和 Docker](/zh/blog/2020/12/02/dont-panic-kubernetes-and-docker/)
33+
34+
<!--
35+
Also, you can read [check whether dockershim removal affects you](/docs/tasks/administer-cluster/migrating-from-dockershim/check-if-dockershim-deprecation-affects-you/)
36+
to determine how much impact the removal of dockershim would have for you
37+
or for your organization.
38+
-->
39+
你还可以查阅:[检查弃用 Dockershim 对你的影响](/zh/docs/tasks/administer-cluster/migrating-from-dockershim/check-if-dockershim-deprecation-affects-you/)这篇文章,
40+
以确定弃用 dockershim 会对你或你的组织带来多大的影响。
41+
42+
<!--
43+
As the Kubernetes 1.24 release has become imminent, we've been working hard to try to make this a smooth transition.
44+
-->
45+
随着 Kubernetes 1.24 版本的发布迫在眉睫,我们一直在努力尝试使其能够平稳升级顺利过渡。
46+
47+
<!--
48+
- We've written a blog post detailing our [commitment and next steps](/blog/2022/01/07/kubernetes-is-moving-on-from-dockershim/).
49+
- We believe there are no major blockers to migration to [other container runtimes](/docs/setup/production-environment/container-runtimes/#container-runtimes).
50+
- There is also a [Migrating from dockershim](/docs/tasks/administer-cluster/migrating-from-dockershim/) guide available.
51+
- We've also created a page to list
52+
[articles on dockershim removal and on using CRI-compatible runtimes](/docs/reference/node/topics-on-dockershim-and-cri-compatible-runtimes/).
53+
That list includes some of the already mentioned docs, and also covers selected external sources
54+
(including vendor guides).
55+
-->
56+
- 我们已经写了一篇博文,详细说明了我们的[承诺和后续操作](/blog/2022/01/07/kubernetes-is-moving-on-from-dockershim/)
57+
- 我们我们相信可以无障碍的迁移到其他[容器运行时](/zh/docs/setup/production-environment/container-runtimes/#container-runtimes)
58+
- 我们撰写了 [dockershim 迁移指南](/docs/tasks/administer-cluster/migrating-from-dockershim/)供你参考。
59+
- 我们还创建了一个页面来列出[有关 dockershim 移除和使用 CRI 兼容运行时的文章](/zh/docs/reference/node/topics-on-dockershim-and-cri-compatible-runtimes/)
60+
该列表包括一些已经提到的文档,还涵盖了选定的外部资源(包括供应商指南)。
61+
62+
<!--
63+
### Why is the dockershim being removed from Kubernetes?
64+
-->
65+
### 为什么会从 Kubernetes 中移除 dockershim ?
66+
67+
<!--
68+
Early versions of Kubernetes only worked with a specific container runtime:
69+
Docker Engine. Later, Kubernetes added support for working with other container runtimes.
70+
The CRI standard was [created](/blog/2016/12/container-runtime-interface-cri-in-kubernetes/) to
71+
enable interoperability between orchestrators (like Kubernetes) and many different container
72+
runtimes.
73+
Docker Engine doesn't implement that interface (CRI), so the Kubernetes project created
74+
special code to help with the transition, and made that _dockershim_ code part of Kubernetes
75+
itself.
76+
-->
77+
Kubernetes 的早期版本仅适用于特定的容器运行时:Docker Engine。
78+
后来,Kubernetes 增加了对使用其他容器运行时的支持。[创建](/blog/2016/12/container-runtime-interface-cri-in-kubernetes/) CRI
79+
标准是为了实现编排器(如 Kubernetes)和许多不同的容器运行时之间交互操作。
80+
Docker Engine 没有实现(CRI)接口,因此 Kubernetes 项目创建了特殊代码来帮助过渡,
81+
并使 dockershim 代码成为 Kubernetes 的一部分。
82+
83+
<!--
84+
The dockershim code was always intended to be a temporary solution (hence the name: shim).
85+
You can read more about the community discussion and planning in the
86+
[Dockershim Removal Kubernetes Enhancement Proposal][drkep].
87+
In fact, maintaining dockershim had become a heavy burden on the Kubernetes maintainers.
88+
-->
89+
dockershim 代码一直是一个临时解决方案(因此得名:shim)。
90+
你可以阅读 [Kubernetes 移除 Dockershim 增强方案](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2221-remove-dockershim)
91+
以了解相关的社区讨论和计划。
92+
事实上,维护 dockershim 已经成为 Kubernetes 维护者的沉重负担。
93+
94+
<!--
95+
Additionally, features that were largely incompatible with the dockershim, such
96+
as cgroups v2 and user namespaces are being implemented in these newer CRI
97+
runtimes. Removing support for the dockershim will allow further development in
98+
those areas.
99+
-->
100+
此外,在较新的 CRI 运行时中实现了与 dockershim 不兼容的功能,例如 cgroups v2 和用户命名空间。
101+
取消对 dockershim 的支持将加速这些领域的发展。
102+
103+
<!--
104+
### Can I still use Docker Engine in Kubernetes 1.23?
105+
-->
106+
### 在 Kubernetes 1.23 版本中还可以使用 Docker Engine 吗?
107+
108+
<!--
109+
Yes, the only thing changed in 1.20 is a single warning log printed at [kubelet]
110+
startup if using Docker Engine as the runtime. You'll see this warning in all versions up to 1.23. The dockershim removal occurs in Kubernetes 1.24.
111+
-->
112+
可以使用,在 1.20 版本中唯一的改动是,如果使用 Docker Engine,
113+
[kubelet](/zh/docs/reference/command-line-tools-reference/kubelet/)
114+
启动时会打印一个警告日志。
115+
你将在 1.23 版本及以前版本看到此警告。dockershim 将在 Kubernetes 1.24 版本中移除 。
116+
117+
<!--
118+
### When will dockershim be removed?
119+
-->
120+
### 什么时候移除 dockershim ?
121+
122+
<!--
123+
Given the impact of this change, we are using an extended deprecation timeline.
124+
Removal of dockershim is scheduled for Kubernetes v1.24, see [Dockershim Removal Kubernetes Enhancement Proposal][drkep].
125+
The Kubernetes project will be working closely with vendors and other ecosystem groups to ensure
126+
a smooth transition and will evaluate things as the situation evolves.
127+
-->
128+
考虑到此变更带来的影响,我们使用了一个加长的废弃时间表。
129+
dockershim 计划在 Kubernetes v1.24 中进行移除,
130+
参见 [Kubernetes 移除 Dockershim 增强方案](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2221-remove-dockershim)
131+
Kubernetes 项目将与供应商和其他生态系统组织密切合作,以确保平稳过渡,并将依据事态的发展评估后续事项。
132+
133+
<!--
134+
### Can I still use Docker Engine as my container runtime?
135+
-->
136+
### 我还可以使用 Docker Engine 作为我的容器运行时吗?
137+
138+
<!--
139+
First off, if you use Docker on your own PC to develop or test containers: nothing changes.
140+
You can still use Docker locally no matter what container runtime(s) you use for your
141+
Kubernetes clusters. Containers make this kind of interoperability possible.
142+
-->
143+
首先,如果你在自己的电脑上使用 Docker 用来做开发或测试容器:它将与之前没有任何变化。
144+
无论你为 Kubernetes 集群使用什么容器运行时,你都可以在本地使用 Docker。容器使这种交互成为可能。
145+
146+
<!--
147+
Mirantis and Docker have [committed][mirantis] to maintaining a replacement adapter for
148+
Docker Engine, and to maintain that adapter even after the in-tree dockershim is removed
149+
from Kubernetes. The replacement adapter is named [`cri-dockerd`](https://github.com/Mirantis/cri-dockerd).
150+
-->
151+
Mirantis 和 Docker 已[承诺](https://www.mirantis.com/blog/mirantis-to-take-over-support-of-kubernetes-dockershim-2/)
152+
为 Docker Engine 维护一个替代适配器,
153+
并在 dockershim 从 Kubernetes 移除后维护该适配器。
154+
替代适配器名为 [`cri-dockerd`](https://github.com/Mirantis/cri-dockerd)
155+
156+
<!--
157+
### Will my existing container images still work?
158+
-->
159+
### 我现有的容器镜像还能正常工作吗?
160+
161+
<!--
162+
Yes, the images produced from `docker build` will work with all CRI implementations.
163+
All your existing images will still work exactly the same.
164+
-->
165+
当然可以,`docker build` 创建的镜像适用于任何 CRI 实现。
166+
所有你的现有镜像将和往常一样工作。
167+
168+
<!--
169+
#### What about private images?
170+
-->
171+
### 私有镜像呢?
172+
173+
<!--
174+
Yes. All CRI runtimes support the same pull secrets configuration used in
175+
Kubernetes, either via the PodSpec or ServiceAccount.
176+
-->
177+
当然可以。所有 CRI 运行时均支持在 Kubernetes 中相同的拉取(pull)Secret 配置,
178+
无论是通过 PodSpec 还是 ServiceAccount。
179+
180+
<!--
181+
### Are Docker and containers the same thing?
182+
-->
183+
### Docker 和容器是一回事吗?
184+
185+
<!--
186+
Docker popularized the Linux containers pattern and has been instrumental in
187+
developing the underlying technology, however containers in Linux have existed
188+
for a long time. The container ecosystem has grown to be much broader than just
189+
Docker. Standards like OCI and CRI have helped many tools grow and thrive in our
190+
ecosystem, some replacing aspects of Docker while others enhance existing
191+
functionality.
192+
-->
193+
Docker 普及了 Linux 容器模式,并在开发底层技术方面发挥了重要作用,
194+
但是 Linux 中的容器已经存在了很长时间。容器的生态相比于 Docker 具有更宽广的领域。
195+
OCI 和 CRI 等标准帮助许多工具在我们的生态系统中发展壮大,
196+
其中一些替代了 Docker 的某些方面,而另一些则增强了现有功能。
197+
198+
<!--
199+
### Are there examples of folks using other runtimes in production today?
200+
-->
201+
### 现在是否有在生产系统中使用其他运行时的例子?
202+
203+
<!--
204+
All Kubernetes project produced artifacts (Kubernetes binaries) are validated
205+
with each release.
206+
-->
207+
Kubernetes 所有项目在所有版本中出产的工件(Kubernetes 二进制文件)都经过了验证。
208+
209+
<!--
210+
Additionally, the [kind] project has been using containerd for some time and has
211+
seen an improvement in stability for its use case. Kind and containerd are leveraged
212+
multiple times every day to validate any changes to the Kubernetes codebase. Other
213+
related projects follow a similar pattern as well, demonstrating the stability and
214+
usability of other container runtimes. As an example, OpenShift 4.x has been
215+
using the [CRI-O] runtime in production since June 2019.
216+
-->
217+
此外,[kind](https://kind.sigs.k8s.io/) 项目使用 containerd 已经有一段时间了,并且提高了其用例的稳定性。
218+
Kind 和 containerd 每天都会被多次使用来验证对 Kubernetes 代码库的任何更改。
219+
其他相关项目也遵循同样的模式,从而展示了其他容器运行时的稳定性和可用性。
220+
例如,OpenShift 4.x 从 2019 年 6 月以来,就一直在生产环境中使用 [CRI-O](https://cri-o.io/) 运行时。
221+
222+
<!--
223+
For other examples and references you can look at the adopters of containerd and
224+
CRI-O, two container runtimes under the Cloud Native Computing Foundation ([CNCF]).
225+
-->
226+
至于其他示例和参考资料,你可以查看 containerd 和 CRI-O 的使用者列表,
227+
这两个容器运行时是云原生基金会([CNCF](https://cncf.io))下的项目。
228+
229+
- [containerd](https://github.com/containerd/containerd/blob/master/ADOPTERS.md)
230+
- [CRI-O](https://github.com/cri-o/cri-o/blob/master/ADOPTERS.md)
231+
232+
<!--
233+
### People keep referencing OCI, what is that?
234+
-->
235+
### 人们总在谈论 OCI,它是什么?
236+
237+
<!--
238+
OCI stands for the [Open Container Initiative], which standardized many of the
239+
interfaces between container tools and technologies. They maintain a standard
240+
specification for packaging container images (OCI image-spec) and running containers
241+
(OCI runtime-spec). They also maintain an actual implementation of the runtime-spec
242+
in the form of [runc], which is the underlying default runtime for both
243+
[containerd] and [CRI-O]. The CRI builds on these low-level specifications to
244+
provide an end-to-end standard for managing containers.
245+
-->
246+
OCI 是 [Open Container Initiative](https://opencontainers.org/about/overview/) 的缩写,
247+
它标准化了容器工具和底层实现之间的大量接口。
248+
它们维护了打包容器镜像(OCI image)和运行时(OCI runtime)的标准规范。
249+
它们还以 [runc](https://github.com/opencontainers/runc) 的形式维护了一个 runtime-spec 的真实实现,
250+
这也是 [containerd](https://containerd.io/)[CRI-O](https://cri-o.io/) 依赖的默认运行时。
251+
CRI 建立在这些底层规范之上,为管理容器提供端到端的标准。
252+
253+
<!--
254+
### Which CRI implementation should I use?
255+
-->
256+
### 我应该用哪个 CRI 实现?
257+
258+
<!--
259+
That’s a complex question and it depends on a lot of factors. If Docker is
260+
working for you, moving to containerd should be a relatively easy swap and
261+
will have strictly better performance and less overhead. However, we encourage you
262+
to explore all the options from the [CNCF landscape] in case another would be an
263+
even better fit for your environment.
264+
-->
265+
这是一个复杂的问题,依赖于许多因素。
266+
如果你正在使用 Docker,迁移到 containerd 应该是一个相对容易地转换,并将获得更好的性能和更少的开销。
267+
然而,我们鼓励你探索 [CNCF landscape](https://landscape.cncf.io/card-mode?category=container-runtime&grouping=category)
268+
提供的所有选项,做出更适合你的选择。
269+
270+
<!--
271+
### What should I look out for when changing CRI implementations?
272+
-->
273+
### 当切换 CRI 实现时,应该注意什么?
274+
275+
<!--
276+
While the underlying containerization code is the same between Docker and most
277+
CRIs (including containerd), there are a few differences around the edges. Some
278+
common things to consider when migrating are:
279+
-->
280+
虽然 Docker 和大多数 CRI(包括 containerd)之间的底层容器化代码是相同的,
281+
但其周边部分却存在差异。迁移时要考虑如下常见事项:
282+
283+
<!--
284+
- Logging configuration
285+
- Runtime resource limitations
286+
- Node provisioning scripts that call docker or use docker via it's control socket
287+
- Kubectl plugins that require docker CLI or the control socket
288+
- Tools from the Kubernetes project that require direct access to Docker Engine
289+
(for example: the deprecated `kube-imagepuller` tool)
290+
- Configuration of functionality like `registry-mirrors` and insecure registries
291+
- Other support scripts or daemons that expect Docker Engine to be available and are run
292+
outside of Kubernetes (for example, monitoring or security agents)
293+
- GPUs or special hardware and how they integrate with your runtime and Kubernetes
294+
-->
295+
- 日志配置
296+
- 运行时的资源限制
297+
- 调用 docker 或通过其控制套接字使用 docker 的节点配置脚本
298+
- 需要访问 docker 命令或控制套接字的 kubectl 插件
299+
- 需要直接访问 Docker Engine 的 Kubernetes 工具(例如:已弃用的 'kube-imagepuller' 工具)
300+
- `registry-mirrors` 和不安全注册表等功能的配置
301+
- 保障 Docker Engine 可用、且运行在 Kubernetes 之外的脚本或守护进程(例如:监视或安全代理)
302+
- GPU 或特殊硬件,以及它们如何与你的运行时和 Kubernetes 集成
303+
304+
<!--
305+
If you use Kubernetes resource requests/limits or file-based log collection
306+
DaemonSets then they will continue to work the same, but if you’ve customized
307+
your `dockerd` configuration, you’ll need to adapt that for your new container
308+
runtime where possible.
309+
-->
310+
如果你只是用了 Kubernetes 资源请求/限制或基于文件的日志收集 DaemonSet,它们将继续稳定工作,
311+
但是如果你用了自定义了 dockerd 配置,则可能需要为新的容器运行时做一些适配工作。
312+
313+
<!--
314+
Another thing to look out for is anything expecting to run for system maintenance
315+
or nested inside a container when building images will no longer work. For the
316+
former, you can use the [`crictl`][cr] tool as a drop-in replacement (see [mapping from docker cli to crictl](https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/#mapping-from-docker-cli-to-crictl)) and for the
317+
latter you can use newer container build options like [img], [buildah],
318+
[kaniko], or [buildkit-cli-for-kubectl] that don’t require Docker.
319+
-->
320+
另外还有一个需要关注的点,那就是当创建镜像时,系统维护或嵌入容器方面的任务将无法工作。
321+
对于前者,可以用 [`crictl`](https://github.com/kubernetes-sigs/cri-tools) 工具作为临时替代方案
322+
(参阅[从 docker cli 到 crictl 的映射](/zh/docs/tasks/debug-application-cluster/crictl/#mapping-from-docker-cli-to-crictl))。
323+
对于后者,可以用新的容器创建选项,例如
324+
[img](https://github.com/genuinetools/img)
325+
[buildah](https://github.com/containers/buildah)
326+
[kaniko](https://github.com/GoogleContainerTools/kaniko)
327+
[buildkit-cli-for-kubectl](https://github.com/vmware-tanzu/buildkit-cli-for-kubectl)
328+
他们都不需要 Docker。
329+
330+
<!--
331+
For containerd, you can start with their [documentation] to see what configuration
332+
options are available as you migrate things over.
333+
-->
334+
对于 containerd,你可查阅有关它的[文档](https://github.com/containerd/cri/blob/master/docs/registry.md)
335+
获取迁移时可用的配置选项。
336+
337+
<!--
338+
For instructions on how to use containerd and CRI-O with Kubernetes, see the
339+
Kubernetes documentation on [Container Runtimes]
340+
-->
341+
有关如何在 Kubernetes 中使用 containerd 和 CRI-O 的说明,
342+
请参阅 [Kubernetes 相关文档](/docs/setup/production-environment/container-runtimes/)
343+
344+
<!--
345+
### What if I have more questions?
346+
-->
347+
### 我还有其他问题怎么办?
348+
349+
<!--
350+
If you use a vendor-supported Kubernetes distribution, you can ask them about
351+
upgrade plans for their products. For end-user questions, please post them
352+
to our end user community forum: https://discuss.kubernetes.io/.
353+
-->
354+
如果你使用了供应商支持的 Kubernetes 发行版,你可以咨询供应商他们产品的升级计划。
355+
对于最终用户的问题,请把问题发到我们的最终用户社区的论坛:https://discuss.kubernetes.io/。
356+
357+
<!--
358+
You can also check out the excellent blog post
359+
[Wait, Docker is deprecated in Kubernetes now?][dep] a more in-depth technical
360+
discussion of the changes.
361+
-->
362+
你也可以看看这篇优秀的博客文章:[等等,Docker 被 Kubernetes 弃用了?](https://dev.to/inductor/wait-docker-is-deprecated-in-kubernetes-now-what-do-i-do-e4m)
363+
对这些变化进行更深入的技术讨论。
364+
365+
<!--
366+
### Can I have a hug?
367+
-->
368+
### 我可以加入吗?
369+
370+
<!--
371+
Yes, we're still giving hugs as requested. 🤗🤗🤗
372+
-->
373+
当然,只要你愿意,随时随地欢迎。🤗🤗🤗

0 commit comments

Comments
 (0)