adamant-kite-43734
10/04/2024, 8:23 PMcreamy-pencil-82913
10/04/2024, 8:52 PMhigh-thailand-50933
10/04/2024, 8:55 PMhigh-thailand-50933
10/04/2024, 8:57 PMhigh-thailand-50933
10/04/2024, 9:06 PMcreamy-pencil-82913
10/04/2024, 9:14 PMhigh-thailand-50933
10/04/2024, 9:14 PMcreamy-pencil-82913
10/04/2024, 9:14 PMcreamy-pencil-82913
10/04/2024, 9:15 PMIf a new root CA is required, the rotation will be disruptive. Theoption must be used, all nodes (servers and agents) will need to be reconfigured to use the new token value, and pods will need to be restarted to trust the new root CA.rke2 certificate rotate-ca --force
creamy-pencil-82913
10/04/2024, 9:16 PMlemon-keyboard-45433
10/04/2024, 9:17 PMcreamy-pencil-82913
10/04/2024, 9:17 PMIf you used theoption or changed the root CA, ensure that any nodes that were joined with a secure token are reconfigured to use the new token value, prior to being restarted. The token may be stored in a--force
file, systemd unit, or config.yaml, depending on how the node was configured during initial installation..env
lemon-keyboard-45433
10/04/2024, 9:17 PMcreamy-pencil-82913
10/04/2024, 9:18 PMlemon-keyboard-45433
10/04/2024, 9:18 PMcreamy-pencil-82913
10/04/2024, 9:18 PMhigh-thailand-50933
10/04/2024, 9:18 PMcreamy-pencil-82913
10/04/2024, 9:19 PMworried-dusk-80606
10/04/2024, 9:22 PM# rke2 certificate rotate-ca --path /var/lib/rancher/rke2
FATA[0000] open /var/lib/rancher/rke2/server/token: no such file or directory
worried-dusk-80606
10/04/2024, 9:23 PMcreamy-pencil-82913
10/04/2024, 9:23 PMcreamy-pencil-82913
10/04/2024, 9:23 PMcreamy-pencil-82913
10/04/2024, 9:24 PMcreamy-pencil-82913
10/04/2024, 9:24 PMcreamy-pencil-82913
10/04/2024, 9:27 PMcreamy-pencil-82913
10/04/2024, 9:32 PMworried-dusk-80606
10/04/2024, 9:34 PM/etc/rancher/rke2/config.yaml
matches the end portion of the value on the server /var/lib/rancher/rke2/server/token
worried-dusk-80606
10/04/2024, 9:36 PMrke2 certificate rotate
command on an agent it give this error
# rke2 certificate rotate
FATA[0000] open /var/lib/rancher/rke2/server/token: no such file or directory
worried-dusk-80606
10/04/2024, 9:37 PMworried-dusk-80606
10/04/2024, 9:37 PMworried-dusk-80606
10/04/2024, 9:39 PMcreamy-pencil-82913
10/04/2024, 9:39 PMworried-dusk-80606
10/04/2024, 9:39 PMlemon-keyboard-45433
10/04/2024, 9:39 PMlemon-keyboard-45433
10/04/2024, 9:40 PMcreamy-pencil-82913
10/04/2024, 9:40 PMcreamy-pencil-82913
10/04/2024, 9:41 PMcertificate rotate
would fail on agents because it was trying to rotate files that only exist on the server but that is long fixedlemon-keyboard-45433
10/04/2024, 9:41 PMcreamy-pencil-82913
10/04/2024, 9:41 PMlemon-keyboard-45433
10/04/2024, 9:41 PMcreamy-pencil-82913
10/04/2024, 9:44 PMcreamy-pencil-82913
10/04/2024, 9:45 PMroot@rke2-server-1:/# ls -la /var/lib/rancher/rke2/server/*token
lrwxrwxrwx 1 root root 34 Oct 4 20:23 /var/lib/rancher/rke2/server/agent-token -> /var/lib/rancher/rke2/server/token
lrwxrwxrwx 1 root root 34 Oct 4 20:23 /var/lib/rancher/rke2/server/node-token -> /var/lib/rancher/rke2/server/token
-rw------- 1 root root 109 Oct 4 20:23 /var/lib/rancher/rke2/server/token
lemon-keyboard-45433
10/04/2024, 9:46 PMlemon-keyboard-45433
10/04/2024, 9:46 PMcreamy-pencil-82913
10/04/2024, 9:48 PMcreamy-pencil-82913
10/04/2024, 9:49 PMworried-dusk-80606
10/04/2024, 9:52 PMOct 04 14:52:03 rke2[3223401]: time="2024-10-04T14:52:03-07:00" level=error msg="CA cert validation failed: Get \"<https://127.0.0.1:6444/cacerts>\": tls: failed to verify certificate: x509: certificate signed by unknown authority"
worried-dusk-80606
10/04/2024, 9:53 PMworried-dusk-80606
10/04/2024, 9:54 PMcreamy-pencil-82913
10/04/2024, 10:03 PMcreamy-pencil-82913
10/04/2024, 10:04 PMcreamy-pencil-82913
10/04/2024, 10:08 PMcurl -ks <https://SERVER:9345/cacerts> | openssl x509 -noout -text
echo QUIT | openssl s_client -connect SERVER:9345 | openssl x509 -noout -text
where SERVER is the host you’re using as the server:
address in the agent configlemon-keyboard-45433
10/04/2024, 10:08 PMlemon-keyboard-45433
10/04/2024, 10:08 PMlemon-keyboard-45433
10/04/2024, 10:09 PMcreamy-pencil-82913
10/04/2024, 10:09 PMcreamy-pencil-82913
10/04/2024, 10:09 PMhigh-thailand-50933
10/04/2024, 10:10 PMyou know which nodes are servers and which are agents right?Yes, we are good with this one...
worried-dusk-80606
10/04/2024, 10:10 PM$ echo QUIT | openssl s_client -connect `hostname`:9345 | openssl x509 -noout -text
depth=1 CN = rke2-server-ca@1727823995
worried-dusk-80606
10/04/2024, 10:10 PM$ curl -ks https://`hostname`:9345/cacerts | openssl x509 -noout -text
Subject: CN = rke2-server-ca@1728070064
lemon-keyboard-45433
10/04/2024, 10:11 PMcreamy-pencil-82913
10/04/2024, 10:13 PMIssuer: CN = rke2-server-ca@1727823995
Validity
Not Before: Oct 1 23:06:35 2024 GMT
Not After : Oct 2 00:12:11 2025 GMT
Subject: O = rke2, CN = rke2
Issuer: CN = rke2-server-ca@1728070064
Validity
Not Before: Oct 4 19:27:44 2024 GMT
Not After : Oct 2 19:27:44 2034 GMT
Subject: CN = rke2-server-ca@1728070064
The server cert isn’t signed by the new cluster CA, it’s still signed by the old one.worried-dusk-80606
10/04/2024, 10:14 PMworried-dusk-80606
10/04/2024, 10:14 PMlemon-keyboard-45433
10/04/2024, 10:14 PMcreamy-pencil-82913
10/04/2024, 10:15 PMcreamy-pencil-82913
10/04/2024, 10:15 PMlemon-keyboard-45433
10/04/2024, 10:15 PMworried-dusk-80606
10/04/2024, 10:15 PMcreamy-pencil-82913
10/04/2024, 10:16 PMworried-dusk-80606
10/04/2024, 10:16 PMworried-dusk-80606
10/04/2024, 10:16 PMhigh-thailand-50933
10/04/2024, 10:17 PMcreamy-pencil-82913
10/04/2024, 10:17 PMrm /var/lib/rancher/rke2/server/tls/dynamic-cert.json; kubectl delete secret -n kube-system rke2-serving
creamy-pencil-82913
10/04/2024, 10:17 PMcreamy-pencil-82913
10/04/2024, 10:18 PMlemon-keyboard-45433
10/04/2024, 10:21 PMlemon-keyboard-45433
10/04/2024, 10:21 PMlemon-keyboard-45433
10/04/2024, 10:23 PMcreamy-pencil-82913
10/04/2024, 10:23 PMlemon-keyboard-45433
10/04/2024, 10:23 PMcreamy-pencil-82913
10/04/2024, 10:24 PMcreamy-pencil-82913
10/04/2024, 10:24 PMlemon-keyboard-45433
10/04/2024, 10:24 PMcreamy-pencil-82913
10/04/2024, 10:24 PMlemon-keyboard-45433
10/04/2024, 10:24 PMlemon-keyboard-45433
10/04/2024, 10:24 PMcreamy-pencil-82913
10/04/2024, 10:25 PMworried-dusk-80606
10/04/2024, 10:27 PM# Create updated CA certs and keys, cross-signed by the current CAs.
# This script will create a new temporary directory containing the updated certs, and output the new token values.
curl -sL <https://github.com/k3s-io/k3s/raw/master/contrib/util/rotate-default-ca-certs.sh> | PRODUCT=rke2 bash -
# Load the updated certs into the datastore; see the script output for the updated token values.
rke2 certificate rotate-ca --path=/var/lib/rancher/rke2/server/rotate-ca
creamy-pencil-82913
10/04/2024, 10:28 PMcreamy-pencil-82913
10/04/2024, 10:29 PMcreamy-pencil-82913
10/04/2024, 10:31 PM