If you have managed to lose your kubeconfig and have no backup, there are a few ways to get things back to normal. This doesn't, however, negate the need for a proper backup strategy, as in some cases you can't restore access.
The best way to prevent a missing kubeconfig from being an issue is to use an SSH public key when creating the cluster.
1. DKP 2.x; Bootstrap cluster still available.
This is easy - since DKP 2.0, there is a single command that can reproduce the kubeconfig file:
dkp get kubeconfig
Additional parameters and details for this command is available in the DKP documentation.
2. DKP 2.x; SSH access to any node in the cluster.
Once again, this is quite easy. On any node in a DKP cluster, the kubeconfig file is located in
/etc/kubernetes/admin.conf
Simply copying this to your local machine will restore previous access.
In the worst case scenario, if you do not have SSH access to any node, you can try the "back door" options for the particular provider, and grab the admin.conf file as above.
- AWS: https://aws.amazon.com/premiumsupport/knowledge-center/user-data-replace-key-pair-ec2/
- Azure: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/run-command
- GCP: https://cloud.google.com/compute/docs/ssh-in-browser
For on-prem and/or pre-provisioned installs (for example, vSphere), you will need to go through the process of running a live-cd recovery process, many examples of which are available online. This will require downtime of the node.
For all support questions relating to recovery of access to your virtual machine instances, you will need to contact the provider, and not D2IQ.