Ingress-nginx: 404 Default Backend when creating an ingress in a non default namespace

Created on 11 Nov 2018  路  8Comments  路  Source: kubernetes/ingress-nginx

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

Not sure this is a bug or I am doing smth wrong. Steps to reproduce:

  1. Generate a self-signed cert for example.com
  2. Edit /etc/hosts so that minikube ip points to example.com
  3. Create a tls secret
  4. kubectl create namespace test
  5. kubectl run nginx --image nginx -n=test
  6. kubectl expose deployment nginx --port 80 -n=test
  7. kubectl apply -f ingress.yaml -n=test
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-test
spec:
  tls:
  - hosts:
    - example.com
    secretName: self-signed
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: nginx
          servicePort: 80

If I open example.com in a browser, I see 404 default backend. However, if run kubectl apply -f ingress.yaml -n=default I can see nginx welcome page and I can seethe cert used to create tls secret:

image

So, somehow it works for me only if an ingress is created in a default namespace AND in a target namespace.

Can someone help me figure out what I am doing wrong here?

NGINX Ingress controller version:

quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.16.2

Kubernetes version (use kubectl version):

eugene@ivantsoft ~/Documents/tls/examplecom $ kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.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:

Minikube on Fedora 28

Most helpful comment

@aledbf please take a look at this short video. It actually shows in what namespaces service and ingress are:

https://www.youtube.com/watch?v=DE5hDs4O1to

This video is no longer available and I'm facing the same issue.. Any idea what this video was all about? Sorry for commenting on an older issue.

All 8 comments

Closing. The 404 is because the Ingress is not being defined in the same namespace than the service.

@aledbf But I definite both in test namespace.

Besides, when an ingress cannot find backend service, it's 503 not 404

@aledbf please take a look at this short video. It actually shows in what namespaces service and ingress are:

https://www.youtube.com/watch?v=DE5hDs4O1to

@eivantsov from the video I see the secret only exists in the default namespace https://youtu.be/DE5hDs4O1to?t=14
You need to copy the secret to the test namespace too

@aledbf thanks, just tried that - no luck. I still see default backend 404.

Update. Sorry, my bad. It did work. Thanks.

@aledbf please take a look at this short video. It actually shows in what namespaces service and ingress are:

https://www.youtube.com/watch?v=DE5hDs4O1to

This video is no longer available and I'm facing the same issue.. Any idea what this video was all about? Sorry for commenting on an older issue.

Indeed I would like to see what the video was about, I'm facing the same problem currently

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bashofmann picture bashofmann  路  3Comments

kfox1111 picture kfox1111  路  3Comments

smeruelo picture smeruelo  路  3Comments

cehoffman picture cehoffman  路  3Comments

jwfang picture jwfang  路  3Comments