What are the Kubernetes Service types ClusterIP, NodePort and LoadBalancer, and what is an Ingress?
Options
- ClusterIP: internal. NodePort: node. LoadBalancer: external. Ingress: HTTP (Correct option)
- All four are the same object, but written with different names
- ClusterIP is public to the internet and LoadBalancer is internal only
- Ingress stores the data of the application inside the whole cluster
Answer
ClusterIP: reachable only inside the cluster (default). NodePort: opens a port on every node. LoadBalancer: gets a cloud load balancer. Ingress: HTTP(S) routing by host/path to Services
Why
A Service gives Pods a stable address. Types:
- ClusterIP (default): internal-only virtual IP.
- NodePort: exposes the Service on a high port (30000-32767) on each node.
- LoadBalancer: asks the cloud (AWS/Azure) to create an external load balancer.
An Ingress is a set of HTTP(S) rules (shop.example.com/api to service A, /web to service B), implemented by an Ingress Controller (NGINX, AWS ALB controller, Azure Application Gateway). One load balancer can serve many services.
Remember
ClusterIP internal, LoadBalancer external, Ingress = HTTP routing rules.