Certified Kubernetes Application Developer (CKAD) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Enhance your skills for the CKAD exam. Study with curated quizzes and detailed explanations. Prepare effectively for your success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Does a NodePort service support session affinity?

  1. No

  2. Yes, but only with additional configuration

  3. Yes

  4. It depends on the backend service

The correct answer is: Yes

A NodePort service does support session affinity, which is often referred to as sticky sessions. This feature allows clients to be directed to the same backend pod during their session based on the configuration of the service. When enabled, session affinity ensures that all requests from the same client (identified through cookies or IP addresses) will be routed to the same backend pod, providing a consistent user experience. This capability is particularly useful for applications that maintain state across multiple requests, as it helps in maintaining the user's session without requiring the session data to be stored in a centralized location. In Kubernetes, enabling session affinity is typically accomplished by setting the `sessionAffinity` field of the service to `ClientIP`. As a result, NodePort services can effectively manage sessions and enhance performance when configuration is appropriately applied. Options suggesting that session affinity does not exist at all, requires additional configuration, or depends on the backend service do not fully recognize the built-in capabilities of Kubernetes NodePort services to handle session affinity.