Skip to content

Commit c136175

Browse files
authored
Merge pull request #34022 from tengqm/addback-check-dockershim
Add back check dockershim impact page
2 parents fada4a4 + 15df3df commit c136175

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
---
2+
title: 检查弃用 Dockershim 是否对你有影响
3+
content_type: task
4+
weight: 20
5+
---
6+
<!--
7+
title: Check whether Dockershim deprecation affects you
8+
content_type: task
9+
reviewers:
10+
- SergeyKanzhelev
11+
weight: 20
12+
-->
13+
14+
<!-- overview -->
15+
16+
<!--
17+
The `dockershim` component of Kubernetes allows to use Docker as a Kubernetes's
18+
{{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}.
19+
Kubernetes' built-in `dockershim` component was removed in release v1.24.
20+
-->
21+
22+
Kubernetes 的 `dockershim` 组件使得你可以把 Docker 用作 Kubernetes 的
23+
{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}。
24+
在 Kubernetes v1.24 版本中,内建组件 `dockershim` 被移除。
25+
26+
27+
<!--
28+
This page explains how your cluster could be using Docker as a container runtime,
29+
provides details on the role that `dockershim` plays when in use, and shows steps
30+
you can take to check whether any workloads could be affected by `dockershim` removal.
31+
-->
32+
本页讲解你的集群把 Docker 用作容器运行时的运作机制,
33+
并提供使用 `dockershim` 时,它所扮演角色的详细信息,
34+
继而展示了一组操作,可用来检查弃用 `dockershim` 对你的工作负载是否有影响。
35+
36+
<!--
37+
## Finding if your app has a dependencies on Docker {#find-docker-dependencies}
38+
-->
39+
## 检查你的应用是否依赖于 Docker {#find-docker-dependencies}
40+
41+
<!--
42+
If you are using Docker for building your application containers, you can still
43+
run these containers on any container runtime. This use of Docker does not count
44+
as a dependency on Docker as a container runtime.
45+
-->
46+
即使你是通过 Docker 创建的应用容器,也不妨碍你在其他任何容器运行时上运行这些容器。
47+
这种使用 Docker 的方式并不构成对 Docker 作为一个容器运行时的依赖。
48+
49+
<!--
50+
When alternative container runtime is used, executing Docker commands may either
51+
not work or yield unexpected output. This is how you can find whether you have a
52+
dependency on Docker:
53+
-->
54+
当用了别的容器运行时之后,Docker 命令可能不工作,或者产生意外的输出。
55+
下面是判定你是否依赖于 Docker 的方法。
56+
57+
<!--
58+
1. Make sure no privileged Pods execute Docker commands (like `docker ps`),
59+
restart the Docker service (commands such as `systemctl restart docker.service`),
60+
or modify Docker-specific files such as `/etc/docker/daemon.json`.
61+
1. Check for any private registries or image mirror settings in the Docker
62+
configuration file (like `/etc/docker/daemon.json`). Those typically need to
63+
be reconfigured for another container runtime.
64+
1. Check that scripts and apps running on nodes outside of your Kubernetes
65+
infrastructure do not execute Docker commands. It might be:
66+
- SSH to nodes to troubleshoot;
67+
- Node startup scripts;
68+
- Monitoring and security agents installed on nodes directly.
69+
-->
70+
1. 确认没有特权 Pod 执行 Docker 命令(如 `docker ps`)、重新启动 Docker
71+
服务(如 `systemctl restart docker.service`)或修改 Docker 配置文件
72+
`/etc/docker/daemon.json`
73+
2. 检查 Docker 配置文件(如 `/etc/docker/daemon.json`)中容器镜像仓库的镜像(mirror)站点设置。
74+
这些配置通常需要针对不同容器运行时来重新设置。
75+
3. 检查确保在 Kubernetes 基础设施之外的节点上运行的脚本和应用程序没有执行 Docker 命令。
76+
可能的情况有:
77+
- SSH 到节点排查故障;
78+
- 节点启动脚本;
79+
- 直接安装在节点上的监控和安全代理。
80+
<!--
81+
1. Third-party tools that perform above mentioned privileged operations. See
82+
[Migrating telemetry and security agents from dockershim](/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents)
83+
for more information.
84+
1. Make sure there is no indirect dependencies on dockershim behavior.
85+
This is an edge case and unlikely to affect your application. Some tooling may be configured
86+
to react to Docker-specific behaviors, for example, raise alert on specific metrics or search for
87+
a specific log message as part of troubleshooting instructions.
88+
If you have such tooling configured, test the behavior on test
89+
cluster before migration.
90+
-->
91+
4. 检查执行上述特权操作的第三方工具。
92+
详细操作请参考[从 dockershim 迁移遥测和安全代理](/zh/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents)
93+
5. 确认没有对 dockershim 行为的间接依赖。这是一种极端情况,不太可能影响你的应用。
94+
一些工具很可能被配置为使用了 Docker 特性,比如,基于特定指标发警报,
95+
或者在故障排查指令的一个环节中搜索特定的日志信息。
96+
如果你有此类配置的工具,需要在迁移之前,在测试集群上测试这类行为。
97+
98+
<!--
99+
## Dependency on Docker explained {#role-of-dockershim}
100+
-->
101+
## Docker 依赖详解 {#role-of-dockershim}
102+
103+
<!--
104+
A [container runtime](/docs/concepts/containers/#container-runtimes) is software that can
105+
execute the containers that make up a Kubernetes pod. Kubernetes is responsible for orchestration
106+
and scheduling of Pods; on each node, the {{< glossary_tooltip text="kubelet" term_id="kubelet" >}}
107+
uses the container runtime interface as an abstraction so that you can use any compatible
108+
container runtime.
109+
-->
110+
[容器运行时](/zh/docs/concepts/containers/#container-runtimes)是一个软件,
111+
用来运行组成 Kubernetes Pod 的容器。
112+
Kubernetes 负责编排和调度 Pod;在每一个节点上,{{< glossary_tooltip text="kubelet" term_id="kubelet" >}}
113+
使用抽象的容器运行时接口,所以你可以任意选用兼容的容器运行时。
114+
115+
<!--
116+
In its earliest releases, Kubernetes offered compatibility with one container runtime: Docker.
117+
Later in the Kubernetes project's history, cluster operators wanted to adopt additional container runtimes.
118+
The CRI was designed to allow this kind of flexibility - and the kubelet began supporting CRI. However,
119+
because Docker existed before the CRI specification was invented, the Kubernetes project created an
120+
adapter component, `dockershim`. The dockershim adapter allows the kubelet to interact with Docker as
121+
if Docker were a CRI compatible runtime.
122+
-->
123+
在早期版本中,Kubernetes 提供的兼容性支持一个容器运行时:Docker。
124+
在 Kubernetes 后来的发展历史中,集群运营人员希望采用别的容器运行时。
125+
于是 CRI 被设计出来满足这类灵活性需求 - 而 kubelet 亦开始支持 CRI。
126+
然而,因为 Docker 在 CRI 规范创建之前就已经存在,Kubernetes 就创建了一个适配器组件 `dockershim`
127+
dockershim 适配器允许 kubelet 与 Docker 交互,就好像 Docker 是一个 CRI 兼容的运行时一样。
128+
129+
<!--
130+
You can read about it in [Kubernetes Containerd integration goes GA](/blog/2018/05/24/kubernetes-containerd-integration-goes-ga/) blog post.
131+
-->
132+
你可以阅读博文
133+
[Kubernetes 正式支持集成 Containerd](/zh/blog/2018/05/24/kubernetes-containerd-integration-goes-ga/)
134+
135+
<!-- Dockershim vs. CRI with Containerd -->
136+
![Dockershim 和 Containerd CRI 的实现对比图](/images/blog/2018-05-24-kubernetes-containerd-integration-goes-ga/cri-containerd.png)
137+
138+
<!--
139+
Switching to Containerd as a container runtime eliminates the middleman. All the
140+
same containers can be run by container runtimes like Containerd as before. But
141+
now, since containers schedule directly with the container runtime, they are not visible to Docker.
142+
So any Docker tooling or fancy UI you might have used
143+
before to check on these containers is no longer available.
144+
-->
145+
切换到 Containerd 容器运行时可以消除掉中间环节。
146+
所有相同的容器都可由 Containerd 这类容器运行时来运行。
147+
但是现在,由于直接用容器运行时调度容器,它们对 Docker 是不可见的。
148+
因此,你以前用来检查这些容器的 Docker 工具或漂亮的 UI 都不再可用。
149+
150+
<!--
151+
You cannot get container information using `docker ps` or `docker inspect`
152+
commands. As you cannot list containers, you cannot get logs, stop containers,
153+
or execute something inside container using `docker exec`.
154+
-->
155+
你不能再使用 `docker ps``docker inspect` 命令来获取容器信息。
156+
由于你不能列出容器,因此你不能获取日志、停止容器,甚至不能通过 `docker exec` 在容器中执行命令。
157+
158+
{{< note >}}
159+
<!--
160+
If you're running workloads via Kubernetes, the best way to stop a container is through
161+
the Kubernetes API rather than directly through the container runtime (this advice applies
162+
for all container runtimes, not only Docker).
163+
-->
164+
如果你在用 Kubernetes 运行工作负载,最好通过 Kubernetes API 停止容器,
165+
而不是通过容器运行时来停止它们
166+
(此建议适用于所有容器运行时,不仅仅是针对 Docker)。
167+
{{< /note >}}
168+
169+
<!--
170+
You can still pull images or build them using `docker build` command. But images
171+
built or pulled by Docker would not be visible to container runtime and
172+
Kubernetes. They needed to be pushed to some registry to allow them to be used
173+
by Kubernetes.
174+
-->
175+
你仍然可以下载镜像,或者用 `docker build` 命令创建它们。
176+
但用 Docker 创建、下载的镜像,对于容器运行时和 Kubernetes,均不可见。
177+
为了在 Kubernetes 中使用,需要把镜像推送(push)到某镜像仓库。
178+
179+
## {{% heading "whatsnext" %}}
180+
181+
<!--
182+
- Read [Migrating from dockershim](/docs/tasks/administer-cluster/migrating-from-dockershim/) to understand your next steps
183+
- Read the [dockershim deprecation FAQ](/blog/2020/12/02/dockershim-faq/) article for more information.
184+
-->
185+
- 阅读[从 dockershim 迁移](/zh/docs/tasks/administer-cluster/migrating-from-dockershim/)
186+
以了解你的下一步工作。
187+
- 阅读[dockershim 弃用常见问题解答](/zh/blog/2020/12/02/dockershim-faq/)文章,了解更多信息。
188+

0 commit comments

Comments
 (0)