Why i am not getting ip to my created ingress

why i am not getting ip to my created ingress

Hi @yeoleajinkya1

Could you elaborate a bit more on this?

Ingress does not create any IPs. It just routes traffic to a specific backend Service mapped within the Ingress resource. Requests to the various paths defined in the Ingress resource can be made via the Node IP and NodePort Service created by the Ingress Controller.

I have created 2 pod 1 nginx1 and 2 nginx1. To both the pods i have attched svc called nginx1-svc to nginx1 pod , nginx2-svc to nginx2 pod
Then i have created ingress like this

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-ingress
spec:
rules:

  • host: foo.bar.com
    http:
    paths:
    • path: /nginx1
      pathType: Prefix
      backend:
      service:
      name: nginx1-svc
      port:
      number: 80
    • path: /bar
      pathType: Prefix
      backend:
      service:
      name: nginx2-svc
      port:
      number: 80

kubectl get ingress

test-ingress foo.bar.com 80 4m57s

controlplane ~ ➜ curl http://foo.bar.com/nginx1
curl: (6) Could not resolve host: foo.bar.com

does i have to make any changes to my ingress control to make this work

Hi @yeoleajinkya1,

You’re using the domain foo.bar.com, but the terminal says it can’t resolve the host. For local testing, you can add this domain to your hosts file. I recommend reading more about how DNS works.

still facing same issue can u plz help me with this

The domain needs to resolve to the node (if your ingress controller usings a NodePort service) or the loadbalancer that the IC uses. As Raymond rightly points out, this is NOT the function of the ingress resource – it’s how you set up the ingress controller you’re using. You may need to read up a bit about how the ingress system works. If you’re taking one of our Kubernetes courses, this gets covered in one of the two ingress labs.

so how can i deploy ingress controller from kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/cloud/deploy.yaml

and use it in kodekloud labs

Thanks for your help i was able to resolve it
image