Question 2
Domain 3: Services & NetworkingWhich Kubernetes objects and configuration are needed to expose an nginx Deployment through the Gateway API on HTTP port 80 in a namespace?
Correct answer: A
Explanation
A Gateway API setup needs a "Gateway referencing an existing GatewayClass" with an HTTP listener on port 80, and traffic is attached by an "HTTPRoute". The nginx pods must be backed by a Deployment and exposed internally with a ClusterIP Service so the route has a stable backend target in the namespace.
Why each option is right or wrong
A. Create a Namespace, a Gateway referencing an existing GatewayClass with an HTTP listener on port 80, a Deployment, and a ClusterIP Service, then attach an HTTPRoute to the Gateway
Under the Gateway API, the required objects are defined by the API group itself: a Gateway must reference an existing GatewayClass and declare a listener on port 80 for HTTP traffic, while an HTTPRoute is the resource that binds requests to that Gateway (Gateway API v1, GatewayClass/Gateway/HTTPRoute resources). In the namespace, the nginx workload needs a Deployment for the pods and a ClusterIP Service as the stable backend endpoint that the HTTPRoute forwards to; without the Service, the route has no routable in-cluster target.
B. Create a Namespace, a NodePort Service on port 80, and an Ingress resource with annotations to route traffic to the Deployment
C. Create only a Gateway resource with port 80; the Gateway will automatically create the Deployment and Service for the backend
D. Create a LoadBalancer Service for the nginx pods and bind it directly to the GatewayClass without needing an HTTPRoute