@@ -85,18 +85,45 @@ to either:
85
85
<!-- steps -->
86
86
87
87
<!--
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}
89
89
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.
94
92
-->
95
- ## 配置并确定是否已启用静态数据加密 {#configuration-and-determing-wheter-encryption-at-rest-is-already-enabled}
93
+ ## 确定是否已启用静态数据加密 {#determining-whether-encryption-at-rest-is-already-enabled}
94
+
95
+ 默认情况下,API 服务器将资源的明文表示存储在 etcd 中,没有静态加密。
96
96
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 ) 。
100
127
101
128
{{< caution >}}
102
129
<!--
@@ -113,20 +140,65 @@ decrypt data stored in the etcd.
113
140
-->
114
141
## 理解静态数据加密 {#understanding-the-encryption-at-rest-configuration}
115
142
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
+
116
146
<!--
147
+ {{< highlight yaml "linenos=false,hl_lines=2-5" >}}
148
+ ---
149
+ #
117
150
# CAUTION: this is an example configuration.
118
151
# 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 >}}
126
201
-->
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
-
130
202
{{< highlight yaml "linenos=false,hl_lines=2-5" >}}
131
203
---
132
204
#
@@ -549,7 +621,7 @@ The following steps assume that you are not using KMS, and therefore the steps a
549
621
assume that you need to generate an encryption key. If you already have an encryption key,
550
622
skip to [Write an encryption configuration file](#write-an-encryption-configuration-file).
551
623
-->
552
- 以下步骤假设你没有使用 KMS,因此这些步骤还假设您需要生成加密密钥 。
624
+ 以下步骤假设你没有使用 KMS,因此这些步骤还假设你需要生成加密密钥 。
553
625
如果你已有加密密钥,请跳至[编写加密配置文件](#write-an-encryption-configuration-file)。
554
626
555
627
{{< caution >}}
@@ -654,7 +726,7 @@ so that you're relying on KMS encryption.
654
726
使用安全的文件传输机制,将该加密密钥的副本提供给所有其他控制平面主机。
655
727
656
728
至少,使用传输加密 - 例如,安全 shell(SSH)。为了提高安全性,
657
- 请在主机之间使用非对称加密,或更改您正在使用的方法 ,以便依赖 KMS 加密。
729
+ 请在主机之间使用非对称加密,或更改你正在使用的方法 ,以便依赖 KMS 加密。
658
730
659
731
<!--
660
732
# # Write an encryption configuration file
@@ -679,9 +751,24 @@ Create a new encryption configuration file. The contents should be similar to:
679
751
创建一个新的加密配置文件。其内容应类似于:
680
752
681
753
<!--
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
+ ` ` `
685
772
-->
686
773
` ` ` yaml
687
774
---
@@ -980,7 +1067,6 @@ When you have configured encryption at rest for an API (for example: the API kin
980
1067
that all those resources in this cluster really are encrypted at rest. Check this before
981
1068
you carry on with the next steps.
982
1069
-->
983
-
984
1070
此更改可防止 API 服务器检索标记为静态加密但实际上以明文形式存储的资源。
985
1071
986
1072
当你为某个 API 配置静态加密时(例如:API 种类 ` Secret ` ,代表核心 API 组中的 ` secrets ` 资源),
@@ -995,7 +1081,20 @@ part of the encryption configuration. For example:
995
1081
一旦集群中的所有 Secret 都被加密,你就可以删除加密配置中的 ` identity ` 部分。例如:
996
1082
997
1083
<!--
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 >}}
999
1098
-->
1000
1099
{{< highlight yaml "linenos=false,hl_lines=12" >}}
1001
1100
---
@@ -1019,7 +1118,7 @@ from accessing a plain-text Secret, even by accident.
1019
1118
…然后依次重新启动每个 API 服务器。此更改可防止 API 服务器访问纯文本 Secret,即使是意外访问也是如此。
1020
1119
1021
1120
<!--
1022
- ## Rotating a decryption key
1121
+ ## Rotate a decryption key {#rotating-a-decryption-key}
1023
1122
1024
1123
Changing an encryption key for Kubernetes without incurring downtime requires a multi-step operation,
1025
1124
especially in the presence of a highly-available deployment where multiple `kube-apiserver` processes
@@ -1033,8 +1132,8 @@ are running.
1033
1132
need to delete all the resources were encrypted under the lost key, and workloads may not
1034
1133
operate as expected during the time that at-rest encryption is broken.
1035
1134
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
1038
1137
1. As a privileged user, run `kubectl get secrets --all-namespaces -o json | kubectl replace -f -`
1039
1138
to encrypt all existing Secrets with the new key
1040
1139
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.
1049
1148
1 . 重新启动所有 ` kube-apiserver ` 进程以确保每台服务器都可以使用新密钥加密任何数据
1050
1149
1 . 对新的加密密钥进行安全备份。如果你丢失了此密钥的所有副本,则需要删除用已丢失的密钥加密的所有资源,
1051
1150
并且在静态加密被破坏期间,工作负载可能无法按预期运行。
1052
- 1 . 将新密钥设置为 ` keys ` 数组中的第一个条目,以便将其用于新配置的静态加密
1151
+ 1 . 将新密钥设置为 ` keys ` 数组中的第一个条目,以便将其用于新编写的静态加密
1053
1152
1 . 重新启动所有 ` kube-apiserver ` 进程,以确保每个控制平面主机现在使用新密钥进行加密
1054
1153
1 . 作为特权用户,运行 ` kubectl get secrets --all-namespaces -o json | kubectl replace -f - `
1055
1154
以用新密钥加密所有现有的 Secret
@@ -1071,9 +1170,23 @@ entry in your encryption configuration file:
1071
1170
要禁用静态加密,请将 ` identity ` 提供程序作为加密配置文件中的第一个条目:
1072
1171
1073
1172
<!--
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
+ ```
1077
1190
-->
1078
1191
``` yaml
1079
1192
---
0 commit comments