Can't access OpenShift console on http://ip:8443

lvthillo picture lvthillo · Sep 10, 2015 · Viewed 7.6k times · Source

I've installed OpenShift Version 3 on CentOS7. I followed the official documentation: https://docs.openshift.org/latest/admin_guide/install/prerequisites.html#configuring-docker-storage

method 1 (Docker): https://docs.openshift.org/latest/getting_started/administrators.html#installation-methods

I chose to install OpenShift in a Docker Container. The last commmand I had to do was this one: I'm launching the server in a Docker container using images from Docker Hub.:

$ docker run -d --name "openshift-origin" --net=host --privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/openshift:/tmp/openshift \
openshift/origin start

This command:

  • starts OpenShift listening on all interfaces (0.0.0.0:8443),

  • starts the web console listening on all interfaces (0.0.0.0:8443),

  • launches an etcd server to store persistent data, and

  • launches the Kubernetes system components.

    $ sudo docker ps
    
    CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS               NAMES
    
    d3f023085328        openshift/origin    "/usr/bin/openshift    2 days ago          Up 2 days                               openshift-origin
    

Now I was able to do:

$ sudo docker exec -it openshift-origin bash

So I can access openshift in my container. I can create projects and apps but the building-state is always pending. I'm not able to visit https://publicip:8443/console. Someone who can help me? The OpenShift-page loads for a second (when i'm going http://publicip:8443) but than I get a redirect_url to 10.0.0.x:8443. My master-config looks like this: https://github.com/openshift/origin/blob/master/test/old-start-configs/v1.0.0/config/openshift.local.config/master/master-config.yaml. What do I have to change?

url: https://10.0.0.x:8443/oauth/authorize?client_id=openshift-web-console&response_type=token&state=%2F&redirect_uri=https%3A%2F%2F10.0.0.x%3A8443%2Fconsole%2Foauth

EDIT:

docker run -d --name "origin" \
        --privileged --pid=host --net=host \
        -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys -v /var/lib/docker:/var/lib/docker:rw \
        -v /var/lib/origin/openshift.local.volumes:/var/lib/origin/openshift.local.volumes \
        openshift/origin start

Answer

Emil Salageanu picture Emil Salageanu · Oct 28, 2015

Maybe I am wrong, but in order to be able to connect to the container on port 8443 using the host's ip, you need to publish this port on the host. This can be done in the docker run command by adding the argument -p 8443:8443

See https://docs.docker.com/reference/commandline/run/