Cloud and Container Basics
In a Kubernetes cluster, HTTPS requests arriving for one host name should be routed to the api Service if the path begins with /api, and to the web Service otherwise. Which of the following resources is suitable for defining this routing rule?
- AIngress
- BReplicaSet
- CA Service of type: ClusterIP
Show answer and explanation
Answer: A. Ingress
An Ingress is a resource that defines rules for routing HTTP and HTTPS requests from outside the cluster to Services according to the host name and URL path, and TLS termination can also be configured there. The component that actually receives and routes the requests is an Ingress controller installed in the cluster (which acts as a reverse proxy). A Service of type: ClusterIP is an endpoint reachable only from inside the cluster and has no path-based routing. A ReplicaSet keeps the number of Pods and has nothing to do with routing traffic.
- A. Correct. It routes requests to Services by host name and path.
- B. A ReplicaSet keeps the specified number of Pods running.
- C. A ClusterIP Service is an endpoint inside the cluster and does not route by URL path.