This example shows that NSC can change NSEs if network service has changed during connection without redeploying.
Make sure that you have completed steps from basic or ipsec mechanism setup.
Deploy NSC and two NSEs:
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/change-nse-dynamically?ref=c91be29099fab1f8376d9ff90c858efd829de35e
kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/c91be29099fab1f8376d9ff90c858efd829de35e/examples/features/change-nse-dynamically/blue-netsvc.yaml
Wait for applications ready:
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-change-nse-dynamically
kubectl wait --for=condition=ready --timeout=1m pod -l app=blue-nse -n ns-change-nse-dynamically
kubectl wait --for=condition=ready --timeout=1m pod -l app=green-nse -n ns-change-nse-dynamically
Ping from NSC to the blue NSE:
kubectl exec pods/alpine -n ns-change-nse-dynamically -- ping -c 4 172.16.2.100
Ping from the blue NSE to NSC:
kubectl exec pods/blue-nse -n ns-change-nse-dynamically -- ping -c 4 172.16.2.101
Change network service to select green endpoint:
kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/c91be29099fab1f8376d9ff90c858efd829de35e/examples/features/change-nse-dynamically/green-netsvc.yaml
Ping from NSC to the green NSE:
kubectl exec pods/alpine -n ns-change-nse-dynamically -- ping -c 4 172.16.1.100
Ping from the green NSE to NSC:
kubectl exec pods/green-nse -n ns-change-nse-dynamically -- ping -c 4 172.16.1.101
Change network service to select blue endpoint:
kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/c91be29099fab1f8376d9ff90c858efd829de35e/examples/features/change-nse-dynamically/blue-netsvc.yaml
Ping from NSC to the blue NSE:
kubectl exec pods/alpine -n ns-change-nse-dynamically -- ping -c 4 172.16.2.100
Ping from the blue NSE to NSC:
kubectl exec pods/blue-nse -n ns-change-nse-dynamically -- ping -c 4 172.16.2.101
Delete ns:
kubectl delete ns ns-change-nse-dynamically