alibaba / kt-connect

A toolkit for Integrating with your kubernetes dev environment more efficiently
https://alibaba.github.io/kt-connect/#/
GNU General Public License v3.0
1.54k stars 231 forks source link

kt-connect无法实现联调Connect和Exchange #34

Closed sandshell closed 4 years ago

sandshell commented 5 years ago

Describe the bug A clear and concise description of what the bug is. 根据文档操作:https://rdc-incubator.github.io/kt-docs/#/zh-cn/quickstart

  1. 本地Linux centos7.5 开启connect和exchange

[root@k8s-registry-91 ~]# ktctl --kubeconfig /root/.kube/admin.conf connect 2019/10/29 17:39:21 Client address 192.168.15.91 2019/10/29 17:39:21 Deploying proxy deployment kt-connect-daemon-lqgpt in namespace default 2019/10/29 17:39:21 Pods not ready...... 2019/10/29 17:39:23 Pod status is Pending 2019/10/29 17:39:25 Pod status is Running 2019/10/29 17:39:25 Success deploy proxy deployment kt-connect-daemon-lqgpt in namespace default Daemon Start At 15177 [root@k8s-registry-91 ~]# ktctl --kubeconfig /root/.kube/admin.conf exchange tomcat --expose 8080 2019/10/29 17:38:08 'KT Connect' not runing, you can only access local app from cluster 2019/10/29 17:38:08 * tomcat (0 replicas) 2019/10/29 17:38:08 Scale deployment tomcat to zero 2019/10/29 17:38:08 Client address 192.168.15.91 2019/10/29 17:38:08 Deploying proxy deployment tomcat-kt-ssyos in namespace default 2019/10/29 17:38:08 Pods not ready...... 2019/10/29 17:38:10 Pod status is Pending 2019/10/29 17:38:12 Pod status is Running 2019/10/29 17:38:12 Success deploy proxy deployment tomcat-kt-ssyos in namespace default

  1. k8s集群查看对应的kt相关 pod是否启动

[root@k8s-master-15-81 ~]# kubectl get pod NAME READY STATUS RESTARTS AGE coffee-bbd45c6-mpp7n 1/1 Running 1 29h coffee-bbd45c6-p5hgk 1/1 Running 10 36d kt-connect-daemon-lqgpt-6d444896cb-pqzkx 1/1 Running 0 10m nginx-7c45b84548-nbwgd 1/1 Running 0 44m tea-5857f7786b-9btbj 1/1 Running 10 36d tea-5857f7786b-9h2dv 1/1 Running 1 29h tea-5857f7786b-v84hx 1/1 Running 2 36d tomcat-kt-ssyos-75cfd6484b-tpkth 1/1 Running 0 11m [root@k8s-master-15-81 ~]#

通过文档的demo测试:

  1. Connect联调: 3.1 在本地直接访问PodIP: curl http://Pod:Port 发现有的pod可以,有点pod不可以 3.2 在本地访问ClusteriIP:不通 curl http://ClusterIP:Port 所有clusterIP:Port都不通 3.3 使用Service的域名访问:所有都不通 curl http://XXX服务.default.svc.cluster.local:8080

4.Exchange联调测试 集群内测试: [root@k8s-master-15-81 ~]# kubectl exec -it face-api-5dcb48f6b8-8jsbf bash -n vsit [root@face-api-5dcb48f6b8-8jsbf tomcat]# curl http://tomcat.default.svc.cluster.local:8080 curl: (7) Failed connect to tomcat.default.svc.cluster.local:8080; Connection refused [root@face-api-5dcb48f6b8-8jsbf tomcat]# exit command terminated with exit code 7 [root@k8s-master-15-81 ~]# curl http://tomcat.default.svc.cluster.local:8080 curl: (6) Could not resolve host: tomcat.default.svc.cluster.local; Unknown error [root@k8s-master-15-81 ~]#

本地客户端测试: [root@k8s-registry-91 ~]# curl http://tomcat.default.svc.cluster.local:8080 curl: (6) Could not resolve host: tomcat.default.svc.cluster.local; Unknown error [root@k8s-registry-91 ~]#

所有测试都失败了,未看到/var/log/messages相关报错日志

Log please add -d to debug log

Environment (please complete the following information):

Additional context Add any other context about the problem here.

yunlzheng commented 5 years ago

@sandshell 麻烦加上-d参数,这样可以看到详细信息

ktctl -d <command>
bibex commented 5 years ago

我的也是所有的都是Connection refused 解决了吗

yunlzheng commented 5 years ago

@bibex 能提供一下日志吗? 我这边验证了一下,没有出现类似问题

yunlzheng commented 5 years ago

image

@sandshell @bibex 或者加我dingding,我帮看一下

sandshell commented 5 years ago

@yunlzheng 我钉钉加你了,同意下,谢谢

yunlzheng commented 5 years ago

@bibex WSL的问题,在这里跟踪了:https://github.com/alibaba/kt-connect/issues/35

yunlzheng commented 5 years ago

@sandshell 已经通过了

x-armory commented 5 years ago

4:53PM DBG vpn(sshuttle) start at pid: 97423 4:53PM DBG KT proxy start successful c : DNS request from ('10.xxx.xxx.xxx, 22900) to None: 34 bytes c : DNS request from ('10.xxx.xxx.xxx', 49561) to None: 34 bytes c : DNS request from ('10.xxx.xxx.xxx', 49561) to None: 34 bytes

pod端口不通,ip ping不通

yunlzheng commented 4 years ago

最新版本的kt connect在Windows或者WSL下可以使用socks5代理的模式

ktctl -d connect --method=socks5
yunlzheng commented 4 years ago

如果还有问题麻烦搜索钉钉群 23314962 kt-dev 加入讨论