You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Tweak namespace fetch command
* Update CA certificate rotation task
* Document when to reconfigure cloud-controller-manager for CA rotation
* Assume that Kubernetes is at least v1.13
At the time of writing, the oldest supported version was v1.21
* Wrap page
@@ -62,56 +68,65 @@ Configurations with a single API server will experience unavailability while the
62
68
done
63
69
```
64
70
65
-
1. Restart all pods using in-cluster configs (ex: kube-proxy, coredns, etc) so they can use the updated certificate authority data from *ServiceAccount* secrets.
71
+
1. Restart all pods using in-cluster configurations (for example: kube-proxy, CoreDNS, etc) so they can use the
72
+
updated certificate authority data from Secrets that link to ServiceAccounts.
66
73
67
-
* Make sure coredns, kube-proxy and other pods using in-cluster configs are working as expected.
74
+
* Make sure CoreDNS, kube-proxy and other Pods using in-cluster configurations are working as expected.
68
75
69
-
1. Append the both old and new CA to the file against `--client-ca-file` and `--kubelet-certificate-authority` flag in the `kube-apiserver` configuration.
76
+
1. Append the both old and new CA to the file against `--client-ca-file` and `--kubelet-certificate-authority`
77
+
flag in the `kube-apiserver` configuration.
70
78
71
79
1. Append the both old and new CA to the file against `--client-ca-file` flag in the `kube-scheduler` configuration.
72
80
73
-
1. Update certificates for user accounts by replacing the content of `client-certificate-data` and `client-key-data` respectively.
81
+
1. Update certificates for user accounts by replacing the content of `client-certificate-data` and `client-key-data`
82
+
respectively.
74
83
75
84
For information about creating certificates for individual user accounts, see
76
85
[Configure certificates for user accounts](/docs/setup/best-practices/certificates/#configure-certificates-for-user-accounts).
77
86
78
87
Additionally, update the `certificate-authority-data` section in the kubeconfig files,
79
88
respectively with Base64-encoded old and new certificate authority data
80
89
81
-
1. Follow below steps in a rolling fashion.
90
+
1. Update the `--root-ca-file` flag for the {{< glossary_tooltip term_id="cloud-controller-manager" >}} to include
91
+
both old and new CA, then restart the cloud-controller-manager.
92
+
93
+
{{< note >}}
94
+
If your cluster does not have a cloud-controller-manager, you can skip this step.
95
+
{{< /note >}}
96
+
97
+
1. Follow the steps below in a rolling fashion.
82
98
83
-
1. Restart any other *[aggregated api servers](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/)*
84
-
or *webhook handlers* to trust the new CA certificates.
99
+
1. Restart any other
100
+
[aggregated API servers](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) or
101
+
webhook handlers to trust the new CA certificates.
85
102
86
103
1. Restart the kubelet by update the file against `clientCAFile` in kubelet configuration and
87
-
`certificate-authority-data` in kubelet.conf to use both the old and new CA on all nodes.
104
+
`certificate-authority-data` in `kubelet.conf` to use both the old and new CA on all nodes.
88
105
89
-
If your kubelet is not using client certificate rotation update `client-certificate-data` and
90
-
`client-key-data` in kubelet.conf on all nodes along with the kubelet client certificate file
106
+
If your kubelet is not using client certificate rotation, update `client-certificate-data` and
107
+
`client-key-data` in `kubelet.conf` on all nodes along with the kubelet client certificate file
91
108
usually found in `/var/lib/kubelet/pki`.
92
109
93
-
94
110
1. Restart API servers with the certificates (`apiserver.crt`, `apiserver-kubelet-client.crt` and
95
111
`front-proxy-client.crt`) signed by new CA.
96
112
You can use the existing private keys or new private keys.
97
113
If you changed the private keys then update these in the Kubernetes certificates directory as well.
98
114
99
-
Since the pod trusts both old and new CAs, there will be a momentarily disconnection
100
-
after which the pod's kube client will reconnect to the new API server
101
-
that uses the certificate signed by the new CA.
102
-
103
-
* Restart Scheduler to use the new CAs.
115
+
Since the Pods in your cluster trust both old and new CAs, there will be a momentarily disconnection
116
+
after which pods' Kubernetes clients reconnect to the new API server.
117
+
The new API server uses a certificate signed by the new CA.
104
118
119
+
* Restart the {{< glossary_tooltip term_id="kube-scheduler" text="kube-scheduler" >}} to use and
120
+
trust the new CAs.
105
121
* Make sure control plane components logs no TLS errors.
106
122
107
123
{{< note >}}
108
-
To generate certificates and private keys for your cluster using the `openssl` command line tool, see [Certificates (`openssl`)](/docs/tasks/administer-cluster/certificates/#openssl).
124
+
To generate certificates and private keys for your cluster using the `openssl` command line tool,
125
+
see [Certificates (`openssl`)](/docs/tasks/administer-cluster/certificates/#openssl).
109
126
You can also use [`cfssl`](/docs/tasks/administer-cluster/certificates/#cfssl).
110
127
{{< /note >}}
111
128
112
-
1. Annotate any Daemonsets and Deployments to trigger pod replacement in a safer rolling fashion.
113
-
114
-
Example:
129
+
1. Annotate any DaemonSets and Deployments to trigger pod replacement in a safer rolling fashion.
115
130
116
131
```shell
117
132
fornamespacein$(kubectl get namespace -o jsonpath='{.items[*].metadata.name}');do
@@ -129,7 +144,10 @@ Configurations with a single API server will experience unavailability while the
129
144
see [configure pod disruption budget](/docs/tasks/run-application/configure-pdb/).
130
145
{{< /note >}}
131
146
132
-
1. If your cluster is using bootstrap tokens to join nodes, update the ConfigMap `cluster-info`in the `kube-public` namespace with new CA.
147
+
Depending on how you use StatefulSets you may also need to perform similar rolling replacement.
148
+
149
+
1. If your cluster is using bootstrap tokens to join nodes, update the ConfigMap `cluster-info`in the `kube-public`
@@ -141,19 +159,24 @@ Configurations with a single API server will experience unavailability while the
141
159
142
160
1. Verify the cluster functionality.
143
161
144
-
1. Validate the logs from control plane components, along with the kubelet and the
145
-
kube-proxy are not throwing any tls errors, see
146
-
[looking at the logs](/docs/tasks/debug/debug-cluster/#looking-at-logs).
162
+
1. Check the logs from control plane components, along with the kubelet and the kube-proxy.
163
+
Ensure those components are not reporting any TLS errors; see
164
+
[looking at the logs](/docs/tasks/debug-application-cluster/debug-cluster/#looking-at-logs) for more details.
147
165
148
-
1. Validate logs from any aggregated api servers and pods using in-cluster config.
166
+
1. Validate logs from any aggregated api servers and pods using in-cluster config.
149
167
150
168
1. Once the cluster functionality is successfully verified:
151
169
152
170
1. Update all service account tokens to include new CA certificate only.
153
171
154
-
* All pods using an in-cluster kubeconfig will eventually need to be restarted to pick up the new SA secret for the old CA to be completely untrusted.
172
+
* All pods using an in-cluster kubeconfig will eventually need to be restarted to pick up the new Secret,
173
+
so that no Pods are relying on the old cluster CA.
155
174
156
-
1. Restart the control plane components by removing the old CA from the kubeconfig files and the files against `--client-ca-file`, `--root-ca-file` flags resp.
175
+
1. Restart the control plane components by removing the old CA from the kubeconfig files and the files against
176
+
`--client-ca-file`, `--root-ca-file` flags resp.
157
177
158
-
1. Restart kubelet by removing the old CA from file against the `clientCAFile` flag and kubelet kubeconfig file.
178
+
1. On each node, restart the kubelet by removing the old CA from file against the `clientCAFile` flag
179
+
and from the kubelet kubeconfig file. You should carry this out as a rolling update.
159
180
181
+
If your cluster lets you make this change, you can also roll it out by replacing nodes rather than
0 commit comments