Tous les labs

Repair a Service selector

Starter ~15 mink8s

The storefront Pods are healthy but the Service has no endpoints. Find and correct the selector mismatch.

Objectifs
  • Inspect labels on Pods
  • Inspect the Service selector
  • Make the Service select app=storefront
Étapes suggérées
  1. Use --show-labels.
  2. Compare spec.selector with the Deployment template labels.
  3. Patch or re-apply the Service.
Indices
Voir la solution
kubectl patch service storefront -n shop -p '{"spec":{"selector":{"app":"storefront"}}}'
kubectl get endpointslice -n shop -l kubernetes.io/service-name=storefront