Origin: [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.

Created on 14 May 2018  路  38Comments  路  Source: openshift/origin

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

kinbug

Most helpful comment

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.

All 38 comments

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

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>

The fix was merged to master, closing.

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

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.

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.

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

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=

Same issue, still redirects to 127.0.0.1.

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.

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.

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.

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

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

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"

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

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

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?

@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?

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

>

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.

I'm running into the same issue with OpenShift 3.11.0. The only way to use the web console and the default routes created by OpenShift is to use the SSH local port forwarding suggested by @gunnarmorling.

sudo ssh -L 80:localhost:80 -L 8443:localhost:8443 -f -N -i ~/.ssh/openshift.key [email protected]

I can see the WebConsole configuration is not honoring the public hostname. See the consolePublicURL and the masterPublicURL parameters in the following configuration map of Kubernetes

$ oc get cm webconsole-config -n openshift-web-console -o yaml
apiVersion: v1
data:
  webconsole-config.yaml: |
    {"kind":"WebConsoleConfiguration","apiVersion":"webconsole.config.openshift.io/v1","servingInfo":{"bindAddress":"0.0.0.0:8443","bindNetwork":"tcp4","certFile":"/var/serving-cert/tls.crt","keyFile":"/var/serving-cert/tls.key","clientCA":"","namedCertificates":null,"maxRequestsInFlight":0,"requestTimeoutSeconds":0},"clusterInfo":{"consolePublicURL":"https://127.0.0.1:8443/console/","masterPublicURL":"https://127.0.0.1:8443","loggingPublicURL":"","metricsPublicURL":"","logoutPublicURL":"","adminConsolePublicURL":""},"features":{"inactivityTimeoutMinutes":0,"clusterResourceOverridesEnabled":false},"extensions":{"scriptURLs":[],"stylesheetURLs":[],"properties":null}}
kind: ConfigMap
metadata:
  creationTimestamp: 2019-02-18T19:38:41Z
  name: webconsole-config
  namespace: openshift-web-console
  resourceVersion: "6717"
  selfLink: /api/v1/namespaces/openshift-web-console/configmaps/webconsole-config
  uid: cbc3f5ef-33b4-11e9-9a9a-0a6564de94c8

Should'nt this issue be reopened ? Or are we all missing something ?

Should'nt this issue be reopened ? Or are we all missing something ?

Yes, it should. This issue is not fixed on the latest version, as evident by so many people complaining about it.

Same problem without any solution yet....

neither that
oc cluster up --public-hostname=192.168.2.20 --skip-registry-check=true

nor
the changes in "./openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig" have solved the problem, I'm getting always forwarded to 127.0.0.1....

It sucks because it was mylast resort since I can't use minishift or vagrant... :(

It sucks because it was mylast resort since I can't use minishift or vagrant... :(

@tux1980 Do you hit a limitation for using the minishift or any some other reason?

@praveenkumar No I don't hit any technical barriers and obstacles. It is just that minishift or cluster up in the context with VAGRANT, you are have to use and rely on a hyper Visor as KVM or Virtualbox and since I'm using one ESXi host in V 6.7 to virtualize my environment I can't install Virtualbox on top ot that, so therefore I depend on oc cluster up with docker to avoid of using any other kind of hypervisor:(.

Created a temporary solution and installed a X-Server on my client system. With using putty and xming I can now redirect the openshift server to my local client, so I can work with localhost/127.0.0.1 by using Chrome "remote.... It's not optimal, but it works as kinda workaround....

@tux1980 have a look to https://docs.okd.io/latest/minishift/using/run-against-an-existing-machine.html you might able to use minishift to provision an existing machine without using any virtual layer per say.

@praveenkumar Thanks for giving me this hunch and advise, I will give it a try either....

20726 worked for me too.

Once I removed the openshift.local.clusterup folder, I re-ran:

oc cluster up --routing-suffix=192.168.2.20.xip.io --public-hostname=192.168.2.20

Works for me on Ubuntu 18 bionic as well

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.

Hi, just a notion. This will work only if you forward the remote port to the same local port.
For example,
'sudo ssh -L 8443:localhost:8443 -f -N user@host' works, but
'sudo ssh -L 1443:localhost:8443 -f -N user@host' doesnt work

same problem here, nedd a fix please 猫.猫 it's not very clean sshing into my instance

Running below steps resolved this redirecting problem

1) oc cluster down

2) mv openshift.local.clusterup to /tmp
or
rm -r openshift.local.clusterup

3) oc cluster up --public-hostname=10.10.72.140 --routing-suffix=10.10.72.140.xip.io

4) Open Web Console URL as "https://10.10.72.140:8443/console/"

I had to delete the folder and also set no_proxy=my_vm_ip

I had to delete the folder and also set no_proxy=my_vm_ip

@MaheshZ thanks that worked for me.

Running below steps resolved this redirecting problem

  1. oc cluster down
  2. mv openshift.local.clusterup to /tmp
    or
    rm -r openshift.local.clusterup
  3. oc cluster up --public-hostname=10.10.72.140 --routing-suffix=10.10.72.140.xip.io
  4. Open Web Console URL as "https://10.10.72.140:8443/console/"

Thanks!!! It did not work for me without a slash at the end of the web console URL i.e. https://10.10.72.140:8443/console did not work; https://10.10.72.140:8443/console/ did.

Was this page helpful?
0 / 5 - 0 ratings