@@ -50,18 +50,18 @@ Secret 是一种包含少量敏感信息例如密码、令牌或密钥的对象
50
50
Kubernetes Secrets are, by default, stored as unencrypted base64-encoded
51
51
strings. By default they can be retrieved - as plain text - by anyone with API
52
52
access, or anyone with access to Kubernetes' underlying data store, etcd. In
53
- order to safely use Secrets, we recommend you (at a minimum):
53
+ order to safely use Secrets, it is recommended you (at a minimum):
54
54
55
- 1. [Enable Encryption at Rest](https://kubernetes.io /docs/tasks/administer-cluster/encrypt-data/) for Secrets.
56
- 2. [Enable RBAC rules that restrict reading and writing the Secret](https://kubernetes.io/ docs/reference/access-authn-authz/authorization/). Be aware that secrets can be obtained implicitly by anyone with the permission to create a Pod.
55
+ 1. [Enable Encryption at Rest](/zh /docs/tasks/administer-cluster/encrypt-data/) for Secrets.
56
+ 2. [Enable or configure RBAC rules](/ docs/reference/access-authn-authz/authorization/) that restrict reading and writing the Secret . Be aware that secrets can be obtained implicitly by anyone with the permission to create a Pod.
57
57
-->
58
58
Kubernetes Secret 默认情况下存储为 base64-编码的、非加密的字符串。
59
59
默认情况下,能够访问 API 的任何人,或者能够访问 Kubernetes 下层数据存储(etcd)
60
60
的任何人都可以以明文形式读取这些数据。
61
61
为了能够安全地使用 Secret,我们建议你(至少):
62
62
63
63
1 . 为 Secret [ 启用静态加密] ( /zh/docs/tasks/administer-cluster/encrypt-data/ ) ;
64
- 2 . [ 启用 RBAC 规则来限制对 Secret 的读写操作 ] ( /zh/docs/reference/access-authn-authz/authorization/ ) 。
64
+ 2 . [ 启用 或配置 RBAC 规则 ] ( /zh/docs/reference/access-authn-authz/authorization/ ) 来限制对 Secret 的读写操作 。
65
65
要注意,任何被允许创建 Pod 的人都默认地具有读取 Secret 的权限。
66
66
{{< /caution >}}
67
67
@@ -193,7 +193,7 @@ empty-secret Opaque 0 2m6s
193
193
194
194
<!--
195
195
The `DATA` column shows the number of data items stored in the Secret.
196
- In this case, `0` means we have just created an empty Secret.
196
+ In this case, `0` means we have created an empty Secret.
197
197
-->
198
198
` DATA ` 列显示 Secret 中保存的数据条目个数。
199
199
在这个例子种,` 0 ` 意味着我们刚刚创建了一个空的 Secret。
@@ -204,7 +204,7 @@ In this case, `0` means we have just created an empty Secret.
204
204
A `kubernetes.io/service-account-token` type of Secret is used to store a
205
205
token that identifies a service account. When using this Secret type, you need
206
206
to ensure that the `kubernetes.io/service-account.name` annotation is set to an
207
- existing service account name. An Kubernetes controller fills in some other
207
+ existing service account name. A Kubernetes controller fills in some other
208
208
fields such as the `kubernetes.io/service-account.uid` annotation and the
209
209
`token` key in the `data` field set to actual token content.
210
210
@@ -1068,8 +1068,8 @@ Kubelet is checking whether the mounted secret is fresh on every periodic sync.
1068
1068
However, it is using its local cache for getting the current value of the Secret.
1069
1069
1070
1070
The type of the cache is configurable using the (`ConfigMapAndSecretChangeDetectionStrategy` field in
1071
- [KubeletConfiguration struct](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/ kubelet/ config/ v1beta1/types.go) ).
1072
- It can be either propagated via watch (default), ttl-based, or simply redirecting
1071
+ the [KubeletConfiguration struct](/docs/reference/config-api/ kubelet- config. v1beta1/).
1072
+ A Secret can be either propagated by watch (default), ttl-based, or by redirecting
1073
1073
all requests to directly kube-apiserver.
1074
1074
As a result, the total delay from the moment when the Secret is updated to the moment
1075
1075
when new keys are projected to the Pod can be as long as kubelet sync period + cache
@@ -1082,7 +1082,7 @@ propagation delay, where cache propagation delay depends on the chosen cache typ
1082
1082
组件 kubelet 在周期性同步时检查被挂载的 Secret 是不是最新的。
1083
1083
但是,它会使用其本地缓存的数值作为 Secret 的当前值。
1084
1084
1085
- 缓存的类型可以使用 [ KubeletConfiguration 结构] (https://github.com/kubernetes/kubernetes/blob/{{ < param "docsbranch" >}}/staging/src/k8s.io/ kubelet/ config/ v1beta1/types.go )
1085
+ 缓存的类型可以使用 [ KubeletConfiguration 结构] ( /zh/docs/reference/config-api/ kubelet- config. v1beta1/)
1086
1086
中的 ` ConfigMapAndSecretChangeDetectionStrategy ` 字段来配置。
1087
1087
它可以通过 watch 操作来传播(默认),基于 TTL 来刷新,也可以
1088
1088
将所有请求直接重定向到 API 服务器。
@@ -1151,7 +1151,7 @@ spec:
1151
1151
<!--
1152
1152
#### Consuming Secret Values from environment variables
1153
1153
1154
- Inside a container that consumes a secret in an environment variables, the secret keys appear as
1154
+ Inside a container that consumes a secret in the environment variables, the secret keys appear as
1155
1155
normal environment variables containing the base64 decoded values of the secret data.
1156
1156
This is the result of commands executed inside the container from the example above:
1157
1157
-->
@@ -1203,10 +1203,10 @@ There are third party solutions for triggering restarts when secrets change.
1203
1203
-->
1204
1204
## 不可更改的 Secret {#secret-immutable}
1205
1205
1206
- {{< feature-state for_k8s_version="v1.19 " state="beta " >}}
1206
+ {{< feature-state for_k8s_version="v1.21 " state="stable " >}}
1207
1207
1208
1208
<!--
1209
- The Kubernetes beta feature _Immutable Secrets and ConfigMaps_ provides an option to set
1209
+ The Kubernetes feature _Immutable Secrets and ConfigMaps_ provides an option to set
1210
1210
individual Secrets and ConfigMaps as immutable. For clusters that extensively use Secrets
1211
1211
(at least tens of thousands of unique Secret to Pod mounts), preventing changes to their
1212
1212
data has the following advantages:
@@ -1215,7 +1215,7 @@ data has the following advantages:
1215
1215
- improves performance of your cluster by significantly reducing load on kube-apiserver, by
1216
1216
closing watches for secrets marked as immutable.
1217
1217
-->
1218
- Kubernetes 的 alpha 特性 _ 不可变的 Secret 和 ConfigMap_ 提供了一种可选配置,
1218
+ Kubernetes 的特性 _ 不可变的 Secret 和 ConfigMap_ 提供了一种可选配置,
1219
1219
可以设置各个 Secret 和 ConfigMap 为不可变的。
1220
1220
对于大量使用 Secret 的集群(至少有成千上万各不相同的 Secret 供 Pod 挂载),
1221
1221
禁止变更它们的数据有下列好处:
@@ -1225,8 +1225,8 @@ Kubernetes 的 alpha 特性 _不可变的 Secret 和 ConfigMap_ 提供了一种
1225
1225
kube-apiserver 的负载,提升集群性能。
1226
1226
1227
1227
<!--
1228
- This feature is controlled by the `ImmutableEphemeralVolumes` [feature
1229
- gate](/docs/reference/command-line-tools-reference/feature-gates/),
1228
+ This feature is controlled by the `ImmutableEphemeralVolumes`
1229
+ [feature gate](/docs/reference/command-line-tools-reference/feature-gates/),
1230
1230
which is enabled by default since v1.19. You can create an immutable
1231
1231
Secret by setting the `immutable` field to `true`. For example,
1232
1232
-->
@@ -1300,17 +1300,6 @@ Pod 将会将其的 imagePullSecret 字段设置为服务帐户的 imagePullSecr
1300
1300
有关该过程的详细说明,请参阅
1301
1301
[将 ImagePullSecrets 添加到服务帐户](/zh/docs/tasks/configure-pod-container/configure-service-account/#adding-imagepullsecrets-to-a-service-account)。
1302
1302
1303
- <!--
1304
- # ## Automatic Mounting of Manually Created Secrets
1305
-
1306
- Manually created secrets (e.g. one containing a token for accessing a github account)
1307
- can be automatically attached to pods based on their service account.
1308
- -->
1309
-
1310
- # ### 自动挂载手动创建的 Secret
1311
-
1312
- 手动创建的 Secret(例如包含用于访问 GitHub 帐户令牌的 Secret)可以
1313
- 根据其服务帐户自动附加到 Pod。
1314
1303
1315
1304
<!--
1316
1305
# # Details
@@ -1863,14 +1852,12 @@ Secret 中的值对于不同的环境来说重要性可能不同。
1863
1852
<!--
1864
1853
Applications that need to access the secrets API should perform `get` requests on
1865
1854
the secrets they need. This lets administrators restrict access to all secrets
1866
- while [white-listing access to individual instances](
1867
- /docs/reference/access-authn-authz/rbac/#referring-to-resources) that
1855
+ while [white-listing access to individual instances](/docs/reference/access-authn-authz/rbac/#referring-to-resources) that
1868
1856
the app needs.
1869
1857
1870
1858
For improved performance over a looping `get`, clients can design resources that
1871
1859
reference a secret then `watch` the resource, re-requesting the secret when the
1872
- reference changes. Additionally, a ["bulk watch" API](
1873
- https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/bulk_watch.md)
1860
+ reference changes. Additionally, a ["bulk watch" API](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/bulk_watch.md)
1874
1861
to let clients `watch` individual resources has also been proposed, and will likely
1875
1862
be available in future releases of Kubernetes.
1876
1863
-->
0 commit comments