Kubernetes (K8s) (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Kubernetes Services: ClusterIP vs. NodePort vs. LoadBalancer vs. Headless.
junior LevelMost AskedKubernetes
In Simple Words: Pods are ephemeral; when replaced, they receive new IP addresses. A Service provides a single stable IP address and DNS name that load-balances traffic across matching Pods.
ClusterIP(Default):- Exposes the service on a cluster-internal private IP.
- Accessible only from inside the cluster. Perfect for internal microservice-to-microservice communication.
NodePort:- Exposes the service on a static high-numbered port (
30000-32767) on every worker node's physical IP address. - Accessible externally via
<NodeIP>:<NodePort>.
- Exposes the service on a static high-numbered port (
LoadBalancer:- Integrates with cloud providers (AWS NLB, GCP Cloud Load Balancer, Azure LB).
- Automatically provisions a public cloud load balancer that routes external internet traffic into the cluster's NodePort.
- Headless Service (
clusterIP: None):- Does not allocate a virtual IP. DNS queries return the raw A records of all matching Pod IPs directly. Used for StatefulSets (Kafka, Cassandra, Cassandra nodes discovering each other).