Origin: error: a port needed by OpenShift is not available

Created on 21 Mar 2019  路  17Comments  路  Source: openshift/origin

Oc cluster up give error message, port not avaialbe.

Version

RHEL 7.6 (maipo)

oc version

oc v3.11.0+62803d0-1
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://os-m.dev.centevo.no:8443
openshift v3.11.0+92b7c41-132
kubernetes v1.11.0+d4cacc0
Steps To Reproduce

oc cluster up

Current Result
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Checking type of volume mount ...
Determining server 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 ...
error: a port needed by OpenShift is not available
Expected Result

cluster starts

All 17 comments

I second this. Today I got the same issue. We are installing OKD onto our AWS infrastructure using Ansible (only for the deployment).

We got the same issue when we executed oc cluster up.

@Genzer @Steinbjarne We are also getting same error in OKD oc v3.11 while bringing up the cluster. Please suggest if you found some solution for it.

#oc cluster up
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Checking type of volume mount ...
Determining server 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 ...
error: a port needed by OpenShift is not available

Sort of.
My case was that I had some left overs from a previous installation, so some processes and installation procedures are not cleaned up properly. Port 53 was in use and I had to clean it manually.
Still did not help much, looks like it is a bug in oc cluster up

Same here
oc cluster up
Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Checking type of volume mount ...
Determining server 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 ...
error: a port needed by OpenShift is not available

Need to stop running instance of minikube..

Getting a Docker client ...
Checking if image openshift/origin-control-plane:v3.11 is available ...
Creating shared mount directory on the remote host ...
Determining server IP ...
Checking if OpenShift is already running ...
Checking for supported Docker version (=>1.22) ...
Checking if insecured registry is configured properly in Docker ...
Checking prerequisites for port forwarding ...
Checking if required ports are available ...
error: a port needed by OpenShift is not available

I have the same issue on mac. I resolve this by turn on(it was off), and then turn off kubernetes.

image

I guess it's the kube docker process has take the some ports.

I am not clear with the solution. Could you please help me with command to stop kubernetes service in openshift deployment ?

minikube stop. If you are running on local

It's not a minikube setup

I used the tar ball installation of OpenShift, not minikube.

To clean up, I manually deleted all existing openshift configuration and docker containers and -images. Some of the configuration could not be removed because "file in use".
Thus had to reboot server. Restarting services for docker did not help.

After reboot, I deleted images and configuration again, successful this time, and just to make sure, I restarted docker service.

After that, it was possible to install with oc cluster up, but it is just too many bugs in the install so we chose to abandon and wait for 4.0, or install Kubernetes or Docker Swarm instead.

I hit this as well after doing an oc cluster down ... restarting the Docker service seems to fix it pretty quickly.

oc cluster down
systemctl restart docker
systemctl list-units --type=service

Then use systemctl stop to stop service which you think it might be relative to OKD.
Now oc cluster up works

This is an old case, and case is closed. Both last two suggestings were attempted, either dreict or indirect.
Full clean of all containers, restarting docker, tweeking docker, manually removing kubernetes containers, restarting all related services and so on. One of the bugfixes in release after fixed the issues.

In my case, I was using microk8s on my machine, I stopped microk8s service and then tried again and then it worked fine for me.
So, I suppose that

  • first stop k8s service
  • second retry oc cluster up
    hope it helps!

I had shutdown and retried and the process succeeded.

One important thing: I always had problems using Ansible 2.7 to run the playbook of v3.11 tag. Using Ansible 2.6.5 guaranteed the playbook successful.

I didn't have minikube enabled, but I did have microk8s installed too. Stopped microk8s and oc cluster up worked.

make sure that kubelet.service is not running while starting up oc cluster

Was this page helpful?
0 / 5 - 0 ratings