rancher: Ingress failed to start

Rancher versions: rancher/server:v2.0.0-beta3 rancher/agent:v2.0.0-beta3

Steps to Reproduce: There is host with 2 network interfaces: NAT (192.168.0.2) and Local (192.168.1.2).

Run rancher/server on local interface: sudo docker run -d --restart=unless-stopped -p 192.168.1.2:80:80 -p 192.168.1.2:443:443 rancher/server:preview

Run rancher/agent on same host: sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/agent:v2.0.0-beta3 --server https://192.168.1.2 --token ... --ca-checksum ... --etcd --controlplane --worker

Results:

> kubectl get all -n ingress-nginx
NAME                          AGE
ds/nginx-ingress-controller   46m

NAME                          AGE
deploy/default-http-backend   46m

NAME                                 AGE
rs/default-http-backend-564b9b6c5b   46m

NAME                                       READY     STATUS             RESTARTS   AGE
po/default-http-backend-564b9b6c5b-72x9h   1/1       Running            0          46m
po/nginx-ingress-controller-5ghlk          0/1       CrashLoopBackOff   13         46m

NAME                       TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
svc/default-http-backend   ClusterIP   10.43.72.107   <none>        80/TCP    46m
> kubectl logs nginx-ingress-controller-5ghlk -n ingress-nginx
-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:    0.10.2-rancher1
  Build:      git-cbfdc533
  Repository: https://github.com/kubernetes/ingress-nginx
-------------------------------------------------------------------------------

F0418 23:55:53.783062       5 main.go:59] Port 80 is already in use. Please check the flag --http-port

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Is this because the Rancher admin itself took port 80?

Stumbled upon same problem. I’ve had port 80 is already in use. Please check the flag --http-port in Nginx pod’s log. I’ve created one-node “cluster” for testing purposes. Just following documentation (https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/). Rancher’s GUI was occupying TCP ports 80 and 443. So Ingress can’t use them. That’s the problematic command:

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

I did docker stop on Rancher container and started it again using different ports. Rancher’s state was not preserved so I have to install the cluster again.

  1. Why would you expect the Rancher state to be preserved if you did not provide it’s docker container with any persistent volume for it?
docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  rancher/rancher:latest

https://rancher.com/docs/rancher/v2.x/en/installation/other-installation-methods/single-node-docker/advanced/#persistent-data

  1. Solution for port 80 is already in use:

In the situation where you want to use a single node to run Rancher and to be able to add the same node to a cluster, you have to adjust the host ports mapped for the rancher/rancher container.

If a node is added to a cluster, it deploys the nginx ingress controller which will use port 80 and 443. This will conflict with the default ports we advise to expose for the rancher/rancher container.

Please note that this setup is not recommended for production use, but can be convenient for development/demo purposes.

To change the host ports mapping, replace the following part -p 80:80 -p 443:443 with -p 8080:80 -p 8443:443

https://rancher.com/docs/rancher/v2.x/en/installation/other-installation-methods/single-node-docker/advanced/#running-rancher-rancher-and-rancher-rancher-agent-on-the-same-node

docker run -d --restart=unless-stopped \
  -p 8080:80 -p 8443:443 \
  rancher/rancher:latest

1 + 2:

docker run -d --restart=unless-stopped \
  -p 8080:80 -p 8443:443 \
  -v /opt/rancher:/var/lib/rancher \
  rancher/rancher:latest

I followed the instructions to deploy a single node cluster (https://rancher.com/docs/rancher/v2.x/en/installation/other-installation-methods/single-node-docker/) and installed the kubernetes cluster via the web ui. The ingress controller is not starting because of the following error

F0527 09:16:13.760184 8 main.go:63] port 80 is already in use. Please check the flag --http-port

Is there any solution to this problem?

Let me know if there is help needed on this.

Stumbled upon same problem. I’ve had port 80 is already in use. Please check the flag --http-port in Nginx pod’s log. I’ve created one-node “cluster” for testing purposes. Just following documentation (https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/). Rancher’s GUI was occupying TCP ports 80 and 443. So Ingress can’t use them. 🤦 That’s the problematic command:

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

I did docker stop on Rancher container and started it again using different ports. Rancher’s state was not preserved so I have to install the cluster again.

F0418 23:55:53.783062       5 main.go:59] Port 80 is already in use. Please check the flag --http-port

Check what is occupying port 80 on the machine using netstat -plant | grep 80 and shut it down.