CKA Services & Networking Practice Question
A company deploys a web application with multiple replicas in a Kubernetes cluster. Users report intermittent connectivity issues. The application pods are exposed via a ClusterIP Service. To ensure stable connectivity, which action should be taken?
⚠ Common exam trap
Test-takers frequently confuse readiness probes (which ensure pods are healthy) with session affinity (which ensures client requests stick to the same pod), leading them to select the readiness probe option despite it not solving the session persistence problem.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set service.spec.sessionAffinity to ClientIP
Intermittent connectivity issues with multiple replicas often stem from requests being distributed across different pods, which can break session state if the application is not stateless. Setting `service.spec.sessionAffinity` to `ClientIP` ensures that all requests from a given client IP are routed to the same pod, providing stable connectivity for stateful sessions without changing the service type or removing the ClusterIP.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Change the Service type to NodePort
Why it's wrong here
Changing the Service type to NodePort merely exposes the application on a static port across each cluster node's IP address. It does not alter the underlying load-balancing behavior of kube-proxy, meaning client requests will still be distributed across all backend pods randomly or via round-robin, failing to solve the session stickiness issue.
- ✓
Set service.spec.sessionAffinity to ClientIP
Why this is correct
Configuring service.spec.sessionAffinity to ClientIP instructs kube-proxy to direct all subsequent requests from a specific client IP to the same backend pod for a designated timeout period. This maintains session state on the target pod, preventing the intermittent failures that occur when stateless load balancing distributes a single user's session across multiple replicas.
- ✗
Remove the ClusterIP Service and use headless service
Why it's wrong here
Utilizing a headless service bypasses the ClusterIP proxying mechanism entirely, forcing clients to resolve pod IPs directly via DNS. This approach often exacerbates session issues because client-side DNS caching can lead to uneven traffic distribution, and it lacks any native mechanism to guarantee that a client consistently connects to the same pod replica.
- ✗
Add a readiness probe to the pods
Why it's wrong here
While readiness probes are crucial for ensuring that traffic is only routed to healthy pods that have finished initializing, they do not manage traffic routing logic for active sessions. Implementing a readiness probe will not prevent kube-proxy from routing successive requests from a single client to different, healthy backend replicas, leaving the session-state issue unresolved.
Go deeper
Related to this question
Learn chapter
Installing Kubernetes with kubeadm
Key term
Network Policies
A Kubernetes resource that controls how pods communicate with each other and with other network endpoints, acting as a firewall for pod-to-pod traffic.
Key term
Ingress Resources
Ingress Resources are Kubernetes API objects that manage external access to services inside a cluster, typically HTTP and HTTPS traffic, by defining rules for routing requests based on hostnames and paths.
About these practice questions
This CKA question is part of Courseiva's 726-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.