CKA lab · Repair a Service selector
A Service for a healthy web Deployment has no endpoints.

Initial conditions
In a disposable namespace lab, deploy web on port 80 with Pod label app=web. Create Service web with selector app=wrong.
Objective
Find the mismatch, update the selector and verify a ready endpoint.
Hint
Compare the Service selector with the Pod labels.
Solution commands
kubectl -n lab get pods --show-labels
kubectl -n lab describe service web
kubectl -n lab patch service web --type=merge -p '{"spec":{"selector":{"app":"web"}}}'Validate the result
kubectl -n lab get endpointslice -l kubernetes.io/service-name=web -o wideThe controller populates EndpointSlices from matching Pods. A ready Pod should give the Service a usable endpoint.
Common mistakes
Changing DNS or increasing replicas does not fix a selector mismatch. Check targetPort if endpoints are present but traffic fails.
Free official documentation · Verified 26 November 2026
Use your own disposable Kubernetes environment.
