origin icon indicating copy to clipboard operation
origin copied to clipboard

[oc cluster up] Redirect of web console happen to be https://127.0.0.1:8443/console instead https://<VM_IP>:8443 in case of remote docker daemon.

Open praveenkumar opened this issue 8 years ago • 40 comments

Version
$ ./oc version
oc v3.10.0-alpha.0+617e2c2-1110
kubernetes v1.10.0+b81c8f8
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.42.137:8443
openshift v3.10.0-alpha.0+c5fbe95-1113
kubernetes v1.10.0+b81c8f8
Steps To Reproduce
$ ./minishift start --no-provision --iso-url http://artifacts.ci.centos.org/minishift/minishift-b2d-iso/pr/83/minishift-b2d.iso
[...]
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 0% used OK

$ eval $(./minishift docker-env)
$ ./oc cluster up
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.10 is available ...
Pulling image openshift/origin-control-plane:v3.10
Pulled 1/5 layers, 21% complete
Pulled 2/5 layers, 48% complete
Pulled 3/5 layers, 89% complete
Pulled 4/5 layers, 93% complete
Pulled 5/5 layers, 100% complete
Extracting
Image pull complete
Pulling image openshift/origin-cli:v3.10
Image pull complete
Pulling image openshift/origin-node:v3.10
Pulled 5/6 layers, 84% complete
Pulled 5/6 layers, 95% complete
Pulled 6/6 layers, 100% complete
Extracting
[...]
Adding default OAuthClient redirect URIs ...
Adding centos-imagestreams ...
Adding router ...
Adding sample-templates ...
Adding persistent-volumes ...
Adding web-console ...
Adding registry ...
[...]
Login to server ...
Creating initial project "myproject" ...
Server Information ...
OpenShift server started.

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

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

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

Now open the URI https://192.168.42.137:8443 and accecpt cert.

Current Result

After accepting the cert it redirect to https://127.0.0.1:8443/console instead https://192.168.42.137:8443/console

Expected Result

After accepting the cert it should redirect to https://192.168.42.137:8443/console instead https://127.0.0.1:8443/console

CC @mfojtik

praveenkumar avatar May 14 '18 09:05 praveenkumar

@deads2k i will look at this in afternoon...

mfojtik avatar May 14 '18 11:05 mfojtik

as workaround you can use oc cluster up --public-hostname=<your VM ip adrdress>

Please keep sure that you have export no_proxy variable

export no_proxy=<your VM ip adrdress>

intershopper avatar May 17 '18 07:05 intershopper

The fix was merged to master, closing.

mfojtik avatar May 18 '18 10:05 mfojtik

hi ! do we still need no_proxy or not ? Im seeing this when running openshift-origin-client-tools-v3.10.0-dd10d17-linux-64bit

jayunit100 avatar Sep 18 '18 20:09 jayunit100

This issue seems not resolved. I am using Minishift (which just forwards to oc cluster up) and setting public-hostname to a resolveable name or ip does not fix the problem: http://192.168.200.200:8443 redirects to http://127.0.0.1:8443/console

$ minishift start
-- Starting profile 'minishift'
-- Using proxy for the setup
-- Check if deprecated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.10.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.10.0' is supported ... OK
-- Checking if requested hypervisor 'hyperv' is supported on this platform ... OK
-- Checking if Hyper-V driver is installed ... OK
-- Checking if Hyper-V driver is configured to use a Virtual Switch ...
   'NAT-Switch' ... OK
-- Checking if user is a member of the Hyper-V Administrators group ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting the OpenShift cluster using 'hyperv' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    4 GB
   vCPUs :    2
   Disk size: 20 GB
-- Set the following network settings to VM ...
   Device:      eth0
   IP Address:  192.168.200.200/255.255.255.0
   Gateway:     192.168.200.1
   Nameservers: 10.3.2.100
-- Starting Minishift VM .........................................................................................................................................................-- Setting proxy information ... .OK
 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 ... 1% used OK
   Importing 'openshift/origin:v3.10.0' . CACHE MISS
   Importing 'openshift/origin-docker-registry:v3.10.0' . CACHE MISS
   Importing 'openshift/origin-haproxy-router:v3.10.0' . CACHE MISS
-- OpenShift cluster will be configured with ...
   Version: v3.10.0
-- Pulling the Openshift Container Image ................... OK
-- Copying oc binary from the OpenShift container image to VM ... OK
-- Starting OpenShift cluster ......................................................................................Error during 'cluster up' execution: Error starting the cluster. ssh command error:
command : /var/lib/minishift/bin/oc cluster up --https-proxy <myproxy> --no-proxy localhost,127.0.0.1,172.30.1.1,localhost,192.168.200.200 --public-hostname 192.168.200.200 --base-dir /var/lib/minishift/base --http-proxy <myproxy>
err     : exit status 1
output  : Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.10 is available ...
Pulling image openshift/origin-control-plane:v3.10
Image pull complete
Pulling image openshift/origin-cli:v3.10
Pulled 0/4 layers, 4% complete
Pulled 1/4 layers, 30% complete
Pulled 2/4 layers, 60% complete
Pulled 3/4 layers, 92% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
Pulling image openshift/origin-node:v3.10
Pulled 5/6 layers, 85% complete
Pulled 6/6 layers, 100% complete
Extracting
Image pull complete
Checking type of volume mount ...
Determining server IP ...
Using public hostname IP 192.168.200.200 as the host IP
Checking if OpenShift is already running ...
Checking for supported Docker version (=>1.22) ...
Checking if insecured registry is configured properly in Docker ...
Checking if required ports are available ...
Checking if OpenShift client is configured properly ...
Checking if image openshift/origin-control-plane:v3.10 is available ...
Starting OpenShift using openshift/origin-control-plane:v3.10 ...
I1001 02:14:21.261821    3252 config.go:42] Running "create-master-config"
I1001 02:14:25.869952    3252 config.go:46] Running "create-node-config"
I1001 02:14:27.249242    3252 flags.go:30] Running "create-kubelet-flags"
I1001 02:14:27.955977    3252 run_kubelet.go:48] Running "start-kubelet"
I1001 02:14:28.390010    3252 run_self_hosted.go:172] Waiting for the kube-apiserver to be ready ...
I1001 02:15:23.394847    3252 interface.go:26] Installing "kube-proxy" ...
I1001 02:15:23.395391    3252 interface.go:26] Installing "kube-dns" ...
I1001 02:15:23.395398    3252 interface.go:26] Installing "openshift-apiserver" ...
I1001 02:15:23.395429    3252 apply_template.go:83] Installing "openshift-apiserver"
I1001 02:15:23.396198    3252 apply_template.go:83] Installing "kube-proxy"
I1001 02:15:23.399284    3252 apply_template.go:83] Installing "kube-dns"
I1001 02:15:26.542456    3252 interface.go:41] Finished installing "kube-proxy" "kube-dns" "openshift-apiserver"
I1001 02:16:16.573293    3252 run_self_hosted.go:224] openshift-apiserver available
I1001 02:16:16.573853    3252 interface.go:26] Installing "openshift-controller-manager" ...
I1001 02:16:16.573873    3252 apply_template.go:83] Installing "openshift-controller-manager"
I1001 02:16:19.285942    3252 interface.go:41] Finished installing "openshift-controller-manager"
Adding default OAuthClient redirect URIs ...
Adding sample-templates ...
Adding web-console ...
Adding centos-imagestreams ...
Adding registry ...
Adding router ...
Adding persistent-volumes ...
I1001 02:16:19.305315    3252 interface.go:26] Installing "sample-templates" ...
I1001 02:16:19.305332    3252 interface.go:26] Installing "openshift-web-console-operator" ...
I1001 02:16:19.305342    3252 interface.go:26] Installing "centos-imagestreams" ...
I1001 02:16:19.305348    3252 interface.go:26] Installing "openshift-image-registry" ...
I1001 02:16:19.305357    3252 interface.go:26] Installing "openshift-router" ...
I1001 02:16:19.305367    3252 interface.go:26] Installing "persistent-volumes" ...
I1001 02:16:19.314254    3252 apply_list.go:68] Installing "centos-imagestreams"
I1001 02:16:19.314496    3252 interface.go:26] Installing "sample-templates/mongodb" ...
I1001 02:16:19.314508    3252 interface.go:26] Installing "sample-templates/mariadb" ...
I1001 02:16:19.314517    3252 interface.go:26] Installing "sample-templates/mysql" ...
I1001 02:16:19.314525    3252 interface.go:26] Installing "sample-templates/nodejs quickstart" ...
I1001 02:16:19.314534    3252 interface.go:26] Installing "sample-templates/rails quickstart" ...
I1001 02:16:19.314542    3252 interface.go:26] Installing "sample-templates/jenkins pipeline ephemeral" ...
I1001 02:16:19.314550    3252 interface.go:26] Installing "sample-templates/sample pipeline" ...
I1001 02:16:19.314558    3252 interface.go:26] Installing "sample-templates/postgresql" ...
I1001 02:16:19.314567    3252 interface.go:26] Installing "sample-templates/cakephp quickstart" ...
I1001 02:16:19.314574    3252 interface.go:26] Installing "sample-templates/dancer quickstart" ...
I1001 02:16:19.314583    3252 interface.go:26] Installing "sample-templates/django quickstart" ...
I1001 02:16:19.314648    3252 apply_list.go:68] Installing "sample-templates/django quickstart"
I1001 02:16:19.315569    3252 apply_template.go:83] Installing "openshift-web-console-operator"
I1001 02:16:19.315758    3252 apply_list.go:68] Installing "sample-templates/mongodb"
I1001 02:16:19.315929    3252 apply_list.go:68] Installing "sample-templates/mariadb"
I1001 02:16:19.316157    3252 apply_list.go:68] Installing "sample-templates/mysql"
I1001 02:16:19.316341    3252 apply_list.go:68] Installing "sample-templates/nodejs quickstart"
I1001 02:16:19.316472    3252 apply_list.go:68] Installing "sample-templates/rails quickstart"
I1001 02:16:19.316629    3252 apply_list.go:68] Installing "sample-templates/jenkins pipeline ephemeral"
I1001 02:16:19.316783    3252 apply_list.go:68] Installing "sample-templates/sample pipeline"
I1001 02:16:19.316937    3252 apply_list.go:68] Installing "sample-templates/postgresql"
I1001 02:16:19.317177    3252 apply_list.go:68] Installing "sample-templates/cakephp quickstart"
I1001 02:16:19.317329    3252 apply_list.go:68] Installing "sample-templates/dancer quickstart"
I1001 02:16:34.454000    3252 interface.go:41] Finished installing "sample-templates/mongodb" "sample-templates/mariadb" "sample-templates/mysql" "sample-templates/nodejs quickstart" "sample-templates/rails quickstart" "sample-templates/jenkins pipeline ephemeral" "sample-templates/sample pipeline" "sample-templates/postgresql" "sample-templates/cakephp quickstart" "sample-templates/dancer quickstart" "sample-templates/django quickstart"
E1001 02:21:35.588748    3252 interface.go:34] Failed to install "openshift-web-console-operator": timed out waiting for the condition
I1001 02:21:35.589448    3252 interface.go:41] Finished installing "sample-templates" "openshift-web-console-operator" "centos-imagestreams" "openshift-image-registry" "openshift-router" "persistent-volumes"
Error: timed out waiting for the condition

Minishift cannot startup successfully because it is waiting for the web-console to become availbale, which is caused by the wrong redirect.

lostiniceland avatar Oct 01 '18 06:10 lostiniceland

I'm still seeing this with 3.11. @mfojtik Can you shed some details on how this has been resolved? Is there any option to be added to oc cluster up? I'm using --public-hostname, but still the console redirects to 127.0.0.1. I'm not seeing this with 3.9.

gunnarmorling avatar Oct 23 '18 09:10 gunnarmorling

the "--public-hostname" parameter doesn't work for me too, still redirect to 127.0.0.1.

oc v3.11.0+0cbc58b kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO

yangl avatar Oct 30 '18 02:10 yangl

oc v3.11.0+0cbc58b kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO

Issue persists with a default 'oc cluster up'.

Installed oc in a Fedora VM, trying to access the okd console from my laptop.

Also tried: sudo ./oc cluster up --public-hostname=<VM_IP>

Same issue, still redirects to 127.0.0.1.

assafmuller avatar Oct 30 '18 15:10 assafmuller

FWIW, I worked around this issue for now by setting up a port forwarding localhost to the remote host:

sudo ssh -L 8443:localhost:8443 -f -N user@host

While this unblocks me, it'd be very helpful if this issue was resolved.

gunnarmorling avatar Oct 30 '18 16:10 gunnarmorling

I ran into this today and found a really simple workaround. Going straight to the URL that minishift spits out (https://192.168.42.125:8443) resulted in redirect to https://127.0.0.1:8443/console as described. However, going straight to https://192.168.42.125:8443/console worked!

I.e. just add /console to the URL! I did not do anything extra when starting minishift. It is using KVM and a dynamic IP.

lentzi90 avatar Nov 01 '18 12:11 lentzi90

Hm, this didn't work for me unfortunately; it's still doing a redirect to localhost. Interestingly, once I got beyond that (by means of an SSH port forwarding on my local machine), I then can indeed open the console from another machine without this issue. So I'm sticking to the port forwarding workaround for now.

gunnarmorling avatar Nov 01 '18 20:11 gunnarmorling

Hi @mfojtik, the issue still exists as reported by multiple users. Can you please re-open?

assafmuller avatar Nov 12 '18 19:11 assafmuller

I'm still facing the issue too.

sudo oc cluster up --public-hostname=xx.xx.xx.xx.xip.io --base-dir=/openshift3 --routing-prefix=xx.xx.xx.xx.xip.io

Still makes a redirect to 127.0.0.1 when I try to connect to the 8433

mangelajo avatar Nov 30 '18 10:11 mangelajo

Hi all. The issue can be solved by editing "./openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig". You should replace

"server: https://127.0.0.1:8443"

to your "https://(public-hostname or IP-address):8443" also all "name:", "user:" where is "127-0-0-1:8443" to your dnsname like "openshift-example-com:8443" or IP "192-168-0-254:8443"

ZEvgenZ avatar Nov 30 '18 14:11 ZEvgenZ

I am having the same problem. Using @gunnarmorling's suggestion worked for me. But setting the --public-hostname didn't work for me either.

blakemorgan avatar Dec 06 '18 18:12 blakemorgan

Well I am having the exact same issue

oc v3.11.0+0cbc58b kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443 kubernetes v1.11.0+d4cacc0

entirosadmin avatar Dec 18 '18 14:12 entirosadmin

This issue is still happening for me as well with a CentOS VM using --public-hostname. Is it possible to reopen this issue until a definitive solution is found?

chrrrles avatar Jan 03 '19 06:01 chrrrles

@gunnarmorling I tried sudo ssh -L 8443:localhost:8443 -f -N user@host in my macbook and it worked for me. Now how can I remove the port forwarding rule from my machine?

dipindas avatar Feb 03 '19 05:02 dipindas

You can simply identify the process launched for the forwarding and kill it.

gunnarmorling avatar Feb 03 '19 07:02 gunnarmorling

same behavior with oc cluster up command.

oc cluster up --skip-registry-check=true --public-hostname=10.228.193.136

When I try to access then the ip, I'm redirected to 127.0.0.1.

Sispheor avatar Feb 05 '19 14:02 Sispheor