origin icon indicating copy to clipboard operation
origin copied to clipboard

Access fail with 'oc cluster up --public-hostname=<public ip>' and redirect to 127.0.0.1

Open cxyfreedom opened this issue 8 years ago • 28 comments

Version

oc v3.10.0+dd10d17

Steps To Reproduce

oc cluster up --public-hostname=''

Current Result
oc v3.10.0+dd10d17
kubernetes v1.10.0+b81c8f8
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
openshift v3.10.0+a5e4ac9-10
kubernetes v1.10.0+b81c8f8

When I access https://<public ip>:8443,redirecting the address https://127.0.0.1:8443.

Expected Result

When I access https://<public ip>:8443, I could access normaly.

cxyfreedom avatar Aug 22 '18 10:08 cxyfreedom

Here is a quick workaround until this gets sorted out:

fgrep -RIl 127.0.0.1:8443 openshift.local.clusterup/ | xargs sed -i 's/127.0.0.1:8443/$PUBLIC_IP:8443/g'

jdoss avatar Aug 26 '18 14:08 jdoss

@openshift/sig-master

jwforres avatar Oct 01 '18 18:10 jwforres

if you curl the URL are you getting redirected? or is it the web console getting incorrectly set up and redirecting to the wrong oauth URL?

cc @spadgett

jwforres avatar Oct 01 '18 18:10 jwforres

The same here, configmaps/webconsole-config got improperly rendered with '127.0.0.1' although I'm using 'oc cluster up --public-hostname=192.168.1.14'

[stirabos@openshift ~]$ 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":""},"features":{"inactivityTimeoutMinutes":0,"clusterResourceOverridesEnabled":false},"extensions":{"scriptURLs":[],"stylesheetURLs":[],"properties":null}}
kind: ConfigMap
metadata:
  creationTimestamp: 2018-10-03T08:06:54Z
  name: webconsole-config
  namespace: openshift-web-console
  resourceVersion: "6232"
  selfLink: /api/v1/namespaces/openshift-web-console/configmaps/webconsole-config
  uid: 4a97e3de-c6e3-11e8-a889-001a4a160152

tiraboschi avatar Oct 03 '18 09:10 tiraboschi

It seams a kind of leftover from a previous attempt, if I delete the whole ~/openshift.local.clusterup and retry it works as expected. Reproduction step: oc cluster up oc cluster down oc cluster up --public-hostname=<pubilc_hostname>

tiraboschi avatar Oct 03 '18 09:10 tiraboschi

I had the same problem, I used the work around provided by jdoss and this resolved the redirect issue fgrep -RIl 127.0.0.1:8443 openshift.local.clusterup/ | xargs sed -i 's/127.0.0.1:8443/$PUBLIC_IP:8443/g'

you don't need to restart openshift after you do this which I did the first time.

Will this get fixed in an updated version

mandibuswell avatar Oct 19 '18 03:10 mandibuswell

Error is still here

oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO
Unable to connect to the server: x509: certificate signed by unknown authority

Asgoret avatar Dec 24 '18 11:12 Asgoret

Issue still present. Working on:

[root@localhost ~]# hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: e0f9f4d274fa4ef2b4e2b1670dafa645
           Boot ID: ef53e7fd0e984ea198d4878310678bc8
    Virtualization: microsoft
  Operating System: Fedora 29.20181210.0 (Atomic Host)
       CPE OS Name: cpe:/o:fedoraproject:fedora:29
            Kernel: Linux 4.19.6-300.fc29.x86_64
      Architecture: x86-64

After:

oc cluster up --public-hostname='okd'

web console is still bound to 127.0.0.1 (https://okd:8443 is redirected to https://127.0.0.1:8443):

[root@localhost ~]# oc version
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

After launching:

fgrep -RIl 127.0.0.1:8443 openshift.local.clusterup/ | xargs sed -i 's/127.0.0.1:8443/okd:8443/g'

web console remains bound to 127.0.0.1 (instead of okd):

[root@localhost ~]# oc version
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

https://okd:8443 still gets redirected to https://127.0.0.1:8443

Any hint?

ctliv avatar Jan 27 '19 12:01 ctliv

Hello,

Yes, this does happen if you first start it up as a local cluster - and then realise you need to access it via a Private / Public IP Address.

To fix it, delete the directory: openshift.local.clusterup or even better, delete the entire top level directory openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.

Then run tar -zxvf openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz again.

And start up the cluster using: oc cluster up --public-hostname=<Public IP>

You should now be able to access it via: https://<Public IP>:8443/console

jinalshah avatar Feb 26 '19 14:02 jinalshah

Thanks, @jinalshah .

Going to https://<Public IP>:8443/console now works.

Though https://<Public IP>:8443/ is still redirected to https://127.0.0.1:8443/console

So, somehow it's the /console that matters.

ctliv avatar Mar 02 '19 15:03 ctliv

It seams a kind of leftover from a previous attempt, if I delete the whole ~/openshift.local.clusterup and retry it works as expected. Reproduction step: oc cluster up oc cluster down oc cluster up --public-hostname=<pubilc_hostname>

This fixed my cluster (fresh install on centos 7).

Previously I tried to modify the yaml files on openshift.local.clusterup with references to 127.0.0.1:8443 and it fixed the situation too (I think I had to modify some filters related with CORS, but not sure if this impacted into the expected result).

avisiedo avatar May 17 '19 18:05 avisiedo

  1. oc cluster down
  2. reboot the host
  3. rm -rf openshift.local.clusterup
  4. rm -rf .kube/
  5. oc cluster up --public-hostname=10.71.33.193
  6. oc cluster status
  7. https://10.71.33.193:8443/console/

jainthomas87 avatar Jun 03 '19 00:06 jainthomas87

Having same issue. starting cluster with oc cluster up --image 'openshift/origin-${component}:v3.11.0' --public-hostname x.x.x.x --routing-suffix x.x.x.x.nip.io

image

[vchepeli@localhost ~]$ hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 1201eac5de174a66880138fd864f910b
           Boot ID: 596ab33d6a8b460d9e71989b08701916
    Virtualization: microsoft
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.21.3.el7.x86_64
      Architecture: x86-64

ghost avatar Jun 21 '19 08:06 ghost

Same here. The issue is still not solved. It seems to work if I use "public-hostname" right from the start and explicitly navigate to "…:8443/console" but further links take me back to 127.0.0.1.

This is a Debian 9 system with Docker 18.09.6 using the openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz release file.

Very annoying. I have spent countless hours trying various proposed fixes but am now very close to giving up.

Signum avatar Jun 21 '19 12:06 Signum

Hi those workaround does not work... Any update?

Running on redhat 7.6, docker version 18.09.6 using the openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz release file.

DanielChuDC avatar Jul 19 '19 09:07 DanielChuDC

Hi all, in the end, I access the console successful though https:/:8443/console/.

Even after you have run oc cluster up --public-hostname=<server-ip> --routing-suffix=<server-ip>.nip.io, you will need to access link as https:/:8443/console/ and not https:/:8443.

The default route https:/:8443/ will still bring you to 127.0.0.1.

The route https:/:8443/console/ will bring you to the dashboard.

DanielChuDC avatar Jul 19 '19 09:07 DanielChuDC

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Oct 17 '19 14:10 openshift-bot

/remove-lifecycle stale

gaurs avatar Oct 30 '19 14:10 gaurs

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Apr 16 '20 19:04 openshift-bot

/remove-lifecycle stale

Still occuring in oc v3.11.0+0cbc58b with --public-hostname set.

ghost avatar May 04 '20 20:05 ghost