origin icon indicating copy to clipboard operation
origin copied to clipboard

Unable to login to remote api server after using 'oc cluster up'

Open jcantrill opened this issue 8 years ago • 3 comments

  1. Start cluster 'oc cluster up' on vm
  2. Switch to localhost
  3. Attempt to log into remote server

Host:

$ oc login 192.168.122.89:8443 --loglevel=8 --insecure-skip-tls-verify
I0124 10:46:53.712544   25859 round_trippers.go:383] HEAD https://192.168.122.89:8443/
I0124 10:46:53.712585   25859 round_trippers.go:390] Request Headers:
I0124 10:46:53.731223   25859 round_trippers.go:408] Response Status:  in 18 milliseconds
I0124 10:46:53.731250   25859 round_trippers.go:411] Response Headers:
I0124 10:46:53.731319   25859 round_trippers.go:383] GET https://192.168.122.89:8443/.well-known/oauth-authorization-server
I0124 10:46:53.731327   25859 round_trippers.go:390] Request Headers:
I0124 10:46:53.731335   25859 round_trippers.go:393]     X-Csrf-Token: 1
I0124 10:46:53.741595   25859 round_trippers.go:408] Response Status: 200 OK in 10 milliseconds
I0124 10:46:53.741631   25859 round_trippers.go:411] Response Headers:
I0124 10:46:53.741639   25859 round_trippers.go:414]     Cache-Control: no-store
I0124 10:46:53.741646   25859 round_trippers.go:414]     Content-Type: application/json
I0124 10:46:53.741651   25859 round_trippers.go:414]     Content-Length: 519
I0124 10:46:53.741656   25859 round_trippers.go:414]     Date: Wed, 24 Jan 2018 15:46:53 GMT
I0124 10:46:53.741777   25859 round_trippers.go:383] GET https://127.0.0.1:8443/oauth/authorize?client_id=openshift-challenging-client&code_challenge=7Fz5YjwhSgbSHiqeYqVMIQOvqfmv3hyNi8aj9rPdfeg&code_challenge_method=S256&redirect_uri=https%3A%2F%2F127.0.0.1%3A8443%2Foauth%2Ftoken%2Fimplicit&response_type=code
I0124 10:46:53.741788   25859 round_trippers.go:390] Request Headers:
I0124 10:46:53.741797   25859 round_trippers.go:393]     X-Csrf-Token: 1
I0124 10:46:53.741970   25859 round_trippers.go:408] Response Status:  in 0 milliseconds
I0124 10:46:53.741977   25859 round_trippers.go:411] Response Headers:
error: dial tcp 127.0.0.1:8443: getsockopt: connection refused - verify you have provided the correct host and port and that the server is currently running.
F0124 10:46:53.742009   25859 helpers.go:120] error: dial tcp 127.0.0.1:8443: getsockopt: connection refused

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

VM:

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

Server https://127.0.0.1:8443
openshift v3.7.1+ab0f056
kubernetes v1.7.6+a08f5eeb62

jcantrill avatar Jan 24 '18 15:01 jcantrill

cc @deads2k

jcantrill avatar Jan 24 '18 15:01 jcantrill

So I have good news, good news, and good news. The good news is that I suspect this is proof that our oc login flow properly respects the .well-known endpoint. The next bit of good news is that this is configurable by setting master-config.yaml.oauthConfig.masterPublicURL. The last bit of good news is that the oc cluster up takes the public host as an argument, so you should be able to simply set oc cluster up --public-hostname=your-public-host

deads2k avatar Jan 24 '18 16:01 deads2k

Hello Everyone,

After trying to fix all possible issues like timeouts, EOF, errors, panic and other random problems (I had all of them around 300 fails during oc cluster up) I revert my vm to state before installing of below things and I've done it in correct way I guess because now it works like it should from the beginning (+ I can do oc cluster up/down without stress) :)

PS. It can be also limit 100 pulls of Docker image from Openshift (try docker run hello-world).

sudo apt update && sudo apt upgrade (the most important step !!!)

sudo apt install curl curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update && sudo apt -y install docker-ce

sudo usermod -aG docker XXXX

groups XXXX

wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

cat << EOF | sudo tee /etc/docker/daemon.json { "insecure-registries" : [ "172.30.0.0/16" ] } EOF

sudo systemctl daemon-reload sudo systemctl restart docker

sudo systemctl is-enabled docker sudo systemctl is-active docker

Regards, Artur

turek737 avatar Jun 10 '21 21:06 turek737