Internal traffic policy controls where traffic from a client pod may reach a Service endpoint. With Local routing, each client pod connects only to matching endpoints on its own node; if none exist there, the connection fails. This suits node-bound agents or devices, where crossing to another node would reach the wrong resource. section 11.5.1
Create a Service with Local routing
Apply a Service whose selector finds quote pods but whose routing remains node-local: apiVersion: v1 kind: Service metadata: name: quote-local spec: internalTrafficPolicy: Local selector: app: quote ports: - name: http port: 80 targetPort: 80 protocol: TCP Run repeated requests from a client pod with kubectl exec. Responses come only from quote pods on the client’s node. Moving the client to a node without a local endpoint causes the request to fail.
Use Local routing when the endpoint is tied to the client’s node:
- Expose one per-node agent through a stable Service rather than requiring clients to discover node IP addresses. section 17.3.3
- Treat the Service as a set of per-node Services: clients on node A use only endpoints on node A, and likewise for node B. section 17.3.3
- Check node coverage before relying on the Service; a node without an agent endpoint returns a failed connection. section 17.3.3
