Recover Kubeconfig for RKE from Rancher

#1

I have a running Rancher cluster v2.1.6 that I would like to upgrade. I have full admin privileges to the cluster via Rancher frontend including access to the ‘local’ cluster. However the original installation was not done by me and I no longer have access to the original kubeconfig from RKE. I have doubts that the kubeconfig that I download from the web interface would work during the upgrade while Rancher itself would be going up and down.

So I wonder if it is possible to recover the kubeconfig with kube-admin user and certificate-based auth that could talk to kubeapi on port 6443 from the cluster, or should I just proceed with the one that I get from Rancher UI for the upgrade?

Thank you.

#2

Anthony,

How was the Rancher Management Server and RKE installed?
Was RKE installed via rke up with cluster.yaml?
Or was Rancher Server installed first with or without HA support and then through the custom option over Rancher GUI was RKE installed?
Do you seen an upgrade option in the GUI?
If you see the upgrade option, then you need to upgrade the rancher server and then you will see the upgrade option for RKE in the Rancher Server GUI.
If RKE was installed via rke up and Rancher was installed via helm, then you can upgrade through rke up by providing the newer version of kubernetes_version, e.g. for Rancher 2.2 to v1.13.5-rancher1-2 in cluster.yaml.
Anyway make sure to back up your nodes before upgrade.
By the way, if you have the admin role, your kubeconfig would be fine to go.
Good luck!

#3

Thank you for your answer. Yes, all seems to be good. Kubeconfig is only needed for helm and helm does its thing gently with no disruptions, so Rancher’s API is undisturbed during the upgrade.

I also noticed that RKE command would reconstruct the original kubeconfig file if it’s missing. After all, all it needs is SSH access and it would get those credentials from the box for you.