对于调度到子集群中的服务, 我们可以从其他子集群中通过服务名称直接访问.
FleetBoard
安装过程参照:Fleetboard Helm Docs,
在 Hub
集群安装fleetboard
, 在Child
集群中安装fleetboard-agent
。10.96.0.11
,请在设置前检查一下。 fleetboard.local:53 {
forward . 10.96.0.11
}
请参考 this example. 来部署应用.
$ kubectl clusternet apply -f examples/scheduling-with-mcs-api/scheduling
namespace/baz created
deployment.apps/nginx-app created
service/nginx-svc created
serviceexport.multicluster.x-k8s.io/nginx-svc created
subscription.apps.clusternet.io/scheduling-with-mcs-api created
Fleetboard
会帮我们把endpointslices 同步在所有子集群中,现在你可以在子集群中检查下这些endpointslice和clusternet
部署的service。
$ kubectl get endpointslice -n syncer-operator
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
cluster1-baz-nginx-svc-v5vw6 IPv4 80 20.112.0.3,20.112.1.5,20.112.1.4 36h
$ kubectl exec -it nginx-app-9fb9fffdd-dsjxm -n baz -c alpine -- sh
/ # curl nginx-svc.baz.svc.fleetboard.local
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.