AI Cloud Mentor
Session: Kubernetes Architecture
smart_toy
Hello! I'm your AI Cloud Mentor. Ask me anything about cloud architecture, DevOps, or your course content.
person
Can you explain how a LoadBalancer service differs from NodePort in a production AWS EKS environment? Use a code example if possible.
smart_toy
Excellent question. In a production AWS EKS environment, the distinction is critical for security and scalability.
apiVersion: v1
kind: Service
metadata:
name: my-eks-service
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
type: LoadBalancer
NodePort
Exposes the service on each Node's IP at a static port. Not recommended for direct production traffic.
LoadBalancer
Provisioning an external AWS NLB/ALB. Automatically routes traffic to your pods across all nodes.