KCNA ยท Kubernetes networking
Kubernetes Services and their types
ClusterIP, NodePort, LoadBalancer, ExternalName, headless Services, endpoints and kube-proxy role.
Key points
- A Service gives a stable virtual IP and DNS name to changing Pods chosen by a label selector.
- ClusterIP (default): internal only
- NodePort: opens a port on every node
- LoadBalancer: asks a cloud provider for an external load balancer
- ExternalName: returns a CNAME to an outside name
- Headless (clusterIP: None): no virtual IP, DNS returns Pod IPs
- kube-proxy on each node programs the rules sending Service traffic to backends
Source: https://kubernetes.io/docs/concepts/services-networking/service/
Practice questions
Which Service type is used when you do not set type explicitly?
- NodePort
- LoadBalancer
- ClusterIP
- ExternalName
Show answer
Answer: C. ClusterIP
ClusterIP is the default and is reachable only from inside the cluster. NodePort and LoadBalancer must be requested explicitly.
Which statements about Service types are correct?
- NodePort opens the same port number on every node
- ExternalName works by returning a CNAME record
- ClusterIP is reachable from outside the cluster by default
- LoadBalancer always works on any bare-metal cluster with no add-ons
- ExternalName selects Pods by label and proxies traffic to them
Show answer
Answer: A. NodePort opens the same port number on every node, B. ExternalName works by returning a CNAME record
NodePort exposes the same port on every node. ExternalName only answers with a CNAME at the DNS level. ClusterIP is internal and LoadBalancer depends on a cloud provider or add-on, so neither statement about them holds.
True or false: kube-proxy receives each packet sent to a Service IP and forwards it itself, so it sits in the data path.
Show answer
Answer: False
False in the usual modes. kube-proxy watches Services and programs kernel rules (iptables, IPVS or nftables); the kernel does the forwarding.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
