zh-trans Update manual-rotation-of-ca-certificates.md

This commit is contained in:
jiajie
2020-12-06 23:00:07 +08:00
parent bc72bf3319
commit 653d4b69ba
@@ -61,23 +61,30 @@ Configurations with a single API server will experience unavailability while the
`front-proxy-client.key`)分发到所有控制面节点,放在其 Kubernetes 证书目录下。
<!--
1. Update *Kubernetes controller manager's* `-root-ca-file` to include both old and new CA and restart controller manager.
1. Update {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}}'s `--root-ca-file` to
include both old and new CA. Then restart the component.
Any service account created after this point will get secrets that include both old and new CAs.
Remove the flag `-client-ca-file` from the *Kubernetes controller manager* configuration.
You can also replace the existing client CA file or change this configuration item to reference a new, updated CA.
[Issue 1350](https://github.com/kubernetes/kubeadm/issues/1350) tracks an issue with *Kubernetes controller manager* being unable to accept a CA bundle.
{{< note >}}
The files specified by the kube-controller-manager flags `--client-ca-file` and `--cluster-signing-cert-file`
cannot be CA bundles. If these flags and `--root-ca-file` point to the same `ca.crt` file which is now a
bundle (includes both old and new CA) you will face an error. To workaround this problem you can copy the new CA to a separate
file and make the flags `--client-ca-file` and `--cluster-signing-cert-file` point to the copy. Once `ca.crt` is no longer
a bundle you can restore the problem flags to point to `ca.crt` and delete the copy.
{{< /note >}}
-->
2. 更新控制器管理器的 `--root-ca-file` 标志,使之同时包含老的和新的 CA,之后重启控制器管理器。
2. 更新 {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}} 的
`--root-ca-file` 标志,使之同时包含老的和新的 CA,之后重启组件。
自此刻起,所创建的所有服务账号都会获得同时包含老的 CA 和新的 CA 的 Secret。
{{< note >}}
去掉控制器管理器的 `-client-ca-file` 标志。
你也可以替换客户端 CA 文件或者将此配置条目指向新的、更新过的 CA。
[Issue 1350](https://github.com/kubernetes/kubeadm/issues/1350) 用来跟踪
控制器管理器无法接受 CA 包的问题。
kube-controller-manager 标志 `--client-ca-file` `--cluster-signing-cert-file` 所引用的文件
不能是 CA 证书包。如果这些标志和 `--root-ca-file` 指向同一个 `ca.crt` 包文件(包含老的和新的 CA 证书),
你将会收到出错信息。
要解决这个问题,可以将新的 CA 证书复制到单独的文件中,并将 `--client-ca-file``--cluster-signing-cert-file`
标志指向该副本。一旦 `ca.crt` 不再是证书包文件,就可以恢复有问题的标志指向 `ca.crt` 并删除该副本。
{{< /note >}}
<!--
@@ -89,6 +96,19 @@ Configurations with a single API server will experience unavailability while the
如果在 API 服务器使用新的 CA 之前启动了新的 Pod,这些 Pod
也会获得此更新并且同时信任老的和新的 CA 证书。
<!--
```shell
base64_encoded_ca="$(base64 <path to file containing both old and new CAs>)"
for namespace in $(kubectl get ns --no-headers | awk '{print $1}'); do
for token in $(kubectl get secrets --namespace "$namespace" --field-selector type=kubernetes.io/service-account-token -o name); do
kubectl get $token --namespace "$namespace" -o yaml | \
/bin/sed "s/\(ca.crt:\).*/\1 ${base64_encoded_ca}" | \
kubectl apply -f -
done
done
```
-->
```shell
base64_encoded_ca="$(base64 <path to file containing both old and new CAs>)"
@@ -111,7 +131,7 @@ Configurations with a single API server will experience unavailability while the
1. Append the both old and new CA to the file against `-client-ca-file` flag in the `kube-scheduler` configuration.
-->
4. 重启所有使用集群内配置的 Pods(例如:`kube-proxy`、`coredns` 等),以便这些 Pod 能够使用
来自服务账号 Secret 中的、已更新的证书机构数据。
来自 *ServiceAccount* Secret 中的、已更新的证书机构数据。
* 确保 `coredns`、`kube-proxy` 和其他使用集群内配置的 Pod 都正按预期方式工作。
@@ -151,7 +171,7 @@ Configurations with a single API server will experience unavailability while the
-->
8. 遵循下列步骤执行滚动更新
1. 重新启动所有其他[被聚合的 API 服务器](/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/)
1. 重新启动所有其他 *[被聚合的 API 服务器](/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/)*
或者 *Webhook 处理程序*,使之信任新的 CA 证书。
2. 在所有节点上更新 kubelet 配置中的 `clientCAFile` 所指文件以及 kubelet.conf 中的
@@ -275,4 +295,3 @@ Configurations with a single API server will experience unavailability while the
1. 重启 kubelet,移除 `clientCAFile` 标志所指向的文件以及 kubelet kubeconfig 文件中
的老的 CA 数据。