Skip to content

Commit cba0737

Browse files
committed
[zh] Sync config-api/kubelet-config.v1.md
1 parent c1bc7b9 commit cba0737

File tree

1 file changed

+152
-4
lines changed

1 file changed

+152
-4
lines changed

content/zh-cn/docs/reference/config-api/kubelet-config.v1.md

+152-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ Kubelet 从磁盘上读取这些配置信息,并根据 CredentialProvider 类
4343
Multiple providers may match against a single image, in which case credentials
4444
from all providers will be returned to the kubelet. If multiple providers are called
4545
for a single image, the results are combined. If providers return overlapping
46-
auth keys, the value from the provider earlier in this list is used.
46+
auth keys, the value from the provider earlier in this list is attempted first.
4747
-->
4848
<p>
4949
<code>providers</code> 是一组凭据提供程序插件,这些插件会被 kubelet 启用。
5050
多个提供程序可以匹配到同一镜像上,这时,来自所有提供程序的凭据信息都会返回给 kubelet。
5151
如果针对同一镜像调用了多个提供程序,则结果会被组合起来。如果提供程序返回的认证主键有重复,
52-
列表中先出现的提供程序所返回的值将被使用
52+
列表中先出现的提供程序所返回的值将被首先尝试
5353
</p>
5454
</td>
5555
</tr>
@@ -84,11 +84,13 @@ CredentialProvider 代表的是要被 kubelet 调用的一个 exec 插件。
8484
name is the required name of the credential provider. It must match the name of the
8585
provider executable as seen by the kubelet. The executable must be in the kubelet's
8686
bin directory (set by the --image-credential-provider-bin-dir flag).
87+
Required to be unique across all providers.
8788
-->
8889
<p>
8990
<code>name</code> 是凭据提供程序的名称(必需)。此名称必须与 kubelet
9091
所看到的提供程序可执行文件的名称匹配。可执行文件必须位于 kubelet 的
9192
<code>bin</code> 目录(通过 <code>--image-credential-provider-bin-dir</code> 设置)下。
93+
在所有提供程序中,名称是唯一的。
9294
</p>
9395
</td>
9496
</tr>
@@ -110,9 +112,9 @@ and URL path.
110112
<!--
111113
Each entry in matchImages is a pattern which can optionally contain a port and a path.
112114
Globs can be used in the domain, but not in the port or the path. Globs are supported
113-
as subdomains like '&ast;.k8s.io' or 'k8s.&ast;.io', and top-level-domains such as 'k8s.&ast;'.
115+
as subdomains like '<em>.k8s.io' or 'k8s.</em>.io', and top-level-domains such as 'k8s.<em>'.
114116
Matching partial subdomains like 'app</em>.k8s.io' is also supported. Each glob can only match
115-
a single subdomain segment, so &ast;.io does not match &ast;.k8s.io.
117+
a single subdomain segment, so *.io does not match *.k8s.io.
116118
-->
117119
<p><code>matchImages</code> 中的每个条目都是一个模式字符串,其中可以包含端口号和路径。
118120
域名部分可以包含通配符,但端口或路径部分不可以。'&ast;.k8s.io' 或 'k8s.&ast;.io' 等子域名以及
@@ -203,6 +205,50 @@ Example values of matchImages:
203205
</p>
204206
</td>
205207
</tr>
208+
<tr><td><code>tokenAttributes</code><br/>
209+
<a href="#kubelet-config-k8s-io-v1-ServiceAccountTokenAttributes"><code>ServiceAccountTokenAttributes</code></a>
210+
</td>
211+
<td>
212+
<p>
213+
<!--
214+
tokenAttributes is the configuration for the service account token that will be passed to the plugin.
215+
The credential provider opts in to using service account tokens for image pull by setting this field.
216+
When this field is set, kubelet will generate a service account token bound to the pod for which the
217+
image is being pulled and pass to the plugin as part of CredentialProviderRequest along with other
218+
attributes required by the plugin.
219+
-->
220+
tokenAttributes 是将传递给插件的服务账号令牌的配置。
221+
凭据提供程序通过设置此字段选择使用服务账号令牌进行镜像拉取。
222+
当设置了此字段后,kubelet 将为正在拉取镜像的 Pod 生成一个绑定到此 Pod 的服务账号令牌,
223+
并将其作为 CredentialProviderRequest 的一部分传递给插件,同时传递插件所需的其他属性。
224+
</p>
225+
<p>
226+
<!--
227+
The service account metadata and token attributes will be used as a dimension to cache
228+
the credentials in kubelet. The cache key is generated by combining the service account metadata
229+
(namespace, name, UID, and annotations key+value for the keys defined in
230+
serviceAccountTokenAttribute.requiredServiceAccountAnnotationKeys and serviceAccountTokenAttribute.optionalServiceAccountAnnotationKeys).
231+
The pod metadata (namespace, name, UID) that are in the service account token are not used as a dimension
232+
to cache the credentials in kubelet. This means workloads that are using the same service account
233+
could end up using the same credentials for image pull. For plugins that don't want this behavior, or
234+
plugins that operate in pass-through mode; i.e., they return the service account token as-is, they
235+
can set the credentialProviderResponse.cacheDuration to 0. This will disable the caching of
236+
credentials in kubelet and the plugin will be invoked for every image pull. This does result in
237+
token generation overhead for every image pull, but it is the only way to ensure that the
238+
credentials are not shared across pods (even if they are using the same service account).
239+
-->
240+
服务账号的元数据和令牌属性将作为 kubelet 中缓存凭据的一个维度。
241+
缓存键由服务账号的元数据(命名空间、名称、UID 以及 serviceAccountTokenAttribute.requiredServiceAccountAnnotationKeys
242+
和 serviceAccountTokenAttribute.optionalServiceAccountAnnotationKeys 中定义的注解键及其对应的值)组合生成。
243+
服务账号令牌中的 Pod 元数据(命名空间、名称、UID)不会作为 kubelet 缓存凭据的维度。
244+
这意味着,使用相同服务账号的工作负载可能会共用相同的凭据进行镜像拉取。
245+
对于不希望出现此行为的插件,或者以直通模式运行的插件(即直接返回服务账号令牌而不做处理),可以将
246+
credentialProviderResponse.cacheDuration 设置为 0。这将禁用 kubelet 中凭据的缓存机制,
247+
每次镜像拉取时都会调用插件。虽然这会导致每次镜像拉取时都要重新生成令牌而带来开销,
248+
但这是确保凭据不会在使用相同服务账号的多个 Pod 之间共享的唯一方式。
249+
</p>
250+
</td>
251+
</tr>
206252
</tbody>
207253
</table>
208254

@@ -241,3 +287,105 @@ ExecEnvVar 用来在执行基于 exec 的凭据插件时设置环境变量。
241287
</tr>
242288
</tbody>
243289
</table>
290+
291+
## `ServiceAccountTokenAttributes` {#kubelet-config-k8s-io-v1-ServiceAccountTokenAttributes}
292+
293+
<!--
294+
**Appears in:**
295+
-->
296+
**出现在**
297+
298+
- [CredentialProvider](#kubelet-config-k8s-io-v1-CredentialProvider)
299+
300+
<p>
301+
<!--
302+
ServiceAccountTokenAttributes is the configuration for the service account token that will be passed to the plugin.
303+
-->
304+
ServiceAccountTokenAttributes 是将被传递给插件的服务账号令牌的配置。
305+
</p>
306+
307+
<table class="table">
308+
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
309+
<tbody>
310+
311+
312+
<tr><td><code>serviceAccountTokenAudience</code> <B><!--[Required]-->[必需]</B><br/>
313+
<code>string</code>
314+
</td>
315+
<td>
316+
<p>
317+
<!--
318+
serviceAccountTokenAudience is the intended audience for the projected service account token.
319+
-->
320+
serviceAccountTokenAudience 是投射的服务账号令牌的目标受众。
321+
</p>
322+
</td>
323+
</tr>
324+
<tr><td><code>requireServiceAccount</code> <B><!--[Required]-->[必需]</B><br/>
325+
<code>bool</code>
326+
</td>
327+
<td>
328+
<p>
329+
<!--
330+
requireServiceAccount indicates whether the plugin requires the pod to have a service account.
331+
If set to true, kubelet will only invoke the plugin if the pod has a service account.
332+
If set to false, kubelet will invoke the plugin even if the pod does not have a service account
333+
and will not include a token in the CredentialProviderRequest in that scenario. This is useful for plugins that
334+
are used to pull images for pods without service accounts (e.g., static pods).
335+
-->
336+
requireServiceAccount 指示插件是否需要 Pod 拥有服务帐号。
337+
如果设置为 true,kubelet 仅在 Pod 拥有服务账号时才会调用插件。
338+
如果设置为 false,即使 Pod 没有服务账号,kubelet 也会调用插件,
339+
并且不会在 CredentialProviderRequest 中包含令牌。
340+
这对于用于拉取没有服务账号的 Pod(例如静态 Pod)镜像的插件非常有用。
341+
</p>
342+
</td>
343+
</tr>
344+
<tr><td><code>requiredServiceAccountAnnotationKeys</code><br/>
345+
<code>[]string</code>
346+
</td>
347+
<td>
348+
<p>
349+
<!--
350+
requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in
351+
and that are required to be present in the service account.
352+
The keys defined in this list will be extracted from the corresponding service account and passed
353+
to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list
354+
are not present in the service account, kubelet will not invoke the plugin and will return an error.
355+
This field is optional and may be empty. Plugins may use this field to extract
356+
additional information required to fetch credentials or allow workloads to opt in to
357+
using service account tokens for image pull.
358+
If non-empty, requireServiceAccount must be set to true.
359+
-->
360+
requiredServiceAccountAnnotationKeys 是插件感兴趣的注解键列表,并且这些键需要存在于服务帐号中。
361+
在此列表中定义的键将从相应的服务帐号中提取,并作为 CredentialProviderRequest 的一部分传递给插件。
362+
如果此列表中定义的任何一个键不存在于服务账号中,kubelet 将不会调用插件并返回错误。
363+
此字段是可选的,可以为空。插件可以使用此字段提取获取凭据所需的额外信息,
364+
或允许工作负载选择使用服务帐号令牌进行镜像拉取。
365+
如果非空,则 requireServiceAccount 必须设置为 true。
366+
</p>
367+
</td>
368+
</tr>
369+
<tr><td><code>optionalServiceAccountAnnotationKeys</code><br/>
370+
<code>[]string</code>
371+
</td>
372+
<td>
373+
<p>
374+
<!--
375+
optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in
376+
and that are optional to be present in the service account.
377+
The keys defined in this list will be extracted from the corresponding service account and passed
378+
to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating
379+
the existence of annotations and their values.
380+
This field is optional and may be empty. Plugins may use this field to extract
381+
additional information required to fetch credentials.
382+
-->
383+
optionalServiceAccountAnnotationKeys 是插件感兴趣的注解键列表,并且这些键在服务帐号中是可选存在的。
384+
在此列表中定义的键将从相应的服务账号中提取,并作为 CredentialProviderRequest 的一部分传递给插件。
385+
插件负责验证注解及其值的存在性。此字段是可选的,可以为空。
386+
插件可以使用此字段提取获取凭据所需的额外信息。
387+
</p>
388+
</td>
389+
</tr>
390+
</tbody>
391+
</table>

0 commit comments

Comments
 (0)