Skip to content

Commit fdccecd

Browse files
committed
[zh] Sync kms-provider.md
1 parent 751ec13 commit fdccecd

File tree

1 file changed

+59
-128
lines changed

1 file changed

+59
-128
lines changed

content/zh-cn/docs/tasks/administer-cluster/kms-provider.md

Lines changed: 59 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,29 @@ weight: 370
1616
<!--
1717
This page shows how to configure a Key Management Service (KMS) provider and plugin to enable secret data encryption.
1818
In Kubernetes {{< skew currentVersion >}} there are two versions of KMS at-rest encryption.
19-
You should use KMS v2 if feasible because KMS v1 is deprecated (since Kubernetes v1.28).
20-
However, you should also read and observe the **Caution** notices in this page that highlight specific
21-
cases when you must not use KMS v2. KMS v2 offers significantly better performance characteristics than KMS v1.
19+
You should use KMS v2 if feasible because KMS v1 is deprecated (since Kubernetes v1.28) and disabled by default (since Kubernetes v1.29).
20+
KMS v2 offers significantly better performance characteristics than KMS v1.
2221
-->
2322
本页展示了如何配置密钥管理服务(Key Management Service,KMS)驱动和插件以启用 Secret 数据加密。
2423
在 Kubernetes {{< skew currentVersion >}} 中,存在两个版本的 KMS 静态加密方式。
25-
如果可行的话,建议使用 KMS v2,因为(自 Kubernetes v1.28 起)KMS v1 已经被弃用。
26-
然而,在某些特殊情况下没办法使用 KMS v2,你应阅读和关注本页中强调的 **注意** 事项
24+
如果可行的话,建议使用 KMS v2,因为(自 Kubernetes v1.28 起)KMS v1 已经被弃用并
25+
(自 Kubernetes v1.29 起)默认被禁用
2726
KMS v2 提供了比 KMS v1 明显更好的性能特征。
2827

28+
{{< caution >}}
29+
<!--
30+
This documentation is for the generally available implementation of KMS v2 (and for the
31+
deprecated version 1 implementation).
32+
If you are using any control plane components older than Kubernetes v1.29, please check
33+
the equivalent page in the documentation for the version of Kubernetes that your cluster
34+
is running. Earlier releases of Kubernetes had different behavior that may be relevant
35+
for information security.
36+
-->
37+
本文适用于正式发布的 KMS v2 实现(以及已废弃的 v1 实现)。
38+
如果你使用的控制平面组件早于 Kubernetes v1.29,请查看集群所运行的 Kubernetes 版本文档中的相应页面。
39+
早期版本的 Kubernetes 在信息安全方面具有不同的行为。
40+
{{< /caution >}}
41+
2942
## {{% heading "prerequisites" %}}
3043

3144
{{< include "task-tutorial-prereqs.md" >}}
@@ -38,7 +51,7 @@ you have selected. Kubernetes recommends using KMS v2.
3851
(if you are running a different version of Kubernetes that also supports the v2 KMS
3952
API, switch to the documentation for that version of Kubernetes).
4053
- If you selected KMS API v1 to support clusters prior to version v1.27
41-
or if you have a legacy KMS plugin that only supports KMS v1,
54+
or if you have a legacy KMS plugin that only supports KMS v1,
4255
any supported Kubernetes version will work. This API is deprecated as of Kubernetes v1.28.
4356
Kubernetes does not recommend the use of this API.
4457
-->
@@ -59,85 +72,54 @@ you have selected. Kubernetes recommends using KMS v2.
5972
<!--
6073
* Kubernetes version 1.10.0 or later is required
6174
75+
* For version 1.29 and later, the v1 implementation of KMS is disabled by default.
76+
To enable the feature, set `--feature-gates=KMSv1=true` to configure a KMS v1 provider.
77+
6278
* Your cluster must use etcd v3 or later
6379
-->
6480
* 需要 Kubernetes 1.10.0 或更高版本
81+
* 对于 1.29 及更高版本,KMS 的 v1 实现默认处于禁用状态。
82+
要启用此特性,设置 `--feature-gates=KMSv1=true` 以配置 KMS v1 驱动。
6583
* 你的集群必须使用 etcd v3 或更高版本
6684

6785
### KMS v2
6886

69-
{{< feature-state for_k8s_version="v1.27" state="beta" >}}
87+
{{< feature-state for_k8s_version="v1.29" state="stable" >}}
7088

7189
<!--
72-
* For version 1.25 and 1.26, enabling the feature via kube-apiserver feature gate is required.
73-
Set `--feature-gates=KMSv2=true` to configure a KMS v2 provider.
74-
For environments where all API servers are running version 1.28 or later, and you do not require the ability
75-
to downgrade to Kubernetes v1.27, you can enable the `KMSv2KDF` feature gate (a beta feature) for more
76-
robust data encryption key generation. The Kubernetes project recommends enabling KMS v2 KDF if those
77-
preconditions are met.
78-
7990
* Your cluster must use etcd v3 or later
8091
-->
81-
* 对于 Kubernetes 1.25 和 1.26 版本,需要通过 kube-apiserver 特性门控启用此特性。
82-
设置 `--feature-gates=KMSv2=true` 以配置 KMS v2 驱动。
83-
对于所有 API 服务器正在运行 1.28 或更高的版本并且你不需要降级到 Kubernetes v1.27 的环境,
84-
你可以启用 `KMSv2KDF` 特性门控(Beta 特性)以生成更稳健的数据加密密钥。
85-
如果这些前提条件均已满足,则 Kubernetes 项目建议启用 KMS v2
86-
密钥派生函数(Key Derivation Function, KDF)。
87-
88-
* 你的集群必须使用 etcd v3 或更高版本。
89-
90-
{{< caution >}}
91-
<!--
92-
The KMS v2 API and implementation changed in incompatible ways in-between the alpha release in v1.25
93-
and the beta release in v1.27. Attempting to upgrade from old versions with the alpha feature
94-
enabled will result in data loss.
95-
-->
96-
KMS v2 API 和实现在 v1.25 的 Alpha 版本和 v1.27 的 Beta 版本之间以不兼容的方式进行了更改。
97-
如果尝试从启用了 Alpha 特性的旧版本进行升级将导致数据丢失。
92+
* 你的集群必须使用 etcd v3 或更高版本
9893

99-
---
94+
<!-- steps -->
10095

10196
<!--
102-
Running mixed API server versions with some servers at v1.27, and others at v1.28 _with the
103-
`KMSv2KDF` feature gate enabled_ is **not supported** - and is likely to result in data loss.
97+
## KMS encryption and per-object encryption keys
10498
-->
105-
不支持在启用 `KMSv2KDF` 特性门控的情况下运行一些服务器为 v1.27 而另一些服务器为 v1.28 的混合 API 服务器版本,
106-
这可能导致数据丢失。
107-
{{< /caution >}}
108-
109-
<!-- steps -->
99+
### KMS 加密和为每个对象加密的密钥 {#kms-encryption-and-perobject-encryption-keys}
110100

111101
<!--
112102
The KMS encryption provider uses an envelope encryption scheme to encrypt data in etcd.
113103
The data is encrypted using a data encryption key (DEK).
114104
The DEKs are encrypted with a key encryption key (KEK) that is stored and managed in a remote KMS.
115105
116-
With KMS v1, a new DEK is generated for each encryption.
106+
If you use the (deprecated) v1 implementation of KMS, a new DEK is generated for each encryption.
117107
-->
118108
KMS 加密驱动使用封套加密模型来加密 etcd 中的数据。数据使用数据加密密钥(DEK)加密。
119109
这些 DEK 经一个密钥加密密钥(KEK)加密后在一个远端的 KMS 中存储和管理。
120110

121-
对于 KMS v1,每次加密将生成新的 DEK。
111+
如果你使用(已弃用的)KMS v1 实现,每次加密将生成新的 DEK。
122112

123113
<!--
124-
With KMS v2, there are two ways for the API server to generate a DEK.
125-
Kubernetes defaults to generating a new DEK at API server startup, which is then reused
126-
for resource encryption. However, if you use KMS v2 _and_ enable the `KMSv2KDF`
127-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/), then
128-
Kubernetes instead generates a new DEK **per encryption**: the API server uses a
114+
With KMS v2, a new DEK is generated **per encryption**: the API server uses a
129115
_key derivation function_ to generate single use data encryption keys from a secret seed
130116
combined with some random data.
131-
Whichever approach you configure, the DEK or seed is also rotated whenever the KEK is rotated
132-
(see `Understanding key_id and Key Rotation` section below for more details).
133-
-->
134-
对于 KMS v2,API 服务器生成 DEK 有两种方式。
135-
Kubernetes 默认在 API 服务器启动时生成一个新的 DEK(数据加密密钥),
136-
然后重复使用该密钥进行资源加密。然而,如果你使用 KMS v2 并且启用了 `KMSv2KDF`
137-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
138-
则 Kubernetes 将转为为每次加密生成一个新的 DEK:API 服务器使用**密钥派生函数**根据
139-
秘密的种子数结合一些随机数据生成一次性的数据加密密钥。
140-
无论你配置哪种方法,DEK 或种子也会在 KEK 轮换时进行轮换
117+
The seed is rotated whenever the KEK is rotated
118+
(see the _Understanding key_id and Key Rotation_ section below for more details).
119+
-->
120+
对于 KMS v2,**每次加密**将生成新的 DEK:
121+
API 服务器使用**密钥派生函数**根据秘密的种子数结合一些随机数据生成一次性的数据加密密钥。
122+
种子会在 KEK 轮换时进行轮换
141123
(有关更多详细信息,请参阅下面的“了解 key_id 和密钥轮换”章节)。
142124

143125
<!--
@@ -148,54 +130,6 @@ as the Kubernetes control plane, is responsible for all communication with the r
148130
KMS 驱动使用 gRPC 通过 UNIX 域套接字与一个特定的 KMS 插件通信。
149131
这个 KMS 插件作为一个 gRPC 服务器被部署在 Kubernetes 控制平面的相同主机上,负责与远端 KMS 的通信。
150132

151-
{{< caution >}}
152-
<!--
153-
If you are running virtual machine (VM) based nodes that leverage VM state store with this feature,
154-
using KMS v2 is **insecure** and an information security risk unless you also explicitly enable
155-
the `KMSv2KDF`
156-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/).
157-
158-
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.
159-
The following issues could occur if the VM is saved and restored:
160-
-->
161-
如果你正在运行基于虚机的节点并使用虚机状态存储支持本特性,则使用 KMS v2 是**不安全的**
162-
且存在信息安全风险,除非你还显式启用了 `KMSv2KDF`
163-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
164-
165-
使用 KMS v2 时,API 服务器使用带有 12 字节随机数(8 字节原子计数器和 4 字节随机数据)
166-
的 AES-GCM 进行加密。如果保存并恢复虚机,则可能会出现以下问题:
167-
168-
<!--
169-
1. The counter value may be lost or corrupted if the VM is saved in an inconsistent state or restored improperly.
170-
This can lead to a situation where the same counter value is used twice, resulting in the same nonce being used
171-
for two different messages.
172-
2. If the VM is restored to a previous state, the counter value may be set back to its previous value,
173-
resulting in the same nonce being used again.
174-
-->
175-
1. 如果虚机在不一致的状态下保存或恢复不当,则可能会丢失或损坏计数器值。
176-
这可能导致相同的计数器值被用了两次,从而造成两个不同的消息使用相同的随机数。
177-
2. 如果将虚机还原到先前的状态,则计数器值可能会被设置回其先前的值,导致再次使用相同的随机数。
178-
179-
<!--
180-
Although both of these cases are partially mitigated by the 4 byte random nonce, this can compromise
181-
the security of the encryption.
182-
-->
183-
尽管这两种情况都通过 4 字节随机数进行了部分缓解,但这可能会损害加密的安全性。
184-
185-
<!--
186-
If you have enabled the `KMSv2KDF`
187-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) _and_ are using KMS v2
188-
(not KMS v1), the API server generates single use data encryption keys from a secret seed.
189-
This eliminates the need for a counter based nonce while avoiding nonce collision concerns.
190-
It also removes any specific concerns with using KMS v2 and VM state store.
191-
-->
192-
如果你已启用了 `KMSv2KDF`
193-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
194-
并且正在使用 KMS v2(而不是 KMS v1),API 服务器会根据秘密的种子数生成一次性的数据加密密钥。
195-
这就不再需要使用基于计数器的随机数 (nonce),同时避免了随机数冲突问题。
196-
这样还消除了使用 KMS v2 和虚机状态存储的特定问题。
197-
{{< /caution >}}
198-
199133
<!--
200134
## Configuring the KMS provider
201135
@@ -372,15 +306,22 @@ Then use the functions and data structures in the stub file to develop the serve
372306
##### KMS v2 {#developing-a-kms-plugin-gRPC-server-notes-kms-v2}
373307

374308
<!--
375-
* KMS plugin version: `v2beta1`
309+
* KMS plugin version: `v2`
376310
377-
In response to procedure call `Status`, a compatible KMS plugin should return `v2beta1` as `StatusResponse.version`,
311+
In response to the `Status` remote procedure call, a compatible KMS plugin should return its KMS compatibility
312+
version as `StatusResponse.version`. That status response should also include
378313
"ok" as `StatusResponse.healthz` and a `key_id` (remote KMS KEK ID) as `StatusResponse.key_id`.
314+
The Kubernetes project recommends you make your plugin
315+
compatible with the stable `v2` KMS API. Kubernetes {{< skew currentVersion >}} also supports the
316+
`v2beta1` API for KMS; future Kubernetes releases are likely to continue supporting that beta version.
379317
-->
380-
* KMS 插件版本:`v2beta1`
318+
* KMS 插件版本:`v2`
381319

382-
作为对过程调用 `Status` 的响应,兼容的 KMS 插件应把 `v2beta1` 作为 `StatusResponse.Version` 版本、
383-
“ok” 作为 `StatusResponse.healthz` 并且 `key_id`(远程 KMS KEK ID)作为 `StatusResponse.key_id` 返回。
320+
作为对过程调用 `Status` 的响应,兼容的 KMS 插件应把 `StatusResponse.version` 作为其 KMS 兼容版本返回。
321+
该状态响应还应包括 "ok" 作为 `StatusResponse.healthz` 以及 `key_id`(远程 KMS KEK ID)作为
322+
`StatusResponse.key_id`。Kubernetes 项目建议你的插件与稳定的 `v2` KMS API 兼容。
323+
Kubernetes {{< skew currentVersion >}} 针对 KMS 还支持 `v2beta1` API;
324+
Kubernetes 后续版本可能会继续支持该 Beta 版本。
384325

385326
<!--
386327
The API server polls the `Status` procedure call approximately every minute when everything is healthy,
@@ -497,7 +438,7 @@ Then use the functions and data structures in the stub file to develop the serve
497438

498439
{{< caution >}}
499440
<!--
500-
Because you don't control the number of writes performed with the DEK,
441+
Because you don't control the number of writes performed with the DEK,
501442
the Kubernetes project recommends rotating the KEK at least every 90 days.
502443
-->
503444
因为你未控制使用 DEK 执行的写入次数,所以 Kubernetes 项目建议至少每 90 天轮换一次 KEK。
@@ -506,14 +447,14 @@ Then use the functions and data structures in the stub file to develop the serve
506447
<!--
507448
* protocol: UNIX domain socket (`unix`)
508449
509-
The plugin is implemented as a gRPC server that listens at UNIX domain socket.
510-
The plugin deployment should create a file on the file system to run the gRPC unix domain socket connection.
511-
The API server (gRPC client) is configured with the KMS provider (gRPC server) unix
512-
domain socket endpoint in order to communicate with it.
513-
An abstract Linux socket may be used by starting the endpoint with `/@`, i.e. `unix:///@foo`.
514-
Care must be taken when using this type of socket as they do not have concept of ACL
515-
(unlike traditional file based sockets).
516-
However, they are subject to Linux networking namespace, so will only be accessible to
450+
The plugin is implemented as a gRPC server that listens at UNIX domain socket.
451+
The plugin deployment should create a file on the file system to run the gRPC unix domain socket connection.
452+
The API server (gRPC client) is configured with the KMS provider (gRPC server) unix
453+
domain socket endpoint in order to communicate with it.
454+
An abstract Linux socket may be used by starting the endpoint with `/@`, i.e. `unix:///@foo`.
455+
Care must be taken when using this type of socket as they do not have concept of ACL
456+
(unlike traditional file based sockets).
457+
However, they are subject to Linux networking namespace, so will only be accessible to
517458
containers within the same pod unless host networking is used.
518459
-->
519460
* 协议:UNIX 域套接字 (`unix`)
@@ -668,16 +609,6 @@ These healthcheck endpoint paths are hard coded and generated/controlled by the
668609
这些健康检查端点路径是由服务器硬编码、生成并控制的。
669610
`Individual Healthchecks` 的索引序号对应于 KMS 加密配置被处理的顺序。
670611

671-
<!--
672-
At a high level, restarting an API server when a KMS plugin is unhealthy is unlikely to make the situation better.
673-
It can make the situation significantly worse by throwing away the API server's DEK cache. Thus the general
674-
recommendation is to ignore the API server KMS healthz checks for liveness purposes, i.e. `/livez?exclude=kms-providers`.
675-
-->
676-
一般而言,在 KMS 插件出现故障时重新启动 API 服务器并不太可能改善情况。
677-
这样做会由于丢弃 API 服务器的 DEK 缓存使情况显著恶化。因此,
678-
一般建议忽略出于存活性探测的目的而对 API 服务器 KMS 的健康检查,
679-
即 `/livez?exclude=kms-providers`。
680-
681612
<!--
682613
Until the steps defined in [Ensuring all secrets are encrypted](#ensuring-all-secrets-are-encrypted) are performed,
683614
the `providers` list should end with the `identity: {}` provider to allow unencrypted data to be read.

0 commit comments

Comments
 (0)