Skip to content

Commit 2b29735

Browse files
author
Tim Bannister
committed
Revise callouts for kubeadm cert page
Use fewer note and warning blocks, to keep the important messages focused.
1 parent 3e5e73e commit 2b29735

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

content/en/docs/tasks/administer-cluster/kubeadm/kubeadm-certs.md

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ to kubeadm certificate management.
1919

2020
You should be familiar with [PKI certificates and requirements in Kubernetes](/docs/setup/best-practices/certificates/).
2121

22+
This guide covers the usage of the `openssl` command (used for manual certificate signing,
23+
if you choose that approach), but you can use your preferred tools.
24+
25+
Some of the steps here use `sudo` for administrator access. You can use any equivalent tool.
26+
2227
<!-- steps -->
2328

2429
## Using custom certificates {#custom-certificates}
@@ -53,6 +58,9 @@ There are various ways to prepare the component credentials when using external
5358
[PKI certificates and requirements](/docs/setup/best-practices/certificates/) includes information
5459
on how to prepare all the required by kubeadm component credentials manually.
5560

61+
This guide covers the usage of the `openssl` command (used for manual certificate signing,
62+
if you choose that approach), but you can use your preferred tools.
63+
5664
### Preparation of credentials by signing CSRs generated by kubeadm
5765

5866
kubeadm can [generate CSR files](#signing-csr) that you can sign manually with tools like
@@ -87,7 +95,11 @@ Once the credentials are prepared on all nodes, call `kubeadm init` and `kubeadm
8795
join the cluster. kubeadm will use the existing kubeconfig and certificate files under `/etc/kubernetes/`
8896
and its `pki` sub directory.
8997

90-
## Check certificate expiration
98+
## Certificate expiry and management {#check-certificate-expiration}
99+
100+
{{< note >}}
101+
`kubeadm` cannot manage certificates signed by an external CA.
102+
{{< /note >}}
91103

92104
You can use the `check-expiration` subcommand to check when certificates expire:
93105

@@ -123,20 +135,15 @@ by kubeadm (`admin.conf`, `controller-manager.conf` and `scheduler.conf`).
123135
Additionally, kubeadm informs the user if the certificate is externally managed; in this case, the
124136
user should take care of managing certificate renewal manually/using other tools.
125137

126-
{{< warning >}}
127-
`kubeadm` cannot manage certificates signed by an external CA.
128-
{{< /warning >}}
129-
130-
{{< note >}}
131-
`kubelet.conf` is not included in the list above because kubeadm configures kubelet
138+
The `kubelet.conf` configuration file is not included in the list above because kubeadm
139+
configures kubelet
132140
for [automatic certificate renewal](/docs/tasks/tls/certificate-rotation/)
133141
with rotatable certificates under `/var/lib/kubelet/pki`.
134142
To repair an expired kubelet client certificate see
135143
[Kubelet client certificate rotation fails](/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/#kubelet-client-cert).
136-
{{< /note >}}
137144

138-
{{< warning >}}
139-
On nodes created with `kubeadm init`, prior to kubeadm version 1.17, there is a
145+
{{< note >}}
146+
On nodes created with `kubeadm init` from versions prior to kubeadm version 1.17, there is a
140147
[bug](https://github.com/kubernetes/kubeadm/issues/1753) where you manually have to modify the
141148
contents of `kubelet.conf`. After `kubeadm init` finishes, you should update `kubelet.conf` to
142149
point to the rotated kubelet client certificates, by replacing `client-certificate-data` and
@@ -146,7 +153,7 @@ point to the rotated kubelet client certificates, by replacing `client-certifica
146153
client-certificate: /var/lib/kubelet/pki/kubelet-client-current.pem
147154
client-key: /var/lib/kubelet/pki/kubelet-client-current.pem
148155
```
149-
{{< /warning >}}
156+
{{< /note >}}
150157
151158
## Automatic certificate renewal
152159
@@ -166,18 +173,20 @@ If you have more complex requirements for certificate renewal, you can opt out f
166173
behavior by passing `--certificate-renewal=false` to `kubeadm upgrade apply` or to `kubeadm
167174
upgrade node`.
168175

169-
{{< warning >}}
170-
Prior to kubeadm version 1.17 there is a [bug](https://github.com/kubernetes/kubeadm/issues/1818)
171-
where the default value for `--certificate-renewal` is `false` for the `kubeadm upgrade node`
172-
command. In that case, you should explicitly set `--certificate-renewal=true`.
173-
{{< /warning >}}
174-
175176
## Manual certificate renewal
176177

177-
You can renew your certificates manually at any time with the `kubeadm certs renew` command, with the appropriate command line options.
178+
You can renew your certificates manually at any time with the `kubeadm certs renew` command,
179+
with the appropriate command line options. If you are running cluster with a replicated control
180+
plane, this command needs to be executed on all the control-plane nodes.
178181

179182
This command performs the renewal using CA (or front-proxy-CA) certificate and key stored in `/etc/kubernetes/pki`.
180183

184+
`kubeadm certs renew` uses the existing certificates as the authoritative source for attributes
185+
(Common Name, Organization, subject alternative name) and does not rely on the `kubeadm-config`
186+
ConfigMap.
187+
Even so, the Kubernetes project recommends keeping the served certificate and the associated
188+
values in that ConfigMap synchronized, to avoid any risk of confusion.
189+
181190
After running the command you should restart the control plane Pods. This is required since
182191
dynamic certificate reload is currently not supported for all components and certificates.
183192
[Static Pods](/docs/tasks/configure-pod-container/static-pod/) are managed by the local kubelet
@@ -188,33 +197,25 @@ The kubelet will terminate the Pod if it's no longer in the manifest directory.
188197
You can then move the file back and after another `fileCheckFrequency` period, the kubelet will recreate
189198
the Pod and the certificate renewal for the component can complete.
190199

191-
{{< warning >}}
192-
If you are running an HA cluster, this command needs to be executed on all the control-plane nodes.
193-
{{< /warning >}}
194-
195-
{{< note >}}
196-
`certs renew` uses the existing certificates as the authoritative source for attributes (Common
197-
Name, Organization, SAN, etc.) instead of the `kubeadm-config` ConfigMap. It is strongly recommended
198-
to keep them both in sync.
199-
{{< /note >}}
200-
201-
`kubeadm certs renew` can renew any specific certificate or, with the subcommand `all`, it can renew all of them, as shown below:
200+
`kubeadm certs renew` can renew any specific certificate or, with the subcommand `all`, it can renew all of them:
202201

203202
```shell
203+
# If you are running cluster with a replicated control plane, this command
204+
# needs to be executed on all the control-plane nodes.
204205
kubeadm certs renew all
205206
```
206207

207-
{{< note >}}
208+
### Copying the administrator certificate (optional) {#admin-certificate-copy}
209+
208210
Clusters built with kubeadm often copy the `admin.conf` certificate into
209211
`$HOME/.kube/config`, as instructed in [Creating a cluster with kubeadm](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/).
210212
On such a system, to update the contents of `$HOME/.kube/config`
211-
after renewing the `admin.conf`, you must run the following commands:
213+
after renewing the `admin.conf`, you could run the following commands:
212214

213215
```shell
214216
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
215217
sudo chown $(id -u):$(id -g) $HOME/.kube/config
216218
```
217-
{{< /note >}}
218219

219220
## Renew certificates with the Kubernetes certificates API
220221

@@ -430,16 +431,13 @@ as extra SANs and custom IP addresses must be stored in the same configuration
430431
file and used for all relevant kubeadm commands by passing it as `--config`.
431432

432433
{{< note >}}
433-
This guide will cover the usage of the `openssl` command for singing the CSRs,
434-
but you can use your preferred tools.
435-
{{< /note >}}
434+
This guide uses the default Kubernetes directory `/etc/kubernetes`, which requires
435+
a super user. If you are following this guide and are using directories that you can
436+
write to (typically, this means running `kubeadm` with `--cert-dir` and `--kubeconfig-dir`)
437+
then you can omit the `sudo` command).
436438

437-
{{< note >}}
438-
This guide will use the default Kubernetes directory `/etc/kubernetes`, which requires
439-
a super user. If you are following this guide with permissive directories
440-
(by passing `--cert-dir` and `--kubeconfig-dir`) you can omit the `sudo` command).
441-
But note that the resulted files must be copied to the `/etc/kubernetes` tree,
442-
so that `kubeadm init` or `kubeadm join` will find them.
439+
You must then copy the files that you produced over to within the `/etc/kubernetes`
440+
directory so that `kubeadm init` or `kubeadm join` will find them.
443441
{{< /note >}}
444442

445443
### Preparing CA and service account files
@@ -460,8 +458,9 @@ private keys) that kubeadm needs for a control plane node.
460458

461459
{{< note >}}
462460
If you are using an external CA, you must generate the same files out of band and manually
463-
copy them to the primary control plane node in `/etc/kubernetes`. Once all CSRs
464-
are signed, you can delete the root CA key (`ca.key`) as noted in the
461+
copy them to the primary control plane node in `/etc/kubernetes`.
462+
463+
Once all CSRs are signed, you can delete the root CA key (`ca.key`) as noted in the
465464
[External CA mode](#external-ca-mode) section.
466465
{{< /note >}}
467466

@@ -500,9 +499,10 @@ That is because the active kube-controller-manager will be responsible
500499
for signing new kubelet client certificates.
501500

502501
{{< note >}}
503-
Processing the `kubelet.conf.csr` on the primary control plane node
504-
(`kubeadm init`) is required, because that is considered the node that
505-
bootstraps the cluster and a pre-populated `kubelet.conf` is needed.
502+
You must process the `kubelet.conf.csr` file on the primary control plane node
503+
(the host where you originally ran `kubeadm init`). This is because `kubeadm`
504+
considers that as the node that bootstraps the cluster, and a pre-populated
505+
`kubelet.conf` is needed.
506506
{{< /note >}}
507507

508508
#### Control plane nodes
@@ -539,8 +539,8 @@ the steps for worker nodes entirely.
539539

540540
{{< note >}}
541541
If you are using external CA and already have CA serial number files (`.srl`) for
542-
`openssl` you can copy such files to a kubeadm node where CSRs will be processed.
543-
`.srl` files to copy are `/etc/kubernetes/pki/ca.srl`,
542+
`openssl`, you can copy such files to a kubeadm node where CSRs will be processed.
543+
The `.srl` files to copy are `/etc/kubernetes/pki/ca.srl`,
544544
`/etc/kubernetes/pki/front-proxy-ca.srl` and `/etc/kubernetes/pki/etcd/ca.srl`.
545545
The files can be then moved to a new node where CSR files will be processed.
546546

0 commit comments

Comments
 (0)