New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot login to minishift as admin #2107

Closed
ibaboo opened this Issue Mar 9, 2018 · 52 comments

Comments

@ibaboo
Copy link

ibaboo commented Mar 9, 2018

General information

  • Minishift version: minishift v1.14.0+1ec5877

  • OS: Linux

  • Hypervisor: VirtualBox

Steps to reproduce

  1. minishift start
  2. oc login -u system:admin

Expected

login as admin

Actual

Does not login

oc login -u system:admin
Authentication required for https://192.168.99.100:8443 (openshift)
Username: system:admin

Workaround

#2107 (comment)

Here is the work around:

$ minishift addon apply admin-user

$ oc login -u admin
Authentication required for https://192.168.64.2:8443 (openshift)
Username: admin
Password: admin
Login successful.

Or

 $ minishift addon list
- admin-user	 : enabled	P(0)

 $ minishift start 

$ oc login -u admin
Authentication required for https://192.168.64.2:8443 (openshift)
Username: admin
Password: admin
Login successful.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-public
    kube-system
  * myproject
    openshift
    openshift-infra
    openshift-node
    openshift-web-console

Using project "myproject".

@tylerauerbeck

This comment has been minimized.

Copy link
Contributor

tylerauerbeck commented Mar 11, 2018

@ibaboo I'm not seeing those issues:

$ minishift version
minishift v1.14.0+1ec5877

$ ./oc version
oc v3.7.1+ab0f056
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.99.100:8443
openshift v3.7.1+a8deba5-34
kubernetes v1.7.6+a08f5eeb62

$ ./oc login -u system:admin
Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project ':

default
kube-public
kube-system
  • myproject
    openshift
    openshift-infra
    openshift-node

Using project "myproject".

Can you verify that your tooling looks the same (oc version, etc.)?

@amitkrout

This comment has been minimized.

Copy link
Contributor

amitkrout commented Mar 12, 2018

@ibabooI am not able to reproduce the issue you are facing. What I m suspecting, in your case there might be old oc reference present in the path. Please try these steps

1. ./minishift start
2. eval $(./minishift oc-env)
3. oc login -u system:admin
@ibaboo

This comment has been minimized.

Copy link

ibaboo commented Mar 13, 2018

minishift start
-- Starting profile 'minishift'
-- Checking if requested OpenShift version 'v3.7.1' is valid ... OK
-- Checking if requested OpenShift version 'v3.7.1' is supported ... OK
-- Checking if requested hypervisor 'kvm' is supported on this platform ... OK
-- Checking if KVM driver is installed ...
Driver is available at /usr/local/bin/docker-machine-driver-kvm ...
Checking driver binary is executable ... OK
-- Checking if Libvirt is installed ... OK
-- Checking if Libvirt default network is present ... OK
-- Checking if Libvirt default network is active ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting local OpenShift cluster using 'kvm' hypervisor ...
-- Starting Minishift VM ................... OK
-- Checking for IP address ... OK
-- Checking if external host is reachable from the Minishift VM ...
Pinging 8.8.8.8 ... FAIL
VM is unable to ping external host
-- Checking HTTP connectivity from the VM ...
Retrieving http://minishift.io/index.html ... FAIL
VM cannot connect to external URL with HTTP
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 8% used OK
-- OpenShift cluster will be configured with ...
Version: v3.7.1
Starting OpenShift using openshift/origin:v3.7.1 ...
OpenShift server started.

The server is accessible via web console at:
https://192.168.99.100:8443

WARNING: You specified an HTTP proxy for cluster up, but one is not configured for the Docker daemon
WARNING: You specified an HTTPS proxy for cluster up, but one is not configured for the Docker daemon
Could not set oc CLI context for: 'minishift'

eval $(minishift oc-env)
oc login -u system:admin
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

Authentication required for https://192.168.99.100:8443 (openshift)
Username: system:admin
Password:

@praveenkumar

This comment has been minimized.

Copy link
Contributor

praveenkumar commented Mar 14, 2018

@ibaboo which ISO are you using, I can see below logs for your explanation. openshift/origin#18596

WARNING: You specified an HTTP proxy for cluster up, but one is not configured for the Docker daemon
WARNING: You specified an HTTPS proxy for cluster up, but one is not configured for the Docker daemon
Could not set oc CLI context for: 'minishift'
@ibaboo

This comment has been minimized.

Copy link

ibaboo commented Mar 14, 2018

I am using Virtual Box

@praveenkumar

This comment has been minimized.

Copy link
Contributor

praveenkumar commented Mar 15, 2018

@ibaboo as per logs you are using kvm if you want to use the VirtualBox then --vm-driver virtualBox is needed as start option.

@ibaboo

This comment has been minimized.

Copy link

ibaboo commented Mar 15, 2018

@praveenkumar, actually I have tried with both Vbox and kvm with the same results

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Mar 16, 2018

@ibaboo Can you please uninstall Minishift https://docs.openshift.org/latest/minishift/getting-started/uninstalling.html and try again with minishift start --vm-driver virtualbox

@LalatenduMohanty LalatenduMohanty changed the title cannot login to minishift as admin Cannot login to minishift as admin Mar 16, 2018

@ibaboo

This comment has been minimized.

Copy link

ibaboo commented Mar 20, 2018

I have tried to uninstall and reinstall but now I get the error below. However you can close this issue as minishift is not working for me, I have installed openshift all in one on a VM which is working.

Error: Cannot get TCP port information from Kubernetes host
Caused By:
Error: cannot create container using image openshift/origin:v3.7.1
Caused By:
Error: Error: No such image: openshift/origin:v3.7.1
Error during 'cluster up' execution: Error starting the cluster.

@deepforu47

This comment has been minimized.

Copy link

deepforu47 commented May 1, 2018

Having same issue -

$ minishift start --vm-driver virtualbox

-- Starting profile 'minishift'
-- Checking if https://github.com is reachable (using proxy: "No") ... OK
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... OK
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking if VirtualBox is installed ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting local OpenShift cluster using 'virtualbox' hypervisor ...
-- Starting Minishift VM ........................ OK
-- Checking for IP address ... OK
-- Checking for nameservers ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 8.8.8.8 ... FAIL
   VM is unable to ping external host
-- Checking HTTP connectivity from the VM ...
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 9% used OK
-- OpenShift cluster will be configured with ...
   Version: v3.9.0
Deleted existing OpenShift container
Using Docker shared volumes for OpenShift volumes
Using 192.168.99.101 as the server IP
Starting OpenShift using openshift/origin:v3.9.0 ...
OpenShift server started.

The server is accessible via web console at:
    https://192.168.99.101:8443

Could not set oc CLI context for: 'minishift'
$ minishift version
minishift v1.16.1+d9a86c9
$ oc version
oc v3.9.0+191fece
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth
$ oc login -u system:admin https://192.168.99.101:8443
Authentication required for https://192.168.99.101:8443 (openshift)
Username: system:admin
Password:

--- Update
Previously I was doing the whole process on legacy CMD on windows 10.
Now after uninstalling and installting again using git-bash cmd, its working. Not sure what was the exact issue, but just thought to update.

@gbraad

This comment has been minimized.

Copy link
Member

gbraad commented May 1, 2018

@gbraad

This comment has been minimized.

Copy link
Member

gbraad commented May 1, 2018

@deepforu47

This comment has been minimized.

Copy link

deepforu47 commented May 3, 2018

Everything is working after removing ~/.kube and ~/.minishift folders.
Thank you for the response !

@coolbrg

This comment has been minimized.

Copy link
Member

coolbrg commented May 3, 2018

@ibaboo Can you retry by removing ~/.kube and ~/.minishift folders?

@ibaboo

This comment has been minimized.

Copy link

ibaboo commented May 4, 2018

@budhrg thanks for the tip, however I have removed minishift totally from my laptop.

@gbraad

This comment has been minimized.

Copy link
Member

gbraad commented May 4, 2018

@ibaboo

minishit

was that necessary?

@ibaboo

This comment has been minimized.

Copy link

ibaboo commented May 4, 2018

That was a honest typo , Apologies.

@sandeeptiet

This comment has been minimized.

Copy link

sandeeptiet commented May 30, 2018

I am also facing the same issue, written by ibaboo commented on 9 Mar

@MinSung-TheBest

This comment has been minimized.

Copy link

MinSung-TheBest commented Jun 1, 2018

I also have the same issue...
I removed /.kube and/.minishift... many time
but, the same result...

error: username system:admin is invalid for basic auth

@carbonin

This comment has been minimized.

Copy link

carbonin commented Jun 1, 2018

I'm also seeing this issue:

$ minishift version
minishift v1.18.0+756b128
$ oc version
oc v3.9.0+191fece
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.42.9:8443
openshift v3.9.0+8e3cb9b-8
kubernetes v1.9.1+a0ce1bc657
$ oc login $(minishift ip):8443 -u system:admin
Authentication required for https://192.168.42.9:8443 (openshift)
Username: system:admin
Password: 
error: username system:admin is invalid for basic auth

Is there some alternate way to login as admin? Should I reopen this bug because I'm using a new minishift version?

@carbonin

This comment has been minimized.

Copy link

carbonin commented Jun 1, 2018

I can login as system:admin on version 1.17 so something in 1.18 seems to have broken this.

As per the docs:

To login as administrator, use the system account:

$ oc login -u system:admin
In this case, client certificates are used. The certificates are stored in ~/.kube/config. The cluster up command installs the appropriate certificates as a part of the bootstrap.

I removed my .kube directory and restarted minishift.

Now my ~/.kube/config looks like this:

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://192.168.42.128:8443
  name: 192-168-42-128:8443
contexts:
- context:
    cluster: 192-168-42-128:8443
    namespace: myproject
    user: developer/192-168-42-128:8443
  name: minishift
- context:
    cluster: 192-168-42-128:8443
    namespace: myproject
    user: developer/192-168-42-128:8443
  name: myproject/192-168-42-128:8443/developer
current-context: minishift
kind: Config
preferences: {}
users:
- name: developer/192-168-42-128:8443
  user:
    token: gHnOXLDsTK_AhX1WSsuloUAmj1zI1ardkAclszQ92hQ

Doesn't seem to have any certificates for the admin user.

I also found this comment #741 (comment) on the PR which added the admin-user addon which seems to suggest that we should not be using the system:admin account.

After seeing that, I thought to try the username admin with password admin and that seems to work with minishift version 1.18

So is this a bug or something that needs to be updated in the documentation? If nothing else hopefully this helps the next person to come googling this way 😄

@LalatenduMohanty just pinging you because you happened to write the comment I found. Hope you can help.

@praveenkumar

This comment has been minimized.

Copy link
Contributor

praveenkumar commented Jun 2, 2018

@carbonin you should try to use admin user addon and then you can able to login as admin with password admin

$ minishift addon apply admin-user
@praveenkumar

This comment has been minimized.

Copy link
Contributor

praveenkumar commented Jun 2, 2018

So is this a bug or something that needs to be updated in the documentation? If nothing else hopefully this helps the next person to come googling this way

It's not a bug but we do need to update our documents and possibly add this addon as part of post cluster up directly (need to discuss first).

@fogartyp

This comment has been minimized.

Copy link

fogartyp commented Jun 4, 2018

Thanks, @praveenkumar I was able to login once the addon was installed.

$ minishift addon apply admin-user
-- Applying addon 'admin-user':..

oc login -u admin
Logged into "https://192.168.64.2:8443" as "admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

..................
..................

$ minishift version
minishift v1.18.0+756b128

$oc version
oc v3.9.0+191fece
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth

Server https://192.168.64.2:8443
openshift v3.9.0+ee4d1e7-20
kubernetes v1.9.1+a0ce1bc657
@tkashem

This comment has been minimized.

Copy link

tkashem commented Jun 5, 2018

I used the above workaround minishift addon apply admin-user to get by. But login for system:admin is still an issue, I believe.

This is what I run into when I try to log in as system:admin

$ minishift version
minishift v1.18.0+756b128
$ oc version
oc v3.9.0+191fece
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.42.141:8443
openshift v3.9.0+ee4d1e7-20
kubernetes v1.9.1+a0ce1bc657
$ oc login -u system:admin
Authentication required for https://192.168.42.141:8443 (openshift)
Username: system:admin
Password: 
@aravindhp

This comment has been minimized.

Copy link

aravindhp commented Jun 5, 2018

I am running into this issue too. I see a difference in ~/.kube/config between v1.17.0+f974f0c and v1.18.0+756b128. With v1.17, after doing minishift start, if I check ~/.kube/config I see that it has the following section for users:

users:
- name: developer/192-168-42-166:8443
  user:
    token: YQSovKc82xd61TAIDKsE40r9xLhz0GCgoNH_7G2UMmE
- name: system:admin/127-0-0-1:8443
  user:
    client-certificate-data: <data>
    client-key-data: <data>

If I then delete ~/.kube/ and ~/.minishift/ and try minishift start with v1.18, I see the following in ~/.kube/config:

users:
- name: developer/192-168-42-117:8443
  user:
    token: W0HLMgNMG3uuanznSn3TzcfBhA5PDWy2YO4xAxef9Do

The system:admin user is missing which I think is the cause of the issue. Was this change done on purpose between releases or is it a regression?

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Jun 21, 2018

@dagniel Did you follow work around mentioned in #2107 (comment) ?

@alexellis

This comment has been minimized.

Copy link

alexellis commented Jun 21, 2018

I have a similar issue here:

alexellis-a02:~ alexellis$  minishift addon list
- admin-user	 : enabled	P(0)
- anyuid	 : disabled	P(0)
- registry-route : disabled	P(0)
- xpaas		 : disabled	P(0)
alexellis-a02:~ alexellis$ minishift version
minishift v1.19.0+1750702
alexellis-a02:~ alexellis$  oc login -u admin
Authentication required for https://192.168.99.104:8443 (openshift)
Username: admin
Password: 
alexellis-a02:~ alexellis$ oc login -u system:admin
Authentication required for https://192.168.99.104:8443 (openshift)
Username: system:admin
Password: 
error: username system:admin is invalid for basic auth
alexellis-a02:~ alexellis$ 

Running minishift addon apply admin-user had no effect.

@dagniel

This comment has been minimized.

Copy link

dagniel commented Jun 21, 2018

@LalatenduMohanty I haven't really used the addon feature and your workaround mentions the "addon enable" OR "addon apply" operations.

I've just tested and indeed it works. You first need to enable the admin-user addon, then start the minishift VM and then to apply the addon on the running machine. It didn't work for me as I only ran the enable command.

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Jun 22, 2018

@alexellis Recently we have changed the way we used to provision OpenShift in Minishift hence oc login -u system:admin is breaking (a bug was introduced and we trying to fix it asap). However the admin-user creates a separate admin user which you can login by running oc login -u admin (password is admin). The add-on is will not return error if the admin user already exists. Can you confirm that oc login -u admin works for you?

I guess you are trying out https://blog.openshift.com/openfaas-on-openshift/ and hence you are doing oc login -u system:admin. Just to be clear you can do oc login -u admin and move forward .

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Jun 22, 2018

I've just tested and indeed it works. You first need to enable the admin-user addon, then start the minishift VM and then to apply the addon on the running machine. It didn't work for me as I only ran the enable command.

@dagniel If you enable an add-on before minishift start it automatically runs after the start and you do not have to run apply explicitly. It is similar to systemd commands i.e. if you enable a service after machine start it automatically runs it.

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 22, 2018

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 22, 2018

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 22, 2018

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 23, 2018

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 23, 2018

praveenkumar added a commit to praveenkumar/minishift that referenced this issue Jun 25, 2018

LalatenduMohanty added a commit that referenced this issue Jun 26, 2018

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Jun 26, 2018

Resolved by #2492

@nilarte

This comment has been minimized.

Copy link

nilarte commented Jun 26, 2018

@LalatenduMohanty Great I can see it is fixed . when can we expect to get the latest minishift release (1.20 I suppose) with this fix??

@gbraad

This comment has been minimized.

Copy link
Member

gbraad commented Jun 26, 2018

@LalatenduMohanty

This comment has been minimized.

Copy link
Member

LalatenduMohanty commented Jun 26, 2018

@nilarte Yes, we have done a release as users are facing a lot of issue because of this. It is released as part of https://github.com/minishift/minishift/releases/tag/v1.20.0. cc @gbraad

@nilarte

This comment has been minimized.

Copy link

nilarte commented Jun 26, 2018

Got it and it fixes "oc login -u system:admin"
Thanks!

@alexellis

This comment has been minimized.

Copy link

alexellis commented Jun 29, 2018

@paoloantinori

This comment has been minimized.

Copy link

paoloantinori commented Oct 19, 2018

Hi, I'm hitting this old issue with recent versions. Can I ask someone to verify it works correctly with you?

my versions are:

15:19 $ minishift version
minishift v1.25.0+90fb23e

-- OpenShift cluster will be configured with ...
   Version: v3.11.0

and system:admin cannot log in.

rhnvrm added a commit to rhnvrm/minishift that referenced this issue Oct 23, 2018

@dmitrievav

This comment has been minimized.

Copy link

dmitrievav commented Nov 24, 2018

A workaround is:

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

then paste it to your ~/.kube/config

@coolbrg

This comment has been minimized.

Copy link
Member

coolbrg commented Nov 26, 2018

@paoloantinori , I just verified with new installation of Fedora and Minishift. I am not able to reproduce this issue.

$ minishift version
minishift v1.27.0+707887e

$ minishift start
-- Starting profile 'minishift'
-- Check if deprecated options are used ... OK
[...]
Server Information ...
OpenShift server started.

The server is accessible via web console at:
    https://192.168.42.111:8443/console

You are logged in as:
    User:     developer
    Password: <any value>

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


-- Exporting of OpenShift images is occuring in background process with pid 2555.

$ eval $(minishift oc-env)

$ oc login -u system:admin
Logged into "https://192.168.42.111:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-dns
    kube-proxy
    kube-public
    kube-system
  * myproject
    openshift
    openshift-apiserver
    openshift-controller-manager
    openshift-core-operators
    openshift-infra
    openshift-node
    openshift-service-cert-signer
    openshift-web-console

Using project "myproject".

$ oc whoami
system:admin

Having said that we do have few issues with ~/.kube/config conflicts in previous cases.

If ~/.kube/config is not having important configurations from other Kubernetes project, I would recommend you to delete it and restart.
It should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment