This example demonstrates mutually aware NSEs usage.
Mutually aware NSEs are allowed to have overlapping IP spaces.
Based on Policy Based Routing example.
Make sure that you have completed steps from basic or memory setup.
Create test namespace:
kubectl create ns ns-mutually-aware-nses
Deploy NSC and NSE:
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/mutually-aware-nses?ref=58a90eb58a3e06f02cbd99c221b35327488025cc
Wait for applications ready:
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ns-mutually-aware-nses
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-1 -n ns-mutually-aware-nses
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-2 -n ns-mutually-aware-nses
Find NSC pods by labels:
NSC=$(kubectl get pods -l app=nsc-kernel -n ns-mutually-aware-nses --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Install iproute2
on the client:
kubectl exec ${NSC} -n ns-mutually-aware-nses -- apk update
kubectl exec ${NSC} -n ns-mutually-aware-nses -- apk add iproute2
Check routes:
result=$(kubectl exec ${NSC} -n ns-mutually-aware-nses -- ip r get 172.16.1.100 from 172.16.1.101 ipproto tcp dport 6666)
echo ${result}
echo ${result} | grep -E -q "172.16.1.100 from 172.16.1.101 dev nsm-1"
result=$(kubectl exec ${NSC} -n ns-mutually-aware-nses -- ip r get 172.16.1.100 from 172.16.1.101 ipproto udp dport 5555)
echo ${result}
echo ${result} | grep -E -q "172.16.1.100 from 172.16.1.101 dev nsm-2"
Delete ns:
kubectl delete ns ns-mutually-aware-nses