Explanation
Correct Answer: B - Use the AWS Load Balancer Controller to provision an Application Load Balancer.
Why Option B is Correct:
-
Application Load Balancer (ALB) is designed for HTTP/HTTPS traffic routing:
- ALB operates at Layer 7 (application layer) and can route traffic based on content
- It supports path-based routing, host-based routing, and query string parameters
- This makes it ideal for routing requests to different microservices based on URL paths
-
AWS Load Balancer Controller integration with EKS:
- The AWS Load Balancer Controller automatically provisions and configures ALBs for Kubernetes
- It can create Ingress resources that map to ALB listeners and target groups
- This provides native Kubernetes integration for routing traffic to different microservices
-
Cost-effectiveness:
- ALB pricing is based on Load Balancer Capacity Units (LCUs) which include new connections, active connections, processed bytes, and rule evaluations
- For microservices routing, ALB is typically more cost-effective than API Gateway for internal application routing
- No need for Lambda functions which would add additional compute costs
Why Other Options Are Not the Most Cost-Effective:
Option A - Network Load Balancer (NLB):
- NLB operates at Layer 4 (transport layer) and routes traffic based on IP protocol data
- While it can handle high throughput, it lacks the application-level routing capabilities needed for microservices
- Would require additional routing logic within the application or additional components
Option C - AWS Lambda function:
- Would add unnecessary compute costs for routing logic
- Lambda functions are billed per invocation and duration
- This creates an extra layer of complexity and cost for what should be handled by a load balancer
Option D - Amazon API Gateway:
- While API Gateway can route requests to different backend services
- It's typically more expensive than ALB for internal application routing
- API Gateway is better suited for public APIs with features like rate limiting, API keys, and usage plans
- For internal microservices routing within EKS, ALB is more cost-effective
Key Considerations for Microservices Routing in EKS:
- Ingress Resources: Using ALB with Ingress resources allows you to define routing rules in Kubernetes manifests
- Path-based Routing: Route
/customers/* to customers microservice and /orders/* to orders microservice
- Host-based Routing: Route different subdomains to different services
- Cost Optimization: ALB provides the necessary routing capabilities at a lower cost than API Gateway for internal traffic
Best Practice Recommendation:
For containerized microservices in EKS, the most cost-effective and appropriate solution is to use the AWS Load Balancer Controller with an Application Load Balancer, configured through Kubernetes Ingress resources for routing traffic to different microservices based on URL paths or host headers.