Skip to content

Commit f510b22

Browse files
neolit123k8s-ci-robot
authored andcommitted
kubeadm: improvements to the cert management documentation (#18397)
- move the sections about custom certificates and external CA to the kubeadm-certs page - minor cleanups to the kubeadm-certs page, including updated output for the check-expiration command - link the implementation details page to the new locations for custom certs and external CA
1 parent 70936d4 commit f510b22

File tree

3 files changed

+55
-41
lines changed

3 files changed

+55
-41
lines changed

content/en/docs/reference/setup-tools/kubeadm/implementation-details.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ Certificates are stored by default in `/etc/kubernetes/pki`, but this directory
150150
1. If a given certificate and private key pair both exist, and its content is evaluated compliant with the above specs, the existing files will
151151
be used and the generation phase for the given certificate skipped. This means the user can, for example, copy an existing CA to
152152
`/etc/kubernetes/pki/ca.{crt,key}`, and then kubeadm will use those files for signing the rest of the certs.
153-
See also [using custom certificates](/docs/reference/setup-tools/kubeadm/kubeadm-init/#custom-certificates)
153+
See also [using custom certificates](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs#custom-certificates)
154154
2. Only for the CA, it is possible to provide the `ca.crt` file but not the `ca.key` file, if all other certificates and kubeconfig files
155155
already are in place kubeadm recognize this condition and activates the ExternalCA , which also implies the `csrsigner`controller in
156156
controller-manager won't be started
157-
3. If kubeadm is running in [ExternalCA mode](/docs/reference/setup-tools/kubeadm/kubeadm-init/#external-ca-mode); all the certificates must be provided by the user,
158-
because kubeadm cannot generate them by itself
157+
3. If kubeadm is running in [external CA mode](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs#external-ca-mode);
158+
all the certificates must be provided by the user, because kubeadm cannot generate them by itself
159159
4. In case of kubeadm is executed in the `--dry-run` mode, certificates files are written in a temporary folder
160160
5. Certificate generation can be invoked individually with the [`kubeadm init phase certs all`](/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/#cmd-phase-certs) command
161161

content/en/docs/reference/setup-tools/kubeadm/kubeadm-init.md

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ following steps:
2626
1. Generates a self-signed CA (or using an existing one if provided) to set up
2727
identities for each component in the cluster. If the user has provided their
2828
own CA cert and/or key by dropping it in the cert directory configured via `--cert-dir`
29-
(`/etc/kubernetes/pki` by default) this step is skipped as described in the
30-
[Using custom certificates](#custom-certificates) document.
29+
(`/etc/kubernetes/pki` by default).
3130
The APIServer certs will have additional SAN entries for any `--apiserver-cert-extra-sans` arguments, lowercased if necessary.
3231

3332
1. Writes kubeconfig files in `/etc/kubernetes/` for
@@ -177,30 +176,12 @@ The following command can be used to generate a new key on demand:
177176
kubeadm alpha certs certificate-key
178177
```
179178

180-
### Using custom certificates {#custom-certificates}
179+
### Certificate management with kubeadm
181180

182-
By default, kubeadm generates all the certificates needed for a cluster to run.
183-
You can override this behavior by providing your own certificates.
184-
185-
To do so, you must place them in whatever directory is specified by the
186-
`--cert-dir` flag or `CertificatesDir` configuration file key. By default this
187-
is `/etc/kubernetes/pki`.
188-
189-
If a given certificate and private key pair exists before running `kubeadm init`,
190-
kubeadm will not overwrite them. This means you can, for example, copy an existing
191-
CA into `/etc/kubernetes/pki/ca.crt` and `/etc/kubernetes/pki/ca.key`,
192-
and kubeadm will use this CA for signing the rest of the certificates.
193-
194-
#### External CA mode {#external-ca-mode}
195-
196-
It is also possible to provide just the `ca.crt` file and not the
197-
`ca.key` file (this is only available for the root CA file, not other cert pairs).
198-
If all other certificates and kubeconfig files are in place, kubeadm recognizes
199-
this condition and activates the "External CA" mode. kubeadm will proceed without the
200-
CA key on disk.
201-
202-
Instead, run the controller-manager standalone with `--controllers=csrsigner` and
203-
point to the CA certificate and key.
181+
For detailed information on certificate management with kubeadm see
182+
[Certificate Management with kubeadm](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/).
183+
The document includes information about using external CA, custom certificates
184+
and certificate renewal.
204185

205186
### Managing the kubeadm drop-in file for the kubelet {#kubelet-drop-in}
206187

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

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,37 @@ You should be familiar with [PKI certificates and requirements in Kubernetes](/d
2121

2222
{{% capture steps %}}
2323

24+
## Using custom certificates {#custom-certificates}
25+
26+
By default, kubeadm generates all the certificates needed for a cluster to run.
27+
You can override this behavior by providing your own certificates.
28+
29+
To do so, you must place them in whatever directory is specified by the
30+
`--cert-dir` flag or the `certificatesDir` field of kubeadm's `ClusterConfiguration`.
31+
By default this is `/etc/kubernetes/pki`.
32+
33+
If a given certificate and private key pair exists before running `kubeadm init`,
34+
kubeadm does not overwrite them. This means you can, for example, copy an existing
35+
CA into `/etc/kubernetes/pki/ca.crt` and `/etc/kubernetes/pki/ca.key`,
36+
and kubeadm will use this CA for signing the rest of the certificates.
37+
38+
## External CA mode {#external-ca-mode}
39+
40+
It is also possible to provide just the `ca.crt` file and not the
41+
`ca.key` file (this is only available for the root CA file, not other cert pairs).
42+
If all other certificates and kubeconfig files are in place, kubeadm recognizes
43+
this condition and activates the "External CA" mode. kubeadm will proceed without the
44+
CA key on disk.
45+
46+
Instead, run the controller-manager standalone with `--controllers=csrsigner` and
47+
point to the CA certificate and key.
48+
49+
[PKI certificates and requirements](/docs/setup/best-practices/certificates/) includes guidance on
50+
setting up a cluster to use an external CA.
51+
2452
## Check certificate expiration
2553

26-
`check-expiration` can be used to check certificate expiration.
54+
You can use the `check-expiration` subcommand to check when certificates expire:
2755

2856
```
2957
kubeadm alpha certs check-expiration
@@ -32,17 +60,22 @@ kubeadm alpha certs check-expiration
3260
The output is similar to this:
3361

3462
```
35-
CERTIFICATE EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
36-
admin.conf May 15, 2020 13:03 UTC 364d false
37-
apiserver May 15, 2020 13:00 UTC 364d false
38-
apiserver-etcd-client May 15, 2020 13:00 UTC 364d false
39-
apiserver-kubelet-client May 15, 2020 13:00 UTC 364d false
40-
controller-manager.conf May 15, 2020 13:03 UTC 364d false
41-
etcd-healthcheck-client May 15, 2020 13:00 UTC 364d false
42-
etcd-peer May 15, 2020 13:00 UTC 364d false
43-
etcd-server May 15, 2020 13:00 UTC 364d false
44-
front-proxy-client May 15, 2020 13:00 UTC 364d false
45-
scheduler.conf May 15, 2020 13:03 UTC 364d false
63+
CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
64+
admin.conf Dec 30, 2020 23:36 UTC 364d no
65+
apiserver Dec 30, 2020 23:36 UTC 364d ca no
66+
apiserver-etcd-client Dec 30, 2020 23:36 UTC 364d etcd-ca no
67+
apiserver-kubelet-client Dec 30, 2020 23:36 UTC 364d ca no
68+
controller-manager.conf Dec 30, 2020 23:36 UTC 364d no
69+
etcd-healthcheck-client Dec 30, 2020 23:36 UTC 364d etcd-ca no
70+
etcd-peer Dec 30, 2020 23:36 UTC 364d etcd-ca no
71+
etcd-server Dec 30, 2020 23:36 UTC 364d etcd-ca no
72+
front-proxy-client Dec 30, 2020 23:36 UTC 364d front-proxy-ca no
73+
scheduler.conf Dec 30, 2020 23:36 UTC 364d no
74+
75+
CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
76+
ca Dec 28, 2029 23:36 UTC 9y no
77+
etcd-ca Dec 28, 2029 23:36 UTC 9y no
78+
front-proxy-ca Dec 28, 2029 23:36 UTC 9y no
4679
```
4780

4881
The command shows expiration/residual time for the client certificates in the `/etc/kubernetes/pki` folder and for the client certificate embedded in the KUBECONFIG files used by kubeadm (`admin.conf`, `controller-manager.conf` and `scheduler.conf`).
@@ -70,7 +103,7 @@ client-key: /var/lib/kubelet/pki/kubelet-client-current.pem
70103
71104
## Automatic certificate renewal
72105
73-
`kubeadm` renews all the certificates during control plane [upgrade](/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/).
106+
kubeadm renews all the certificates during control plane [upgrade](/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/).
74107
75108
This feature is designed for addressing the simplest use cases;
76109
if you don't have specific requirements on certificate renewal and perform Kubernetes version upgrades regularly (less than 1 year in between each upgrade), kubeadm will take care of keeping your cluster up to date and reasonably secure.

0 commit comments

Comments
 (0)