Skip to content

Latest commit

 

History

History
 
 

Select forwarder by capability example

The example demonstrates how can be declareded forwarder selection in network service.

Important points:

  • client requests my-networkservice service.
  • forwarder registers itself with label my_forwarder_capability: true
  • network service declaretes network service my-networkservice that contains match for label my_forwarder_capability: true
  • network service-endpoint registers as an endpoint for service my-networkservice

See at example resources in kustomization.yaml

Requires

Make sure that you have completed steps from basic setup.

Run

Create ns ns-select-forwarder

kubectl create ns ns-select-forwarder

Apply example resources:

kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/select-forwarder?ref=7be52e47e136c606a141b091c740b7a924e53597

Wait for applications ready:

kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-select-forwarder
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-select-forwarder

Find nsc, nse pods by labels:

NSC=$(kubectl get pods -l app=alpine -n ns-select-forwarder --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
NSE=$(kubectl get pods -l app=nse-kernel -n ns-select-forwarder --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')

Ping from NSC to NSE:

kubectl exec ${NSC} -n ns-select-forwarder -- ping -c 4 169.254.0.0

Ping from NSE to NSC:

kubectl exec ${NSE} -n ns-select-forwarder -- ping -c 4 169.254.0.1

Verify that NSMgr selected the correct forwarder:

kubectl logs ${NSC} -c cmd-nsc -n ns-select-forwarder | grep "my-forwarder-vpp"

Cleanup

kubectl delete ns ns-select-forwarder