Edgemesh test env config guide
- Refer to Usage to prepare KubeEdge environment, make sure “docker0” exists
- Then follow [EdgeMesh guide](#EdgeMesh test guide) to deploy Service
model
- a headless service (a service with selector but ClusterIP is None)
- one or more pods’ labels match the headless service’s selector
- to request a server, use: :
- get the service’s name and namespace from domain name
- query all the backend pods from MetaManager by service’s namespace and name
- LoadBalance returns the real backend containers’ hostIP and hostPort
flow
- client requests to server by server’s domain name
- DNS being hijacked to EdgeMesh by iptables rules, then a fake ip returned
- request hijacked to EdgeMesh by iptables rules
- EdgeMesh resolves request, gets domain name, protocol, request and so on
- EdgeMesh load balances:
- query backend pods of the service from MetaManager
- choose a backend based on strategy
- EdgeMesh transports request to server, wait for server’s response and then sends response back to client
Assume we have two edge nodes in ready state, we call them edge node “a” and “b”
Copy the deployment.yaml from the above link in cloud host, and run
$ kubectl create -f deployment.yaml
deployment.apps/nginx-deployment created
Check the pod is up and is running state, as we could see the pod is running on edge node b
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-deployment 1/1 1 1 63s
Now create a service for the sample deployment
Check the service and endpoints
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-svc ClusterIP None <none> 12345/TCP 77m
To request a server, use url like this: <service_name>.<service_namespace>.svc.<cluster>:<port>
$ curl http://nginx-svc.default.svc.cluster.local:12345
<!DOCTYPE html>
<head>
<title>Welcome to nginx!</title>
<style>
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<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>
- If you ever used EdgeMesh of old version, check your iptables rules. It might affect your test result.