集群信息
[root@server ~]# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready control-plane,master,worker 31d v1.22.12 192.168.100.90 <none> CentOS Linux 7 (Core) 3.10.0-1160.102.1.el7.x86_64 docker://19.3.9
pi Ready agent,edge 24h v1.23.15-kubeedge-v1.13.0 192.168.1.2 <none> Debian GNU/Linux 11 (bullseye) 5.15.61-v8+ docker://20.10.6
test Ready agent,edge 105m v1.23.15-kubeedge-v1.13.0 192.168.1.12 <none> CentOS Linux 7 (Core) 3.10.0-1160.el7.x86_64 docker://20.10.24
集群已经成功安装edgemesh:
[root@server ~]# kubectl get pods -n kubeedge -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
cloud-iptables-manager-zghvd 1/1 Running 5 (3d ago) 31d 192.168.100.90 master <none> <none>
cloudcore-65f8cfd649-6hjr7 1/1 Running 0 101m 10.233.70.140 master <none> <none>
edgemesh-agent-65mm7 1/1 Running 0 24h 192.168.100.90 master <none> <none>
edgemesh-agent-6vblt 1/1 Running 1 (107m ago) 107m 192.168.1.12 test <none> <none>
edgemesh-agent-pxzjj 1/1 Running 2 (19h ago) 24h 192.168.1.2 pi <none> <none>
edgemesh-server-7fd5974557-8hfk7 1/1 Running 0 24h 192.168.100.90 master <none> <none>
edgeservice-6c4bd5567f-rgfwx 1/1 Running 5 (3d ago) 31d 10.233.70.126 master <none> <none>
并且在edge端可以请求kube-API(太多了,就不全放了):
root@pi:/opt# curl 127.0.0.1:10550/api/v1/services
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"tcp-echo-cloud\"},\"name\":\"tcp-echo-cloud-svc\",\"namespace\":\"cloudzone\"},\"spec\":{\"ports\":[{\"name\":\"tcp-0\",\"port\":2701,\"protocol\":\"TCP\",\"targetPort\":2701}],\"selector\":{\"app\":\"tcp-echo-cloud\"}}}\n"
},
"creationTimestamp": "2024-01-17T07:01:28Z",
"labels": {
"app": "tcp-echo-cloud"
},
"managedFields": [
{
"apiVersion": "v1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:kubectl.kubernetes.io/last-applied-configuration": {}
},
"f:labels": {
".": {},
"f:app": {}
}
},
..........
问题是什么
在使用示例应用时,hostname 应用及服务已经搭建起来了:
但是,我在云端的pod中去访问,一直处于阻塞状态:
然而我在边缘端使用容器的ip+端口号可以成功访问,用自身ip+映射出的端口号无法访问:
root@pi:/opt# curl 172.17.0.3:9376
hostname-edge-84cb45ccf4-fbkbv
root@pi:/opt# curl 127.0.0.1:12345
curl: (7) Failed to connect to 127.0.0.1 port 12345: Connection refused
root@pi:/opt# curl 192.168.1.2:12345
curl: (7) Failed to connect to 192.168.1.2 port 12345: Connection refused