Question 35
Domain 4: Services, Networking, and Service DiscoveryWhich Ingress manifest correctly routes host app.example.com with Prefix paths /frontend to frontend-svc:80 and /api to api-svc:80 in namespace q77?
Correct answer: A
Explanation
An Ingress in namespace "q77" can route by host and path, so the manifest must match "host app.example.com" and use "Prefix" paths for both "/frontend" and "/api". The answer names "multi-path-ingress" with rules sending "/frontend" to "frontend-svc:80" and "/api" to "api-svc:80", which matches the required routing.
Why each option is right or wrong
A. An Ingress named multi-path-ingress in namespace q77 with rules for host app.example.com, path /frontend (Prefix) to frontend-svc port 80, and path /api (Prefix) to api-svc port 80
Under the Kubernetes Ingress API, routing is defined in the `networking.k8s.io/v1` `Ingress` object, and each HTTP path rule must specify a `pathType` such as `Prefix` to match all subpaths under `/frontend` and `/api` (Kubernetes Ingress spec, `pathType` field). The manifest is correct only if it is created in namespace `q77` and the `rules.host` is exactly `app.example.com`, with one backend service mapping `/frontend` to `frontend-svc` on port `80` and another mapping `/api` to `api-svc` on port `80`; any mismatch in host, namespace, pathType, or service port would fail the stated routing requirement.
B. An Ingress named multi-path-ingress in namespace q77 with host app.example.com routing /frontend to frontend-svc on port 8080 and /api to api-svc on port 8080
C. A Service named multi-path-ingress in namespace q77 exposing host app.example.com and mapping /frontend and /api directly to pods
D. An Ingress named multi-path-ingress in namespace q77 with two separate hosts, frontend.example.com and api.example.com, each pointing to the corresponding service