Route all traffic between two workers nodes

Hi,

Is it possible to route all the traffic comming from one kubernetes node to another one?
For example, all the traffic (not the one from Kubernetes) from node1 goes to node2 and reciprocally.
I’ve read that’s possible with a service here :https://istio.io/docs/tasks/traffic-management/request-routing/#apply-a-virtual-service

Thanks for the help
Warok
Edit
Assuming that my nodes name are node1 and node2, does the following yaml file is right?
apiVersion: networking.istio.io/v2alpha3
kind: Gateway
metadata:
name: node1

spec:
hosts:
- nod1
tcp:
-match:
-port: 27017
- route:
- destination:
host: node2

Hi, I don’t think it’s possible to use Istio VirtualSerivces and Gateways to route Node-level traffic.
The Node is the underlying VM running workloads (Pods). Pods are exposed via Services. VirtualServices and Gateways operate at the Services level.

What you can do is forward traffic from one Kubernetes Service to another Service, using an Istio VirtualService:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews
spec:
  hosts:
    - svc1
  http:
  - route:
    - destination:
        host: svc2

If this traffic is coming in externally, you’d also need a Gateway.

If you care about which Pods live in specific Nodes in your Kubernetes cluster, you can assign these services to specific Nodes using Kubernetes affinity. https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity

1 Like