This example shows how could be configured vL3 network via NSM.
Diagram:
NOTE: Forwarder and NSMmgr are missed in the diagram for the simplicity
- Create ns to deploy nse and nsc:
kubectl create ns ns-vl3
- Deploy network service, nsc and vl3 nses (See at
kustomization.yaml
):
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/vl3-basic?ref=91e80e8e4531562720d50ea9e84a82299813db65
- Find all nscs:
nscs=$(kubectl get pods -l app=nsc-kernel -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3)
[[ ! -z $nscs ]]
- Ping each client by each client:
for nsc in $nscs
do
ipAddr=$(kubectl exec -n ns-vl3 $nsc -- ifconfig nsm-1)
ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)
for pinger in $nscs
do
echo $pinger pings $ipAddr
kubectl exec $pinger -n ns-vl3 -- ping -c4 $ipAddr
done
done
- Ping each vl3-nse by each client.
Note: By default we're using ipam prefix is 169.254.0.0/16
and client prefix len is 24
. We also have two vl3 nses in this example. So we are expect to have a two vl3 addresses: 169.254.0.0
and 169.254.1.0
that should be accessible by each client.
for nsc in $nscs
do
echo $nsc pings nses
kubectl exec -n ns-vl3 $nsc -- ping 169.254.0.0 -c4
kubectl exec -n ns-vl3 $nsc -- ping 169.254.1.0 -c4
done
To cleanup the example just follow the next command:
kubectl delete ns ns-vl3