The Cyclops has sabotaged the shop four times. For each one, work out what's wrong from the clue before opening the answer. These are exactly the kinds of breakage the exam asks you to fix.
The Service with nobody behind it
The shop Service exists, but every request fails. kubectl get endpointslices -l kubernetes.io/service-name=shop shows no addresses.
$ kubectl describe service shop Selector: app=shpo $ kubectl get pods --show-labels shop-7d9c...-xk2pq ... app=shop
Why: The Cyclops slipped a typo into the selector: shpo instead of shop. No Pod wears that tag, so the Pharos shines on nobody. Fix the selector with kubectl edit service shop.
Connection refused
The endpoints list has three Pods, but connecting to the Service on port 80 is refused.
$ kubectl describe service shop Port: 80/TCP TargetPort: 80/TCP # the container listens on 8080!
Why: The Service forwards to port 80, but the shop listens on 8080. Set targetPort: 8080.
The Deployment that won’t be created
kubectl apply -f shop.yaml fails with: `selector` does not match template `labels`.
selector:
matchLabels:
app: shop
template:
metadata:
labels:
app: store # ← mismatchWhy: A Deployment only manages Pods that match its selector, so Kubernetes refuses a recipe whose Pods it would never recognise. Make both say app: shop.
Stuck in ImagePullBackOff
The new Pods never start. kubectl get pods shows ErrImagePull, then ImagePullBackOff.
$ kubectl describe pod shop-... Events: Warning Failed kubelet Failed to pull image "shop:1.O": ... not found
Why: The image name has a capital letter O instead of a zero: shop:1.O. The kubelet can't download what doesn't exist. Fix it with kubectl set image deployment/shop shop=shop:1.0.
kubectl get to spot what looks wrong, kubectl describe to read the Events, and compare labels with --show-labels.