'App deployed but not working with Ingress Kubernetes

I am trying to deploy the .Net app using the Kubernetes using docker desktop.I want to run the app using the ingress. I use the below yaml file. When u create the deployment everything created successfully and everything created deployment,service, ingress but app is not opening on browser.

Note: when i bypass the ingress and only use service , my applications works fine with service but not working with ingress.Need help on it.

apiVersion: apps/v1 kind: Deployment metadata: name: netapp spec: selector: matchLabels: app: netapp template: metadata: labels: app: netapp spec: containers: - name: netapp image: dockerId/Imagename:latest imagePullPolicy: IfNotPresent ports: - containerPort: 80 protocol: TCP resources: limits: memory: 512Mi cpu: "1" requests: memory: 256Mi cpu: "0.2"

apiVersion: v1 kind: Service metadata: name: netapp spec: ports: - port: 6789 protocol: TCP targetPort: 80 selector: app: netapp-pod type: NodePort


apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: netapp annotations: kubernetes.io/ingress.class: nginx spec: rules: - host: localhost http:
paths: - path: / pathType: Prefix backend: service: name: netapp port: number: 6789



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source