I was reading about ingress controller and ingress resource to route the incoming request to Kubernetes cluster to specific service.
Ingress resource file will be similar to:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-myservicea
spec:
rules:
- host: myservicea.foo.org
http:
paths:
- path: /v1/myapp/health
pathType: Prefix
backend:
service:
name: myservice
port:
number: 80
ingressClassName: nginx
My understanding from above ingress is, all incoming request(url like: https://myservicea.foo.org/v1/myapp/health) to ingress controller will be redirected to the service "myservice" on port 80. No matter request is coming from which domain(app, client, host, IP or localhost).
Here my question is, How can we add rules in ingress resource to specify, request coming from specific domain(app, client, host or IP) will be routed to specific service("myservice") based on path. If it is coming from any other domain, request will be simply discarded.