Clients in namespace frontend must reach Deployment api in namespace backend through port 80, while the Pods listen on 8080.
Objectifs
- Create ClusterIP Service api in backend
- Map Service port 80 to targetPort 8080
- Use the cross-namespace DNS name
Étapes suggérées
- The Service selector must match app=api.
- Cross-namespace short form is api.backend.
- Verify EndpointSlices after creation.
Indices
Voir la solution
kubectl expose deployment api -n backend --port=80 --target-port=8080 # From frontend: curl http://api.backend.svc.cluster.local