ingress-nginx: Can not visit my service running on kubernetes cluster by ingress

**Describe **

I try to visit my service running on kubernetes cluster by ingress,but faill

tell me why please, thanks

To Reproduce cat faskapp-deployment.yaml `

apiVersion: apps/v1
kind: Deployment
metadata:
  name: flaskapp-1
spec:
  selector:
    matchLabels:
      run: flaskapp-1
  replicas: 1
  template:
    metadata:
      labels:
        run: flaskapp-1
    spec:
      containers:
      - name: flaskapp-1
        image: jcdemo/flaskapp
        ports:
        - containerPort: 5000

`

cat faskapp-service.yaml


apiVersion: v1
kind: Service
metadata:
  name: flaskapp-1
  labels:
    run: flaskapp-1
spec:
  ports:
  - port: 5000
    name: web
    targetPort: 5000 
  selector:
    run: flaskapp-1

cat faskapp-ingress.yaml

`

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: faskapp-ingress
  #kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: mydemo.com     
    http:
      paths:
      - path: /
        backend:
          serviceName: flaskapp-1  
          servicePort: 5000 

kubectl describe ingress

Name:             faskapp-ingress
Namespace:        default
Address:          192.168.161.121
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host        Path  Backends
  ----        ----  --------
  mydemo.com  
              /   flaskapp-1:5000   10.244.97.193:5000)
Annotations:  <none>
Events:
  Type    Reason  Age                    From                      Message
  ----    ------  ----                   ----                      -------
  Normal  Sync    2m14s (x2 over 2m25s)  nginx-ingress-controller  Scheduled for sync

My environment kubernetes version : v1.19.0 ingress-nginx version : v0.41.0

-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v0.41.0
  Build:         f3a6b809bd4bb6608266b35cf5b8423bf107d7bc
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.4
-------------------------------------------------------------------------------

Expected behavior I want to visit my service through domain name ’ mydemo.com’ ,domain name resolution is ok

Additional context the envirnoment is fine, and I have tried to visit my service by “NodePort Type” , it work

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 77 (21 by maintainers)

Most upvoted comments

hi, Accessing your app through a ingress resource that is managed by ingress-nginx-controller is documented here https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/ and is discussed daily at kubernetes.slack.com in the ingress-nginx-users channel. The usual problems range from firewalled port or ipaddress or misconfigurations.

Creating a issue here just for not being able to connect is a slow and less useful way to resolve this problem.

I suggest you close this issue and come to kubernetes.slack.com in the channel ingress-nginx-users. There are a lot of developers and engineers there so there is many chances of more people looking at your messages and helping you out.

extremely funny so many people facing this issue and no any proper answer has been added.

image

I am still facing this issue. Did anyone find the solution to this minikube version: v1.23.2

Any Update on issue … We are also facing same

1.22.* be sure you have:

spec:
  ingressClassName: nginx

Experiencing this also. Clean kubernetes install with baremetal style install of ingress. I have not setup a loadbalancer such as metallb, maybe that will help? Interesting how it is saying “Scheduled for sync” and just hanging there.

Update: Installing metallb & then there was a controller service that had to be updated that needed a loadbalancer ip, then redid my deployment/service/ingress and it worked.

We are having similar issue and it seems to be cause by different ingresses using same host name. Maybe check whether you have a duplicate ingress resource defined in other namespace.

Just in my case. I got a similar issue on AKS 1.24. I guess it is a side effect of https://github.com/kubernetes/ingress-nginx/issues/9601 . The issue here is fixed after adding an annotation to svc/ingress-nginx-controller.

It may be caused by health probes between a load-balancer and svc/ingress-nginx-controller

Hi, The questions you are posting are more support related and less of a possible bug or problem in the controller, based on the data provided.

A better solution is to come talk about this on kubernetes.slack.com. You can register at slack.k8s.io if required a new login. There are more engineers, developers and experienced professionals on slack and talking in the ingress-nginx-users channel on slack will have a wider reach.

For the actual info, you can look at kubectl get events as well the logs of the ingress-controller pod.

Thanks.