Skip to content

Commit f310480

Browse files
authored
add maintenance docs about cluster certifictates (#42)
1 parent 1a1e1af commit f310480

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "Rotation of cluster certificates"
3+
description: "Rotation of cluster certificates."
4+
---
5+
6+
## Overview
7+
8+
Cluster certificates for both k3s and Rancher have an expiration time of one year from their issuance date. After this period, the certificates need to be renewed to avoid any service disruptions.
9+
10+
## k3s Certificate Expiry
11+
12+
k3s client and server certificates are valid for 365 days from their date of issuance. If certificates are expired or within 90 days of expiring, they are automatically renewed each time k3s starts. Additionally, a Kubernetes warning event with reason `CertificateExpirationWarning` will be generated when a certificate is within 90 days of expiration.
13+
14+
To check the expiration dates of your certificates, run the following command on the k3s server node ( `se-flem-003`):
15+
16+
```bash
17+
k3s certificate check --output table # will work if k3s is updated
18+
```
19+
20+
If you need to manually rotate certificates, you can use the following commands on the same node:
21+
22+
```bash
23+
# Stop k3s
24+
systemctl stop k3s
25+
26+
# Rotate certificates
27+
k3s certificate rotate
28+
29+
# Start k3s
30+
systemctl start k3s
31+
```
32+
33+
**Note:** Restarting k3s will cause downtime for kthcloud and any other services on the `local` cluster, as Kubernetes services will be unavailable during the restart.
34+
35+
For more details, refer to the [k3s certificate documentation](https://docs.k3s.io/cli/certificate).
36+
37+
## Rancher Certificate Expiry
38+
39+
Rancher versions v2.6.3 and above automatically renew the `rancher-webhook` TLS certificate when it is within 30 days or fewer of its expiration date. If you are using Rancher v2.6.2 or earlier, you may need to manually rotate the expired webhook certificate.
40+
41+
To manually rotate the expired webhook certificate, use the following commands:
42+
43+
```bash
44+
kubectl delete secret -n cattle-system cattle-webhook-tls
45+
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io --ignore-not-found=true rancher.cattle.io
46+
kubectl delete pod -n cattle-system -l app=rancher-webhook
47+
```
48+
49+
For more information, refer to the [Rancher documentation on expired webhook certificate rotation](https://ranchermanager.docs.rancher.com/troubleshooting/other-troubleshooting-tips/expired-webhook-certificate-rotation).

0 commit comments

Comments
 (0)