先决条件
确保你有以下依赖运行NSM(Network Service Mesh):
安装
helm repo add nsm https://helm.nsm.dev/ # Add the latest release nsm helm repo
helm install nsm/nsm # Install the nsm infrastructure in your Kubernetes Cluster
如果你需要更多关于Helm的帮助。
https://github.com/networkservicemesh/networkservicemesh/blob/master/docs/guide-helm.md
你应该能够确认安装
kubectl get pods | grep nsm
输出:
nsm-admission-webhook-584c8dd8cb-rj754 1/1 Running 0 107s
nsm-vpp-forwarder-274f9 1/1 Running 0 105s
nsm-vpp-forwarder-6dvld 1/1 Running 0 106s
nsm-vpp-forwarder-zc799 1/1 Running 0 105s
nsmgr-7mvq4 3/3 Running 0 106s
nsmgr-bkmwk 3/3 Running 0 106s
nsmgr-lrvwg 3/3 Running 0 107s
运行
nsm helm repo有三个示例:
helm search nsm | grep -i example
输出:
nsm/icmp-responder 0.2.0 0.2.0 Endpoints and Clients for ICMP Responder Use Case
nsm/V** 0.2.0 0.2.0 Endpoints and Clients for V** Use Case
nsm/vpp-icmp-responder 0.2.0 0.2.0 Endpoints and Clients for VPP ICMP Responder Use Case
icmp-respondershi示例
对于NSM(Network Service Mesh)来说,最简单的情况是通过vWire将客户机连接到提供网络服务的另一个Pod。我们将这种情况称为“icmp-responder”示例,因为它允许客户端通过vWire ping端点的IP地址。
部署
利用Run指令(上面提到得)安装NSM基础设施,然后键入:
https://networkservicemesh.io/docs/setup/run/
helm install nsm/icmp-responder
它所完成的
这将安装两个部署(Deployment):
并使每个客户端获得一个连接到其中一个端点的vWire。NSM处理网络服务发现和路由,以及vWire的“连接处理”来设置所有这些。
为了使这个案例更有趣,使用PodAntiAffinity将Endpoint1和Endpoint2部署在两个单独的节点上,因此NSM必须演示在相同节点上的客户机和端点之间,以及不同节点上的客户机和端点之间串连vWire的能力。
验证
首先验证icmp-responder示例的Pod都是启动和运行:
kubectl get pods | grep icmp-responder
要查看icmp-responder示例在跑,你可以运行:
curl -s https://raw.githubusercontent.com/networkservicemesh/networkservicemesh/master/scripts/nsc_ping_all.sh | bash
更多示例
社区在examples/中维护了其它的示例
https://github.com/networkservicemesh/examples