Kubernetes Container Orchestration Networking Services 2 — Questions and Answers
Question 1: Which Kubernetes Service type exposes an application using the cloud provider's load balancer?
- ClusterIP
- NodePort
- LoadBalancer (Correct answer)
- ExternalName
Correct answer: LoadBalancer
LoadBalancer provisions an external load balancer from the cloud provider and assigns a public IP to the Service.
Question 2: What does an ExternalName Service do in Kubernetes?
- Creates a NodePort mapping
- Maps a Service to a DNS name outside the cluster (Correct answer)
- Assigns a static ClusterIP
- Exposes the Service on all node IPs
Correct answer: Maps a Service to a DNS name outside the cluster
ExternalName maps a Service to an external DNS name by returning a CNAME record, enabling in-cluster pods to reach external services by a cluster-internal name.
Question 3: Which field in a Service spec selects the pods that the Service will route traffic to?
- ports
- selector (Correct answer)
- clusterIP
- targetPort
Correct answer: selector
The selector field matches pod labels to determine which pods are included as endpoints for the Service.
Question 4: What is the default port range for NodePort Services in Kubernetes?
- 1024–49151
- 8000–9000
- 30000–32767 (Correct answer)
- 80–443
Correct answer: 30000–32767
Kubernetes reserves the range 30000–32767 for NodePort Services by default, configurable via kube-apiserver flags.
Question 5: A headless Service in Kubernetes is created by setting clusterIP to which value?
- 0.0.0.0
- None (Correct answer)
- auto
- localhost
Correct answer: None
Setting clusterIP: None creates a headless Service where DNS returns individual pod IPs instead of a single virtual IP.
Question 6: Which component is responsible for programming iptables or IPVS rules on each node to implement Service load balancing?
- kube-scheduler
- kube-proxy (Correct answer)
- kubelet
- etcd
Correct answer: kube-proxy
kube-proxy runs on every node and configures iptables or IPVS rules to forward traffic destined for Service IPs to the correct pod endpoints.
Question 7: When sessionAffinity is set to ClientIP on a Service, how does Kubernetes route repeated requests from the same client?
- Routes to a random pod each time
- Routes to the pod with lowest load
- Routes to the same pod based on the client's IP (Correct answer)
- Routes to the most recently created pod
Correct answer: Routes to the same pod based on the client's IP
ClientIP session affinity ensures that requests from the same source IP are consistently forwarded to the same backend pod.
Which Kubernetes Service type exposes an application using the cloud provider's load balancer?