Questão de Networking #019e3a4f
What is the main purpose of the Ingress in Kubernetes?
Access HTTP and HTTPS services running in the cluster based on their IP address.
Access services different from HTTP or HTTPS running in the cluster based on their IP address.
Access services different from HTTP or HTTPS running in the cluster based on their path
Access HTTP and HTTPS services running in the cluster based on their path.
Explicação Oficial / Explicações da Comunidade
The main purpose of Ingress in Kubernetes is to provide HTTP and HTTPS routing to services based on hostnames and paths. Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster, allowing traffic routing controlled by rules defined on the Ingress resource.
How it Works
An Ingress controller (e.g., NGINX, Traefik) watches the Kubernetes API for Ingress resources and configures a load balancer or proxy accordingly. The Ingress resource defines rules that map incoming traffic to backend services. For example, a rule can route requests to example.com/api to one service and example.com/web to another. Ingress typically operates at Layer 7 (application layer) of the OSI model, handling HTTP and HTTPS traffic.
Why the Correct Answer is Right
The correct answer states that Ingress accesses HTTP and HTTPS services based on their path. This is accurate because Ingress is designed specifically for HTTP/HTTPS traffic and uses path-based routing (e.g., /api, /app) to direct requests to different services. Path-based routing is a core feature of Ingress, enabling multiple services to be exposed under the same domain.
Why the Incorrect Answers are Wrong
- The option mentioning access based on IP address for HTTP/HTTPS services is incorrect because Ingress does not route based on IP addresses; it routes based on hostnames and paths. IP-based routing is handled by Services of type LoadBalancer or NodePort.
- The option mentioning access for services different from HTTP or HTTPS (e.g., TCP/UDP) is incorrect because Ingress is limited to HTTP and HTTPS. For non-HTTP protocols, other mechanisms like Service type LoadBalancer or custom ingress controllers with TCP support are needed.
- The option combining non-HTTP/HTTPS services with path-based routing is incorrect because path-based routing is a concept specific to HTTP/HTTPS; non-HTTP protocols do not have paths in the same sense.