Skip to content

Commit d127544

Browse files
authored
Merge pull request #36279 from windsonsea/checkapi
[zh-cn] sync1.25 kubelet-checkpoint-api.md
2 parents 1b26fc4 + 1dac165 commit d127544

File tree

1 file changed

+172
-0
lines changed

1 file changed

+172
-0
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
content_type: "reference"
3+
title: Kubelet Checkpoint API
4+
weight: 10
5+
---
6+
7+
{{< feature-state for_k8s_version="v1.25" state="alpha" >}}
8+
9+
<!--
10+
Checkpointing a container is the functionality to create a stateful copy of a
11+
running container. Once you have a stateful copy of a container, you could
12+
move it to a different computer for debugging or similar purposes.
13+
14+
If you move the checkpointed container data to a computer that's able to restore
15+
it, that restored container continues to run at exactly the same
16+
point it was checkpointed. You can also inspect the saved data, provided that you
17+
have suitable tools for doing so.
18+
-->
19+
为容器生成检查点这个功能可以为一个正在运行的容器创建有状态的拷贝。
20+
一旦容器有一个有状态的拷贝,你就可以将其移动到其他计算机进行调试或类似用途。
21+
22+
如果你将通过检查点操作生成的容器数据移动到能够恢复该容器的一台计算机,
23+
所恢复的容器将从之前检查点操作执行的时间点继续运行。
24+
你也可以检视所保存的数据,前提是你拥有这类操作的合适工具。
25+
26+
<!--
27+
Creating a checkpoint of a container might have security implications. Typically
28+
a checkpoint contains all memory pages of all processes in the checkpointed
29+
container. This means that everything that used to be in memory is now available
30+
on the local disk. This includes all private data and possibly keys used for
31+
encryption. The underlying CRI implementations (the container runtime on that node)
32+
should create the checkpoint archive to be only accessible by the `root` user. It
33+
is still important to remember if the checkpoint archive is transferred to another
34+
system all memory pages will be readable by the owner of the checkpoint archive.
35+
-->
36+
创建容器的检查点可能会产生安全隐患。
37+
通常,一个检查点包含执行检查点操作时容器中所有进程的所有内存页。
38+
这意味着以前存在于内存中的一切内容现在都在本地磁盘上获得。
39+
这里的内容包括一切私密数据和可能用于加密的密钥。
40+
底层 CRI 实现(该节点上的容器运行时)应创建只有 `root` 用户可以访问的检查点存档。
41+
另外重要的是记住:如果检查点存档被转移到另一个系统,该检查点存档的所有者将可以读取所有内存页。
42+
43+
<!--
44+
## Operations {#operations}
45+
46+
### `post` checkpoint the specified container {#post-checkpoint}
47+
48+
Tell the kubelet to checkpoint a specific container from the specified Pod.
49+
50+
Consult the [Kubelet authentication/authorization reference](/docs/reference/command-line-tools-reference/kubelet-authentication-authorization)
51+
for more information about how access to the kubelet checkpoint interface is
52+
controlled.
53+
-->
54+
## 操作 {#operations}
55+
56+
### `post` 对指定的容器执行检查点操作 {#post-checkpoint}
57+
58+
告知 kubelet 对指定 Pod 中的特定容器执行检查点操作。
59+
60+
查阅 [Kubelet 身份验证/鉴权参考](/zh-cn/docs/reference/command-line-tools-reference/kubelet-authentication-authorization)了解如何控制对
61+
kubelet 检查点接口的访问。
62+
63+
<!--
64+
The kubelet will request a checkpoint from the underlying
65+
{{<glossary_tooltip term_id="cri" text="CRI">}} implementation. In the checkpoint
66+
request the kubelet will specify the name of the checkpoint archive as
67+
`checkpoint-<podFullName>-<containerName>-<timestamp>.tar` and also request to
68+
store the checkpoint archive in the `checkpoints` directory below its root
69+
directory (as defined by `--root-dir`). This defaults to
70+
`/var/lib/kubelet/checkpoints`.
71+
-->
72+
Kubelet 将对底层 {{<glossary_tooltip term_id="cri" text="CRI">}} 实现请求执行检查点操作。
73+
在该检查点请求中,Kubelet 将检查点存档的名称设置为 `checkpoint-<pod 全称>-<容器名称>-<时间戳>.tar`
74+
还会请求将该检查点存档存储到其根目录(由 `--root-dir` 定义)下的 `checkpoints` 子目录中。
75+
这个目录默认为 `/var/lib/kubelet/checkpoints`
76+
77+
<!--
78+
The checkpoint archive is in _tar_ format, and could be listed using an implementation of
79+
[`tar`](https://pubs.opengroup.org/onlinepubs/7908799/xcu/tar.html). The contents of the
80+
archive depend on the underlying CRI implementation (the container runtime on that node).
81+
-->
82+
检查点存档的格式为 **tar**,可以使用 [`tar`](https://pubs.opengroup.org/onlinepubs/7908799/xcu/tar.html)
83+
的一种实现来读取。存档文件的内容取决于底层 CRI 实现(该节点的容器运行时)。
84+
85+
<!--
86+
#### HTTP Request {#post-checkpoint-request}
87+
-->
88+
#### HTTP 请求 {#post-checkpoint-request}
89+
90+
POST /checkpoint/{namespace}/{pod}/{container}
91+
92+
<!--
93+
#### Parameters {#post-checkpoint-params}
94+
95+
- **namespace** (*in path*): string, required
96+
97+
- **pod** (*in path*): string, required
98+
99+
- **container** (*in path*): string, required
100+
101+
- **timeout** (*in query*): integer
102+
-->
103+
#### 参数 {#post-checkpoint-params}
104+
105+
- **namespace** (**路径参数**):string,必需
106+
107+
{{< glossary_tooltip term_id="namespace" >}}
108+
109+
- **pod** (**路径参数**):string,必需
110+
111+
{{< glossary_tooltip term_id="pod" >}}
112+
113+
- **container** (**路径参数**):string,必需
114+
115+
{{< glossary_tooltip term_id="container" >}}
116+
117+
- **timeout** (**查询参数**):integer
118+
119+
<!--
120+
Timeout in seconds to wait until the checkpoint creation is finished.
121+
If zero or no timeout is specfied the default {{<glossary_tooltip
122+
term_id="cri" text="CRI">}} timeout value will be used. Checkpoint
123+
creation time depends directly on the used memory of the container.
124+
The more memory a container uses the more time is required to create
125+
the corresponding checkpoint.
126+
-->
127+
128+
等待检查点创建完成的超时时间(单位为秒)。
129+
如果超时值为零或未设定,将使用默认的 {{<glossary_tooltip term_id="cri" text="CRI">}} 超时时间值。
130+
生成检查点所需的时长直接取决于容器所用的内存。容器使用的内存越多,创建相应检查点所需的时间越长。
131+
132+
<!--
133+
#### Response {#post-checkpoint-response}
134+
-->
135+
#### 响应 {#post-checkpoint-response}
136+
137+
<!--
138+
200: OK
139+
140+
401: Unauthorized
141+
142+
404: Not Found (if the `CheckpointContainer` feature gate is disabled)
143+
144+
404: Not Found (if the specified `namespace`, `pod` or `container` cannot be found)
145+
146+
500: Internal Server Error (if the CRI implementation encounter an error during checkpointing (see error message for further details))
147+
148+
500: Internal Server Error (if the CRI implementation does not implement the checkpoint CRI API (see error message for further details))
149+
-->
150+
200: OK
151+
152+
401: Unauthorized
153+
154+
404: Not Found(如果 `CheckpointContainer` 特性门控被禁用)
155+
156+
404: Not Found(如果指定的 `namespace``pod``container` 无法被找到)
157+
158+
500: Internal Server Error(如果执行检查点操作期间 CRI 实现遇到一个错误(参阅错误消息了解更多细节))
159+
160+
500: Internal Server Error(如果 CRI 实现未实现检查点 CRI API(参阅错误消息了解更多细节))
161+
162+
{{< comment >}}
163+
<!--
164+
TODO: Add more information about return codes once CRI implementation have checkpoint/restore.
165+
This TODO cannot be fixed before the release, because the CRI implementation need
166+
the Kubernetes changes to be merged to implement the new CheckpointContainer CRI API
167+
call. We need to wait after the 1.25 release to fix this.
168+
-->
169+
TODO:一旦 CRI 实现具有检查点/恢复能力,就会添加有关返回码的更多信息。
170+
这个 TODO 在发布之前无法被修复,因为 CRI 实现需要先合并对 Kubernetes 的变更,
171+
才能实现新的 CheckpointContainer CRI API 调用。我们需要等到 1.25 发布后才能修复此问题。
172+
{{< /comment >}}

0 commit comments

Comments
 (0)