I've discovered that the k8s certs have expired which has resulted in Kubectl failing with the titled error
Could you consider updating the VMs box image with the updated certificate?
However, I have included the following steps that I used to work around the issue.
**** Work Around ***
Firstly reset rke2 by running
sudo rke2 server --cluster-reset
Remove old data from the etcd data directory if you get a error when running the cluster reset sudo rm -rf /var/lib/rancher/rke2/server/db/etcd
The deployment uses rke2 as the Kubernetes manager. You will need to rotate the certificates there
sudo rke2 certificate rotate
then restart rk2 by running
sudo systemctl restart rke2-server
Confirm that its started by sudo systemctl restart rke2-server
test that kubectl is working by running
sudo kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get pods --all-namespaces
Now to replace the Kubernetes configurations with the updated certificate information by modifying the Kube config file by updating it with the updated rke config
REPLACE vagrant@5g-spector:~/.kube$ config WITH /etc/rancher/rke2/rke2.yaml}
I've discovered that the k8s certs have expired which has resulted in Kubectl failing with the titled error
Could you consider updating the VMs box image with the updated certificate?
However, I have included the following steps that I used to work around the issue.
**** Work Around ***
Firstly reset rke2 by running
sudo rke2 server --cluster-reset
Remove old data from the etcd data directory if you get a error when running the cluster reset
sudo rm -rf /var/lib/rancher/rke2/server/db/etcd
The deployment uses rke2 as the Kubernetes manager. You will need to rotate the certificates there sudo rke2 certificate rotate
then restart rk2 by running
sudo systemctl restart rke2-server
Confirm that its started by sudo systemctl restart rke2-server
test that kubectl is working by running
sudo kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get pods --all-namespaces
Now to replace the Kubernetes configurations with the updated certificate information by modifying the Kube config file by updating it with the updated rke config
REPLACE vagrant@5g-spector:~/.kube$ config WITH /etc/rancher/rke2/rke2.yaml}
Test by running kubectl get pods -A