Ingress-nginx: official deployment encouters error " main.go:72] Port 80 is already in use. Please check the flag --http-port"

Created on 16 Jul 2018  路  7Comments  路  Source: kubernetes/ingress-nginx

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):
yes

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):

main.go:72] Port 80 is already in use. Please check the flag --http-port

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG

NGINX Ingress controller version:
0.16.2

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:55:54Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration:
    bare mental
  • OS (e.g. from /etc/os-release):
    NAME="Ubuntu"
    VERSION="14.04, Trusty Tahr"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 14.04 LTS"
    VERSION_ID="14.04"
    HOME_URL="http://www.ubuntu.com/"
    SUPPORT_URL="http://help.ubuntu.com/"
    BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
  • Kernel (e.g. uname -a):
    Linux ubuntu 3.13.0-145-generic #194-Ubuntu SMP Thu Apr 5 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:
  • Others:

What happened:
following the official deployment script: https://kubernetes.github.io/ingress-nginx/deploy/ , the pod nginx-ingress-controller fails with error log: main.go:72] Port 80 is already in use. Please check the flag --http-port.

What you expected to happen:
follows the official deployment script and everything will be ok as deployment script says.

How to reproduce it (as minimally and precisely as possible):

  1. kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
  2. then, kubectl get po --all-namespaces will see the nginx-ingress-controller pod get error:
NAMESPACE       NAME                                        READY     STATUS    RESTARTS   AGE
ingress-nginx   default-http-backend-5c6d95c48-bkh9s        1/1       Running   0          57s
ingress-nginx   nginx-ingress-controller-6c9fcdf8d9-g9dv8   0/1       Error     3          58s
  1. print logs kubectl logs nginx-ingress-controller-6c9fcdf8d9-g9dv8 -n ingress-nginx, will get:
NGINX Ingress controller
  Release:    0.16.2
  Build:      git-26eacf4
  Repository: https://github.com/kubernetes/ingress-nginx
-------------------------------------------------------------------------------

F0716 03:41:16.938194       7 main.go:72] Port 80 is already in use. Please check the flag --http-port

Anything else we need to know:

Most helpful comment

@Hugh-ifly Just ran into the same issue. Actually you need to set the securityContext to start the container as root:

securityContext:
  runAsUser: 0

I鈥檓 pretty sure the recent image already sets the user to www-data in the metadata so this is needed to override it.

All 7 comments

@Hugh-ifly please check the docker info output and report the value of Storage Driver

@aledbf docker info:

Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 749
 Dirperm1 Supported: false

Closing. Duplicate of #2781
As a workaround, please use custom http and https ports or remove the securityContext section from the ingress controller deployment

ok. I removed the securityContext section from the ingress controller deployment, however, the error remained the same.

@Hugh-ifly Just ran into the same issue. Actually you need to set the securityContext to start the container as root:

securityContext:
  runAsUser: 0

I鈥檓 pretty sure the recent image already sets the user to www-data in the metadata so this is needed to override it.

@Hugh-ifly Just ran into the same issue. Actually you need to _set_ the securityContext to start the container as root:

securityContext:
  runAsUser: 0

I鈥檓 pretty sure the recent image already sets the user to www-data in the metadata so this is needed to override it.

I do this like you said, but I got a new error

NGINX Ingress controller
Release: 0.16.2-rancher1
Build: d36d4cc
Repository: [email protected]:rancher/ingress-nginx.git
-------------------------------------------------------------------------------
nginx version: nginx/1.13.12
W0117 06:44:25.704695 11 client_config.go:533] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I0117 06:44:25.705076 11 main.go:183] Creating API client for https://10.43.0.1:443
I0117 06:44:25.713593 11 main.go:227] Running in Kubernetes cluster version v1.11 (v1.11.6) - git (clean) commit b1d75deca493a24a2f87eb1efde1a569e52fc8d9 - platform linux/amd64
I0117 06:44:25.716563 11 main.go:100] Validated ingress-nginx/default-http-backend as the default backend.
F0117 06:44:25.963961 11 main.go:113] Error generating self-signed certificate: could not create temp pem file /etc/ingress-controller/ssl/default-fake-certificate.pem: open /etc/ingress-controller/ssl/default-fake-certificate.pem524809852: permission denied

why all related issues were closed with no real reason explained?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boazj picture boazj  路  3Comments

sophaskins picture sophaskins  路  3Comments

jwfang picture jwfang  路  3Comments

kfox1111 picture kfox1111  路  3Comments

cxj110 picture cxj110  路  3Comments