Hello! I'm trying to create an ingress resource in lighting lab 2, but my answer . . .

Codruta Pasla:
Hello! I’m trying to create an ingress resource in lighting lab 2, but my answer seems to be incorrect. I think the problem is that I’m not adding these lines:

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

I don’t understand why I should add them. Could someone explain it to me, please?

Codruta Pasla:
Oh, and another thing that I don’t understand…why is the port of the ingress controller mentioned here?
"Here 30093 is the port used by the Ingress Controller "

Trung Tran:
Hi @Codruta Pasla

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

=> whatever in the path will be rewrite to / in the application
Let say you have /video routed to VIDEO service, but it doesn’t mean that the VIDEO service/application itself has the /video path, so we need to rewrite it otherwise video app will return 404.

Trung Tran:
Without this rewrite config, the path will be pass into the backend application, and either this application need to have this /path available, or it will be 404.

Trung Tran:
Hope it clear.

Codruta Pasla:
Will this annotation be always set? Should I always use this nginx annotation or it depends on the controller type?

Trung Tran:
It depend on your need and the controller type also, this is nginx ingress controller syntax. If you use different ingress controller, syntax will be different or it may not support this feature.
This annotation is not mandatory, you can have it in your ingress or not depend on the behavior you want.
We need it in case of path based.
hostname/path1 -&gt; service1
If you use host based (sub-domain per service) for routing, we dont need it.
path1.hostname -&gt; service 1
IMO

Codruta Pasla:
Ok, thank you

Alistair Mackay:
You may also need this annotation, if you browse to the endpoint given in the lab and your browser gives you a too many redirects error

<http://nginx.ingress.kubernetes.io/ssl-redirect|nginx.ingress.kubernetes.io/ssl-redirect>: "false"

because the ingress is not serving on 443