KCNA Networking & Service Discovery 2 — Questions and Answers
Question 1: Which Kubernetes Service type creates an external load balancer in cloud environments?
- ClusterIP
- NodePort
- LoadBalancer (Correct answer)
- ExternalName
Correct answer: LoadBalancer
The LoadBalancer Service type provisions an external cloud load balancer that routes traffic to the backend pods.
Question 2: What does a headless Service (ClusterIP: None) return when queried via DNS?
- A single virtual IP for load balancing
- The IP of a random pod
- Individual pod IP addresses as DNS A records (Correct answer)
- The node IP where pods are running
Correct answer: Individual pod IP addresses as DNS A records
Headless Services bypass kube-proxy and return the individual pod IPs directly as DNS A records, enabling direct pod addressing.
Question 3: Which field in a NetworkPolicy spec restricts which pods can initiate connections TO the selected pods?
- egress
- ingress (Correct answer)
- podSelector
- policyTypes
Correct answer: ingress
The ingress field defines rules for inbound traffic to the selected pods, specifying allowed sources.
Question 4: In Kubernetes DNS, what is the fully qualified domain name for a Service named 'db' in namespace 'prod'?
- db.prod
- db.prod.svc
- db.prod.svc.cluster.local (Correct answer)
- prod.db.cluster.local
Correct answer: db.prod.svc.cluster.local
Kubernetes DNS follows the pattern <service>.<namespace>.svc.<cluster-domain>, defaulting to cluster.local.
Question 5: What is the purpose of kube-proxy in a Kubernetes cluster?
- To resolve DNS names for Services
- To maintain iptables/IPVS rules that implement Service virtual IPs (Correct answer)
- To assign IP addresses to pods from the cluster CIDR
- To manage Ingress controller routing rules
Correct answer: To maintain iptables/IPVS rules that implement Service virtual IPs
kube-proxy watches the API server and programs iptables or IPVS rules on each node to forward traffic destined for Service ClusterIPs to backend pods.
Question 6: Which annotation is commonly used to specify an Ingress controller class when multiple controllers exist?
- kubernetes.io/ingress.class (Correct answer)
- nginx.ingress.kubernetes.io/class
- ingress.kubernetes.io/controller
- networking.k8s.io/ingress-class
Correct answer: kubernetes.io/ingress.class
The kubernetes.io/ingress.class annotation (or the newer IngressClassName field) tells Kubernetes which controller should handle a given Ingress resource.
Question 7: What happens to existing connections when a pod backing a Service is deleted?
- Connections are migrated to surviving pods transparently
- kube-proxy immediately removes the endpoint, causing existing connections to reset
- Existing connections may be terminated depending on the protocol and graceful termination period (Correct answer)
- The Service keeps routing to the deleted pod IP for 60 seconds
Correct answer: Existing connections may be terminated depending on the protocol and graceful termination period
When a pod is deleted, kube-proxy removes it from endpoints, but already-established TCP connections may be reset depending on the termination grace period and connection tracking.
Which Kubernetes Service type creates an external load balancer in cloud environments?