Skip to content

Commit f6e9613

Browse files
authored
Merge pull request #44930 from windsonsea/encdata
[zh] Sync encrypt-data.md
2 parents 2943412 + 30e4553 commit f6e9613

File tree

1 file changed

+146
-33
lines changed

1 file changed

+146
-33
lines changed

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

Lines changed: 146 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,45 @@ to either:
8585
<!-- steps -->
8686

8787
<!--
88-
## Configuration and determining whether encryption at rest is already enabled
88+
## Determine whether encryption at rest is already enabled {#determining-whether-encryption-at-rest-is-already-enabled}
8989
90-
The `kube-apiserver` process accepts an argument `--encryption-provider-config`
91-
that controls how API data is encrypted in etcd.
92-
The configuration is provided as an API named
93-
[`EncryptionConfiguration`](/docs/reference/config-api/apiserver-encryption.v1/). An example configuration is provided below.
90+
By default, the API server stores plain-text representations of resources into etcd, with
91+
no at-rest encryption.
9492
-->
95-
## 配置并确定是否已启用静态数据加密 {#configuration-and-determing-wheter-encryption-at-rest-is-already-enabled}
93+
## 确定是否已启用静态数据加密 {#determining-whether-encryption-at-rest-is-already-enabled}
94+
95+
默认情况下,API 服务器将资源的明文表示存储在 etcd 中,没有静态加密。
9696

97-
`kube-apiserver` 的参数 `--encryption-provider-config` 控制 API 数据在 etcd 中的加密方式。
98-
该配置作为一个名为 [`EncryptionConfiguration`](/zh-cn/docs/reference/config-api/apiserver-encryption.v1/)
99-
的 API 提供。下面提供了一个示例配置。
97+
<!--
98+
The `kube-apiserver` process accepts an argument `--encryption-provider-config`
99+
that specifies a path to a configuration file. The contents of that file, if you specify one,
100+
control how Kubernetes API data is encrypted in etcd.
101+
If you are running the kube-apiserver without the `--encryption-provider-config` command line
102+
argument, you do not have encryption at rest enabled. If you are running the kube-apiserver
103+
with the `--encryption-provider-config` command line argument, and the file that it references
104+
specifies the `identity` provider as the first encryption provider in the list, then you
105+
do not have at-rest encryption enabled
106+
(**the default `identity` provider does not provide any confidentiality protection.**)
107+
-->
108+
`kube-apiserver` 进程使用 `--encryption-provider-config` 参数指定配置文件的路径,
109+
所指定的配置文件的内容将控制 Kubernetes API 数据在 etcd 中的加密方式。
110+
如果你在运行 kube-apiserver 时没有使用 `--encryption-provider-config` 命令行参数,
111+
则你未启用静态加密。如果你在运行 kube-apiserver 时使用了 `--encryption-provider-config`
112+
命令行参数,并且此参数所引用的文件指定 `identity` 提供程序作为加密提供程序列表中的第一个,
113+
则你未启用静态加密(**默认的 `identity` 提供程序不提供任何机密性保护**)。
114+
115+
<!--
116+
If you are running the kube-apiserver
117+
with the `--encryption-provider-config` command line argument, and the file that it references
118+
specifies a provider other than `identity` as the first encryption provider in the list, then
119+
you already have at-rest encryption enabled. However, that check does not tell you whether
120+
a previous migration to encrypted storage has succeeded. If you are not sure, see
121+
[ensure all relevant data are encrypted](#ensure-all-secrets-are-encrypted).
122+
-->
123+
如果你在运行 kube-apiserver 时使用了 `--encryption-provider-config` 命令行参数,
124+
并且此参数所引用的文件指定一个不是 `identity` 的提供程序作为加密提供程序列表中的第一个,
125+
则你已启用静态加密。然而此项检查并未告知你先前向加密存储的迁移是否成功。如果你不确定,
126+
请参阅[确保所有相关数据都已加密](#ensure-all-secrets-are-encrypted)
100127

101128
{{< caution >}}
102129
<!--
@@ -113,20 +140,65 @@ decrypt data stored in the etcd.
113140
-->
114141
## 理解静态数据加密 {#understanding-the-encryption-at-rest-configuration}
115142

143+
<!-- note to localizers: the highlight is to make the initial comment obvious -->
144+
<!-- you can use as many lines as makes sense for your target localization -->
145+
116146
<!--
147+
{{< highlight yaml "linenos=false,hl_lines=2-5" >}}
148+
---
149+
#
117150
# CAUTION: this is an example configuration.
118151
# Do not use this for your own cluster!
119-
# This configuration does not provide data confidentiality. The first
120-
# configured provider is specifying the "identity" mechanism, which
121-
# stores resources as plain text.
122-
# plain text, in other words NO encryption
123-
# do not encrypt Events even though *.* is specified below
124-
# wildcard match requires Kubernetes 1.27 or later
125-
# wildcard match requires Kubernetes 1.27 or later
152+
#
153+
apiVersion: apiserver.config.k8s.io/v1
154+
kind: EncryptionConfiguration
155+
resources:
156+
- resources:
157+
- secrets
158+
- configmaps
159+
- pandas.awesome.bears.example # a custom resource API
160+
providers:
161+
# This configuration does not provide data confidentiality. The first
162+
# configured provider is specifying the "identity" mechanism, which
163+
# stores resources as plain text.
164+
#
165+
- identity: {} # plain text, in other words NO encryption
166+
- aesgcm:
167+
keys:
168+
- name: key1
169+
secret: c2VjcmV0IGlzIHNlY3VyZQ==
170+
- name: key2
171+
secret: dGhpcyBpcyBwYXNzd29yZA==
172+
- aescbc:
173+
keys:
174+
- name: key1
175+
secret: c2VjcmV0IGlzIHNlY3VyZQ==
176+
- name: key2
177+
secret: dGhpcyBpcyBwYXNzd29yZA==
178+
- secretbox:
179+
keys:
180+
- name: key1
181+
secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=
182+
- resources:
183+
- events
184+
providers:
185+
- identity: {} # do not encrypt Events even though *.* is specified below
186+
- resources:
187+
- '*.apps' # wildcard match requires Kubernetes 1.27 or later
188+
providers:
189+
- aescbc:
190+
keys:
191+
- name: key2
192+
secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==
193+
- resources:
194+
- '*.*' # wildcard match requires Kubernetes 1.27 or later
195+
providers:
196+
- aescbc:
197+
keys:
198+
- name: key3
199+
secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==
200+
{{< /highlight >}}
126201
-->
127-
<!-- note to localizers: the highlight is to make the initial comment obvious -->
128-
<!-- you can use as many lines as makes sense for your target localization -->
129-
130202
{{< highlight yaml "linenos=false,hl_lines=2-5" >}}
131203
---
132204
#
@@ -549,7 +621,7 @@ The following steps assume that you are not using KMS, and therefore the steps a
549621
assume that you need to generate an encryption key. If you already have an encryption key,
550622
skip to [Write an encryption configuration file](#write-an-encryption-configuration-file).
551623
-->
552-
以下步骤假设你没有使用 KMS,因此这些步骤还假设您需要生成加密密钥
624+
以下步骤假设你没有使用 KMS,因此这些步骤还假设你需要生成加密密钥
553625
如果你已有加密密钥,请跳至[编写加密配置文件](#write-an-encryption-configuration-file)。
554626

555627
{{< caution >}}
@@ -654,7 +726,7 @@ so that you're relying on KMS encryption.
654726
使用安全的文件传输机制,将该加密密钥的副本提供给所有其他控制平面主机。
655727

656728
至少,使用传输加密 - 例如,安全 shell(SSH)。为了提高安全性,
657-
请在主机之间使用非对称加密,或更改您正在使用的方法,以便依赖 KMS 加密。
729+
请在主机之间使用非对称加密,或更改你正在使用的方法,以便依赖 KMS 加密。
658730

659731
<!--
660732
## Write an encryption configuration file
@@ -679,9 +751,24 @@ Create a new encryption configuration file. The contents should be similar to:
679751
创建一个新的加密配置文件。其内容应类似于:
680752

681753
<!--
682-
# See the following text for more details about the secret value
683-
# this fallback allows reading unencrypted secrets;
684-
# for example, during initial migration
754+
```yaml
755+
---
756+
apiVersion: apiserver.config.k8s.io/v1
757+
kind: EncryptionConfiguration
758+
resources:
759+
- resources:
760+
- secrets
761+
- configmaps
762+
- pandas.awesome.bears.example
763+
providers:
764+
- aescbc:
765+
keys:
766+
- name: key1
767+
# See the following text for more details about the secret value
768+
secret: <BASE 64 ENCODED SECRET>
769+
- identity: {} # this fallback allows reading unencrypted secrets;
770+
# for example, during initial migration
771+
```
685772
-->
686773
```yaml
687774
---
@@ -980,7 +1067,6 @@ When you have configured encryption at rest for an API (for example: the API kin
9801067
that all those resources in this cluster really are encrypted at rest. Check this before
9811068
you carry on with the next steps.
9821069
-->
983-
9841070
此更改可防止 API 服务器检索标记为静态加密但实际上以明文形式存储的资源。
9851071

9861072
当你为某个 API 配置静态加密时(例如:API 种类 `Secret`,代表核心 API 组中的 `secrets` 资源),
@@ -995,7 +1081,20 @@ part of the encryption configuration. For example:
9951081
一旦集群中的所有 Secret 都被加密,你就可以删除加密配置中的 `identity` 部分。例如:
9961082

9971083
<!--
998-
# REMOVE THIS LINE
1084+
{{< highlight yaml "linenos=false,hl_lines=12" >}}
1085+
---
1086+
apiVersion: apiserver.config.k8s.io/v1
1087+
kind: EncryptionConfiguration
1088+
resources:
1089+
- resources:
1090+
- secrets
1091+
providers:
1092+
- aescbc:
1093+
keys:
1094+
- name: key1
1095+
secret: <BASE 64 ENCODED SECRET>
1096+
- identity: {} # REMOVE THIS LINE
1097+
{{< /highlight >}}
9991098
-->
10001099
{{< highlight yaml "linenos=false,hl_lines=12" >}}
10011100
---
@@ -1019,7 +1118,7 @@ from accessing a plain-text Secret, even by accident.
10191118
…然后依次重新启动每个 API 服务器。此更改可防止 API 服务器访问纯文本 Secret,即使是意外访问也是如此。
10201119

10211120
<!--
1022-
## Rotating a decryption key
1121+
## Rotate a decryption key {#rotating-a-decryption-key}
10231122
10241123
Changing an encryption key for Kubernetes without incurring downtime requires a multi-step operation,
10251124
especially in the presence of a highly-available deployment where multiple `kube-apiserver` processes
@@ -1033,8 +1132,8 @@ are running.
10331132
need to delete all the resources were encrypted under the lost key, and workloads may not
10341133
operate as expected during the time that at-rest encryption is broken.
10351134
1. Make the new key the first entry in the `keys` array so that it is used for encryption-at-rest
1036-
for new config
1037-
1. Restart all `kube-apiserver` processes to ensure each control plane host now encrypts using the new key
1135+
for new writes
1136+
1. Restart all `kube-apiserver` processes to ensure each control plane host now encrypts using the new key
10381137
1. As a privileged user, run `kubectl get secrets --all-namespaces -o json | kubectl replace -f -`
10391138
to encrypt all existing Secrets with the new key
10401139
1. After you have updated all existing Secrets to use the new key and have made a secure backup of the
@@ -1049,7 +1148,7 @@ are running.
10491148
1. 重新启动所有 `kube-apiserver` 进程以确保每台服务器都可以使用新密钥加密任何数据
10501149
1. 对新的加密密钥进行安全备份。如果你丢失了此密钥的所有副本,则需要删除用已丢失的密钥加密的所有资源,
10511150
并且在静态加密被破坏期间,工作负载可能无法按预期运行。
1052-
1. 将新密钥设置为 `keys` 数组中的第一个条目,以便将其用于新配置的静态加密
1151+
1. 将新密钥设置为 `keys` 数组中的第一个条目,以便将其用于新编写的静态加密
10531152
1. 重新启动所有 `kube-apiserver` 进程,以确保每个控制平面主机现在使用新密钥进行加密
10541153
1. 作为特权用户,运行 `kubectl get secrets --all-namespaces -o json | kubectl replace -f -`
10551154
以用新密钥加密所有现有的 Secret
@@ -1071,9 +1170,23 @@ entry in your encryption configuration file:
10711170
要禁用静态加密,请将 `identity` 提供程序作为加密配置文件中的第一个条目:
10721171

10731172
<!--
1074-
# list any other resources here that you previously were encrypting at rest
1075-
# add this line
1076-
# keep this in place make sure it comes after "identity"
1173+
```yaml
1174+
---
1175+
apiVersion: apiserver.config.k8s.io/v1
1176+
kind: EncryptionConfiguration
1177+
resources:
1178+
- resources:
1179+
- secrets
1180+
# list any other resources here that you previously were
1181+
# encrypting at rest
1182+
providers:
1183+
- identity: {} # add this line
1184+
- aescbc:
1185+
keys:
1186+
- name: key1
1187+
secret: <BASE 64 ENCODED SECRET> # keep this in place
1188+
# make sure it comes after "identity"
1189+
```
10771190
-->
10781191
```yaml
10791192
---

0 commit comments

Comments
 (0)