Bartosz Bierkowski - Low dose cloud

Minishift: recover .kube/config

I deleted my .kube/config file, which stores the configuration for OpenShift cluster in Minishift.

The cluster accepts any user, so it’s not a problem. Only when you want to have a look around and become an admin, you need system:admin credentials or cluster-admin privileges.

Creating initial project "myproject" ...                                                                                                                                      
Server Information ...                                                                                                                                                        
OpenShift server started.                                                                                                                                                     
The server is accessible via web console at:                                                                                                                                                                                                                                                                    
You are logged in as:                                                                                                                                                         
    User:     developer                                                                                                                                                       
    Password: <any value>

To login as administrator:
    oc login -u system:admin

The oc login -u system:admin command does not work, as it asks for a password.

$ oc login -u system:admin --server --insecure-skip-tls-verify
Authentication required for (openshift)
Username: system:admin
error: username system:admin is invalid for basic auth

I found solution to my problem in one of issues:

There are multiple tickets open for similar problems. I liked the option to just get the config file from vm.

minishift ssh
sudo cat /home/docker/.kube/config

Copying the content of the file into ~/.kube/config file fixes the problem. The login as system:admin users works again.