https redirect to 127.0.0.1 when using openshift origin web console

5/10/2018

I just installed a new centos server with docker

Client:
 Version:         1.13.1
 API version:     1.26
 Package version: <unknown>
 Go version:      go1.8.3
 Git commit:      774336d/1.13.1
 Built:           Wed Mar  7 17:06:16 2018
 OS/Arch:         linux/amd64


Server:  Version:         1.13.1  API version:     1.26 (minimum
> version 1.12)  Package version: <unknown>  Go version:      go1.8.3 
> Git commit:      774336d/1.13.1  Built:           Wed Mar  7 17:06:16
> 2018  OS/Arch:         linux/amd64  Experimental:    false

And i can use the command oc cluster up to launch a openshift server

oc cluster up --host-data-dir /data --public-hostname master.ouatrahim.com --routing-suffix master.ouatrahim.com

which gives the output

Using nsenter mounter for OpenShift volumes
Using 127.0.0.1 as the server IP
Starting OpenShift using openshift/origin:v3.9.0 ...
OpenShift server started.

The server is accessible via web console at:
    https://master.ouatrahim.com:8443

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

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

And oc version gives the output

oc v3.9.0+ba7faec-1
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
openshift v3.9.0+0e3d24c-14
kubernetes v1.9.1+a0ce1bc657

But when i tried to access to the web console via https://master.ouatrahim.com:8443/ i keep getting a http redirect to 127.0.0.1

https://127.0.0.1:8443/oauth/authorize?client_id=openshift-web-console&response_type=code&state=eyJ0aGVuIjoiLyIsIm5vbmNlIjoiMTUyNTk2NjcwODI1MS0xODg4MTcxMDEyMjU3OTQ1MjM0NjIwNzM5NTQ5ODE0ODk5OTYxMTIxMTI2NDI3ODg3Mjc5MjAwMTgwODI4NTg0MTkyODAxOTA2NTY5NjU2In0&redirect_uri=https%3A%2F%2F127.0.0.1%3A8443%2Fconsole%2Foauth

I hope someone can help me solve this

-- ouatrahim
docker
kubernetes
openshift
openshift-origin

4 Answers

5/27/2019

export no_proxy=your vm ip. It should fix the issue.

It seems they use above variable to access the openshift through proxy. So, even if you configure with --public-hostname it is not working.

-- Selvam Elangovan
Source: StackOverflow

5/11/2020

Below steps solved the issue for me:

1 - oc cluster down

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

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

Open Web Console URL as "https://:8443/console/"

Ref: https://github.com/openshift/origin/issues/19699

-- Yousef Kabbara
Source: StackOverflow

12/13/2018

use oc config view if the server is https://127.0.0.1:8443,please shutdown cluster by oc cluster down and update it(by 'vi /root/.kube/config') your host IP, then use oc cluster up --public-hostname=your host IP

my config:
[root@localhost .kube]# cat config
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.1.7.62:8443
  name: 10-1-7-62:8443
- cluster:
    certificate-authority-data: LStLQo=
    server: https://10.1.7.62:8443
-- SamYuan
Source: StackOverflow

5/11/2018

You can bring up the cluster using your IP address like: oc cluster up --public-hostname=192.168.122.154

This way you should be able to access using https://master.ouatrahim.com:8443/

-- kumar
Source: StackOverflow