Hello, In the Ingress Lab sessions I realized that the Ingress Resource config f . . .

Santosh:
hello, In the Ingress Lab sessions I realized that the Ingress Resource config files (as below) does not have any “selectors” field that’d tie it back to the Ingress Controller which will serve the applications as defined in the Ingress file. So how does an Ingress Resource and Ingress Controller tie back to each other? Thanks

apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target: /
http://nginx.ingress.kubernetes.io/ssl-redirect|nginx.ingress.kubernetes.io/ssl-redirect: “false”
creationTimestamp: “2022-07-04T17:27:48Z”
generation: 6
name: ingress-wear-watch
namespace: app-space
resourceVersion: “4365”
uid: 4ce40bd3-54fd-4fb7-b058-4ecfe60d5f9a
spec:
rules:

  • http:
    paths:
    • backend:
      service:
      name: wear-service
      port:
      number: 8080
      path: /wear
      pathType: Prefix

uday bhanu dutta:
Hi @Santosh - In Ingress resource, specify an IngressClass for an Ingress resource. This IngressClass will be the name of the Ingress controller. If you don’t specify then Kubernetes applies the cluster’s default IngressClass to the Ingress resource.

unnivkn:
Hi @Santosh fyr: https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/

Mustafa:
This is also not clear for me. If you solved the issue in killer coda, we must specify the ingress controller in particular namespace but how de we know when to use default or spesicific one ? I was not specifying anything in KodeKloud ingress test.

Santosh:
hI @uday bhanu dutta Can you please provide me a sample block of yml file for that ingressClass with lets say an ingressclass Name = “nginx-test-ingress”. thanks

Santosh:
@uday bhanu dutta is this what you think it is:

ingress-nginx IngressClass

apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1
kind: IngressClass
metadata:
name: internal-nginx
spec:
controller: http://k8s.io/internal-ingress-nginx|k8s.io/internal-ingress-nginx

uday bhanu dutta:
Hi @Santosh Please find following -

uday bhanu dutta:
apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1

kind: Ingress

metadata:

name: minimal-ingress

annotations:

<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /

spec:

ingressClassName: nginx

rules:

  • http:

    paths:

    • path: /testpath

      pathType: Prefix

      backend:

      service:

      name: test
      
      port:
      
        number: 80
      

uday bhanu dutta:
This will be true if you have deployed nginx ingress controller. If you deploy any other ingress controller then that name should be mentioned in “ingressClassName”

unnivkn:
Hi @Santosh and @Mustafa please refer below, the relationship between Ingress Controller–>IngressClass & Ingress Object