@Ankit Rathod , Thank you for your question.
If none of the hosts or paths match the HTTP request in the Ingress objects, the traffic is routed to your default backend. [Reference]
With the following definition, let's say [Using apiVersion: networking.k8s.io/v1
since networking.k8s.io/v1beta1
has been deprecated] :
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
appgw.ingress.kubernetes.io/backend-path-prefix: "/"
kubernetes.io/ingress.class: azure/application-gateway
name: myIngress
spec:
rules:
- http:
paths:
- backend:
service:
name: nginx
port:
number: 80
path: /nginx
pathType: ImplementationSpecific
- backend:
service:
name: aspnetapp
port:
number: 80
path: /asp
pathType: ImplementationSpecific
On kubectl apply
(assuming that the backend services) are running, we get:
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
myIngress <none> * x.x.x.x 80 29m
kubectl describe ingress
Name: myIngress
Namespace: default
Address: x.x.x.x
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
*
/nginx nginx:80 (10.244.0.8:80)
/asp aspnetapp:80 (10.244.0.7:80)
Annotations: appgw.ingress.kubernetes.io/backend-path-prefix: /
kubernetes.io/ingress.class: azure/application-gateway
Events: <none>
Accessing the Applications:
at x.x.x.x/nginx
at x.x.x.x/asp
However, as @Mohammad Ajmal Yazdani pointed out, if we try accessing x.x.x.x/nginx/anypathhere and x.x.x.x/asp/anypathhere the paths do not match the rules in the Ingress object because these paths were not mentioned in the Ingress spec.rules[].http.paths[].path
to start with.
In your case, you can have Ingress spec.rules[].http.paths[]
item as follows:
- backend:
service:
name: <your-backend-service-name>
port:
number: <corresponding-port-number>
path: /digital/admin
pathType: ImplementationSpecific
You can use the YAML manifest shared above and replace the Ingress metadata.name
, spec.rules[].http.paths[].path
, spec.rules[].http.paths[].backend.service.name
and spec.rules[].http.paths[].backend.service.port.number
appropriately.
----------
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.