How do you expose a Deployment on a specific port?

  1. By modifying the Pod image
  2. By updating the node port
  3. By creating a Service with targetPort ✓
  4. By adding a volume to the Deployment

Correct answer: By creating a Service with targetPort

Option C is correct because a Kubernetes Service object routes traffic to Pods by matching label selectors and uses the targetPort field to specify which port on the Pod container receives the traffic, effectively exposing the Deployment at the desired port. Option A is wrong because modifying the Pod image changes the application code or runtime environment but has no effect on network routing or port exposure. Option B is wrong because updating the node port alone (a NodePort Service field) does not fully define how traffic reaches the container without also specifying the targetPort and a proper Service definition. Option D is wrong because volumes provide persistent or shared storage to containers and have nothing to do with network port exposure.

Topic: · kubernetes services, targetport, networking, deployments

Practice Certified Kubernetes App Developer (CKAD) Questions Free