Skip to content

Commit deb3a8b

Browse files
committed
[zh] sync encrypt-data.md
1 parent a8c3b3f commit deb3a8b

File tree

1 file changed

+98
-33
lines changed

1 file changed

+98
-33
lines changed

content/zh-cn/docs/tasks/administer-cluster/encrypt-data.md

Lines changed: 98 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ encrypt Secret objects, including the key-value data they contain.
3939
此任务涵盖使用 {{< glossary_tooltip text="Kubernetes API" term_id="kubernetes-api" >}}
4040
存储的资源数据的加密。
4141
例如,你可以加密 Secret 对象,包括它们包含的键值数据。
42+
4243
<!--
4344
If you want to encrypt data in filesystems that are mounted into containers, you instead need
4445
to either:
@@ -274,7 +275,7 @@ read that resource will fail until it is deleted or a valid decryption key is pr
274275
任何尝试读取资源的调用将会失败,直到它被删除或提供有效的解密密钥。
275276
{{< /caution >}}
276277

277-
### Providers
278+
### Provider
278279

279280
<!--
280281
The following table describes each available provider:
@@ -283,7 +284,9 @@ The following table describes each available provider:
283284

284285
<table class="complex-layout">
285286
<caption style="display: none;">
286-
<!-- Providers for Kubernetes encryption at rest -->
287+
<!--
288+
Providers for Kubernetes encryption at rest
289+
-->
287290
Kubernetes 静态数据加密的 Provider
288291
</caption>
289292
<thead>
@@ -306,8 +309,10 @@ Kubernetes 静态数据加密的 Provider
306309
</tr>
307310
<tr>
308311
<td colspan="4">
309-
<!-- Resources written as-is without encryption. When set as the first provider, the resource will be decrypted as new values are written. Existing encrypted resources are <strong>not</strong> automatically overwritten with the plaintext data.
310-
The <tt>identity</tt> provider is the default if you do not specify otherwise. -->
312+
<!--
313+
Resources written as-is without encryption. When set as the first provider, the resource will be decrypted as new values are written. Existing encrypted resources are <strong>not</strong> automatically overwritten with the plaintext data.
314+
The <tt>identity</tt> provider is the default if you do not specify otherwise.
315+
-->
311316
不加密写入的资源。当设置为第一个 provider 时,已加密的资源将在新值写入时被解密。
312317
</td>
313318
</tr>
@@ -316,7 +321,9 @@ Kubernetes 静态数据加密的 Provider
316321
<tr>
317322
<th rowspan="2" scope="row"><tt>aescbc</tt></th>
318323
<td>
319-
<!-- AES-CBC with <a href="https://datatracker.ietf.org/doc/html/rfc2315">PKCS#7</a> padding -->
324+
<!--
325+
AES-CBC with <a href="https://datatracker.ietf.org/doc/html/rfc2315">PKCS#7</a> padding
326+
-->
320327
带有 <a href="https://datatracker.ietf.org/doc/html/rfc2315">PKCS#7</a> 填充的 AES-CBC
321328
</td>
322329
<td><!-- Weak -->弱</td>
@@ -325,33 +332,43 @@ Kubernetes 静态数据加密的 Provider
325332
</tr>
326333
<tr>
327334
<td colspan="4">
328-
<!-- Not recommended due to CBC's vulnerability to padding oracle attacks. Key material accessible from control plane host. -->
335+
<!--
336+
Not recommended due to CBC's vulnerability to padding oracle attacks. Key material accessible from control plane host.
337+
-->
329338
由于 CBC 容易受到密文填塞攻击(Padding Oracle Attack),不推荐使用。密钥材料可从控制面主机访问。
330339
</td>
331340
</tr>
332341
<tr>
333342
<th rowspan="2" scope="row"><tt>aesgcm</tt></th>
334343
<td>
335-
<!-- AES-GCM with random nonce -->
344+
<!--
345+
AES-GCM with random nonce
346+
-->
336347
带有随机数的 AES-GCM
337348
</td>
338349
<td>
339-
<!-- Must be rotated every 200,000 writes -->
350+
<!--
351+
Must be rotated every 200,000 writes
352+
-->
340353
每写入 200k 次后必须轮换
341354
</td>
342355
<td><!-- Fastest -->最快</td>
343356
<td><!-- 16, 24, or 32-byte -->16、24 或者 32 字节</td>
344357
</tr>
345358
<tr>
346359
<td colspan="4">
347-
<!-- Not recommended for use except when an automated key rotation scheme is implemented. Key material accessible from control plane host. -->
360+
<!--
361+
Not recommended for use except when an automated key rotation scheme is implemented. Key material accessible from control plane host.
362+
-->
348363
不建议使用,除非实施了自动密钥轮换方案。密钥材料可从控制面主机访问。
349364
</td>
350365
</tr>
351366
<tr>
352367
<th rowspan="2" scope="row"><tt>kms</tt> v1 <em><!--(deprecated since Kubernetes v1.28)-->(自 Kubernetes 1.28 起弃用)</em></th>
353368
<td>
354-
<!-- Uses envelope encryption scheme with DEK per resource. -->
369+
<!--
370+
Uses envelope encryption scheme with DEK per resource.
371+
-->
355372
针对每个资源使用不同的 DEK 来完成信封加密。
356373
</td>
357374
<td><!-- Strongest -->最强</td>
@@ -380,7 +397,9 @@ Kubernetes 静态数据加密的 Provider
380397
<tr>
381398
<th rowspan="2" scope="row"><tt>kms</tt> v2 <em>(beta)</em></th>
382399
<td>
383-
<!-- Uses envelope encryption scheme with DEK per API server. -->
400+
<!--
401+
Uses envelope encryption scheme with DEK per API server.
402+
-->
384403
针对每个 API 服务器使用不同的 DEK 来完成信封加密。
385404
</td>
386405
<td><!-- Strongest -->最强</td>
@@ -440,7 +459,7 @@ Kubernetes 静态数据加密的 Provider
440459
Each provider supports multiple keys - the keys are tried in order for decryption, and if the provider
441460
is the first provider, the first key is used for encryption.
442461
-->
443-
每个 provider 都支持多个密钥 - 在解密时会按顺序使用密钥,如果是第一个 provider,则第一个密钥用于加密。
462+
每个 Provider 都支持多个密钥 - 在解密时会按顺序使用密钥,如果是第一个 Provider,则第一个密钥用于加密。
444463

445464
{{< caution >}}
446465
<!--
@@ -574,7 +593,7 @@ To create a new Secret, perform the following steps:
574593
...
575594
- name: enc # 增加这一行
576595
mountPath: /etc/kubernetes/enc # 增加这一行
577-
readonly: true # 增加这一行
596+
readOnly: true # 增加这一行
578597
...
579598
volumes:
580599
...
@@ -600,31 +619,54 @@ permissions on your control-plane nodes so only the user who runs the `kube-apis
600619
{{< /caution >}}
601620

602621
<!--
603-
## Verifying that data is encrypted
622+
### Reconfigure other control plane hosts {#api-server-config-update-more}
604623

605-
Data is encrypted when written to etcd. After restarting your `kube-apiserver`, any newly created or
606-
updated Secret or other resource types configured in `EncryptionConfiguration` should be encrypted
607-
when stored. To check this, you can use the `etcdctl` command line
624+
If you have multiple API servers in your cluster, you should deploy the
625+
changes in turn to each API server.
626+
627+
Make sure that you use the **same** encryption configuration on each
628+
control plane host.
629+
-->
630+
### 重新配置其他控制平面主机 {#api-server-config-update-more}
631+
632+
如果你的集群中有多个 API 服务器,应轮流将更改部署到每个 API 服务器。
633+
634+
确保在每个控制平面主机上使用**相同的**加密配置。
635+
636+
<!--
637+
### Verify that newly written data is encrypted {#verifying-that-data-is-encrypted}
638+
639+
Data is encrypted when written to etcd. After restarting your `kube-apiserver`, any newly
640+
created or updated Secret (or other resource kinds configured in `EncryptionConfiguration`)
641+
should be encrypted when stored.
642+
643+
To check this, you can use the `etcdctl` command line
608644
program to retrieve the contents of your secret data.
609645

610-
1. Create a new Secret called `secret1` in the `default` namespace:
646+
This example shows how to check this for encrypting the Secret API.
611647
-->
612-
## 验证数据已被加密 {#verifying-that-data-is-encryped}
648+
### 验证数据已被加密 {#verifying-that-data-is-encryped}
613649

614650
数据在写入 etcd 时会被加密。重新启动你的 `kube-apiserver` 后,任何新创建或更新的 Secret
615-
或在 `EncryptionConfiguration` 中配置的其他资源类型都应在存储时被加密。
651+
或在 `EncryptionConfiguration` 中配置的其他资源类别都应在存储时被加密。
652+
616653
如果想要检查,你可以使用 `etcdctl` 命令行程序来检索你的 Secret 数据内容。
617654

618-
1. 创建一个新的 secret,名称为 `secret1`,命名空间为 `default`:
655+
以下示例演示了如何对加密 Secret API 进行检查。
656+
657+
<!--
658+
1. Create a new Secret called `secret1` in the `default` namespace:
659+
-->
660+
1. 创建一个新的 Secret,名称为 `secret1`,命名空间为 `default`:
619661

620662
```shell
621663
kubectl create secret generic secret1 -n default --from-literal=mykey=mydata
622664
```
623665

624666
<!--
625-
1. Using the `etcdctl` command line, read that Secret out of etcd:
667+
1. Using the `etcdctl` command line tool, read that Secret out of etcd:
626668
-->
627-
2. 使用 `etcdctl` 命令行,从 etcd 中读取 Secret:
669+
2. 使用 `etcdctl` 命令行工具,从 etcd 中读取 Secret:
628670

629671
```
630672
ETCDCTL_API=3 etcdctl get /registry/secrets/default/secret1 [...] | hexdump -C
@@ -686,38 +728,61 @@ program to retrieve the contents of your secret data.
686728
```
687729

688730
<!--
689-
The output should contain `mykey: bXlkYXRh`, with contents of `mydata` encoded, check
731+
The output should contain `mykey: bXlkYXRh`, with contents of `mydata` encoded using base64;
732+
read
690733
[decoding a Secret](/docs/tasks/configmap-secret/managing-secret-using-kubectl/#decoding-secret)
691-
to completely decode the Secret.
734+
to learn how to completely decode the Secret.
692735
-->
693-
其输出应该包含 `mykey: bXlkYXRh``mydata` 的内容是被加密过的
736+
其输出应该包含 `mykey: bXlkYXRh`其中 `mydata` 的内容使用 base64 进行加密
694737
请参阅[解密 Secret](/zh-cn/docs/tasks/configmap-secret/managing-secret-using-kubectl/#decoding-secret)
695738
了解如何完全解码 Secret 内容。
696739

697740
<!--
698-
## Ensure all Secrets are encrypted
741+
### Ensure all relevant data are encrypted {#ensure-all-secrets-are-encrypted}
742+
743+
It's often not enough to make sure that new objects get encrypted: you also want that
744+
encryption to apply to the objects that are already stored.
699745
700-
Since Secrets are encrypted on write, performing an update on a Secret will encrypt that content.
746+
For this example, you have configured your cluster so that Secrets are encrypted on write.
747+
Performing a replace operation for each Secret will encrypt that content at rest,
748+
where the objects are unchanged.
749+
750+
You can make this change across all Secrets in your cluster:
701751
-->
702-
## 确保所有 Secret 都被加密 {#ensure-all-secrets-are-encrypted}
752+
### 确保所有相关数据都被加密 {#ensure-all-secrets-are-encrypted}
753+
754+
仅仅确保新对象被加密通常是不够的:你还希望对已经存储的对象进行加密。
703755

704-
由于 Secret 是在写入时被加密,因此对 Secret 执行更新也会加密该内容。
756+
例如,你已经配置了集群,使得 Secret 在写入时进行加密。
757+
为每个 Secret 执行替换操作将加密那些对象保持不变的静态内容。
705758

759+
你可以在集群中的所有 Secret 上进行此项变更:
760+
761+
<!--
762+
# Run this as an administrator that can read and write all Secrets
763+
-->
706764
```shell
765+
# 以能够读写所有 Secret 的管理员身份运行此命令
707766
kubectl get secrets --all-namespaces -o json | kubectl replace -f -
708767
```
709768

710769
<!--
711-
The command above reads all Secrets and then updates them to apply server side encryption.
770+
The command above reads all Secrets and then updates them with the same data, in order to
771+
apply server side encryption.
712772
-->
713-
上面的命令读取所有 Secret,然后使用服务端加密来更新其内容
773+
上面的命令读取所有 Secret,然后使用相同的数据更新这些 Secret,以便应用服务端加密
714774

715775
{{< note >}}
716776
<!--
717777
If an error occurs due to a conflicting write, retry the command.
718-
For larger clusters, you may wish to subdivide the secrets by namespace or script an update.
778+
It is safe to run that command more than once.
779+
780+
For larger clusters, you may wish to subdivide the Secrets by namespace,
781+
or script an update.
719782
-->
720783
如果由于冲突写入而发生错误,请重试该命令。
784+
多次运行此命令是安全的。
785+
721786
对于较大的集群,你可能希望通过命名空间或更新脚本来对 Secret 进行划分。
722787
{{< /note >}}
723788

0 commit comments

Comments
 (0)