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.51k stars 230 forks source link

开发电脑开启ktconnect之后,不能正常访问redis,mysql等服务,关闭之后可以访问 #448

Open MisterPan opened 1 year ago

MisterPan commented 1 year ago

Describe the bug 开发电脑开启ktconnect之后,不能正常访问redis,mysql等服务,关闭之后可以访问,不知道是哪里有问题,请教一下怎么处理

Log 10:00AM DBG Background task log to C:\Users\px\AppData\Local\Temp\kt-433138961 10:00AM INF Using cluster context k8s-198 (k8s-198) 10:00AM INF KtConnect 0.3.7 start at 18648 (windows amd64) 10:00AM DBG Rectify pod kt-rectifier-pdoec created 10:00AM INF Fetching cluster time ... 10:00AM DBG Execute command [date +%s] in kt-rectifier-pdoec:standalone 10:00AM DBG No time difference 10:00AM INF Using tun2socks mode 10:00AM DBG Private Key generated 10:00AM DBG Public key generated 10:00AM INF Successful create config map kt-connect-shadow-hthfk 10:00AM INF Deploying shadow pod kt-connect-shadow-hthfk in namespace dbs-dev 10:00AM INF Waiting for pod kt-connect-shadow-hthfk ... 10:00AM DBG Find 2 kt pods 10:00AM INF Pod kt-connect-shadow-hthfk is ready 10:00AM DBG Using port 37767 10:00AM DBG Request port forward pod:22 -> local:37767 via https://10.82.27.198:6443 10:00AM INF Port forward local:37767 -> pod kt-connect-shadow-hthfk:22 established 10:00AM INF Socks proxy established 2023/08/29 10:00:46 Using existing driver 0.14 2023/08/29 10:00:46 Creating adapter 10:00AM INF Tun device KtConnectTunnel is ready 2023/08/29 10:00:46 Removed orphaned adapter "KtConnectTunnel 1" 10:00AM DBG Found 549 IPs 10:00AM DBG Service CIDR are: [10.233.0.0/16] 10:00AM DBG Found 713 IPs 10:00AM DBG Pod CIDR are: [10.233.0.0/16 10.82.0.0/16] 10:00AM DBG Using cluster IP 10.82.27.198 10:00AM DBG Cluster CIDR are: [10.233.0.0/16 10.82.128.0/17 10.82.64.0/18 10.82.32.0/19 10.82.0.0/20 10.82.16.0/21 10.82.28.0/22 10.82.24.0/23 10.82.26.0/24 10.82.27.0/25 10.82.27.128/26 10.82.27.224/27 10.82.27.208/28 10.82.27.200/29 10.82.27.192/30 10.82.27.196/31 10.82.27.199/32] 10:00AM INF Adding route to 10.233.0.0/16 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 set address KtConnectTunnel static 10.233.0.0 255.255.0.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.233.0.0/16 KtConnectTunnel 10.233.0.0] 10:00AM INF Adding route to 10.82.128.0/17 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.128.0 255.255.128.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.128.0/17 KtConnectTunnel 10.82.128.0] 10:00AM INF Adding route to 10.82.64.0/18 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.64.0 255.255.192.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.64.0/18 KtConnectTunnel 10.82.64.0] 10:00AM INF Adding route to 10.82.32.0/19 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.32.0 255.255.224.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.32.0/19 KtConnectTunnel 10.82.32.0] 10:00AM INF Adding route to 10.82.0.0/20 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.0.0 255.255.240.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.0.0/20 KtConnectTunnel 10.82.0.0] 10:00AM INF Adding route to 10.82.16.0/21 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.16.0 255.255.248.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.16.0/21 KtConnectTunnel 10.82.16.0] 10:00AM INF Adding route to 10.82.28.0/22 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.28.0 255.255.252.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.28.0/22 KtConnectTunnel 10.82.28.0] 10:00AM INF Adding route to 10.82.24.0/23 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.24.0 255.255.254.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.24.0/23 KtConnectTunnel 10.82.24.0] 10:00AM INF Adding route to 10.82.26.0/24 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.26.0 255.255.255.0] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.26.0/24 KtConnectTunnel 10.82.26.0] 10:00AM INF Adding route to 10.82.27.0/25 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.0 255.255.255.128] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.0/25 KtConnectTunnel 10.82.27.0] 10:00AM INF Adding route to 10.82.27.128/26 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.128 255.255.255.192] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.128/26 KtConnectTunnel 10.82.27.128] 10:00AM INF Adding route to 10.82.27.224/27 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.224 255.255.255.224] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.224/27 KtConnectTunnel 10.82.27.224] 10:00AM INF Adding route to 10.82.27.208/28 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.208 255.255.255.240] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.208/28 KtConnectTunnel 10.82.27.208] 10:00AM INF Adding route to 10.82.27.200/29 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.200 255.255.255.248] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.200/29 KtConnectTunnel 10.82.27.200] 10:00AM INF Adding route to 10.82.27.192/30 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.192 255.255.255.252] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.192/30 KtConnectTunnel 10.82.27.192] 10:00AM INF Adding route to 10.82.27.196/31 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.196 255.255.255.254] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.196/31 KtConnectTunnel 10.82.27.196] 10:00AM INF Adding route to 10.82.27.199/32 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 10.82.27.199 255.255.255.255] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 add route 10.82.27.199/32 KtConnectTunnel 10.82.27.199] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 show interfaces] 10:00AM DBG Task netsh.exe with args [netsh interface ipv4 show route store=persistent] 10:00AM INF Route to tun device completed 10:00AM INF Setting up dns in local mode 10:00AM DBG Service found: smartbuilding-alarmservice.dbs-dev 10.233.35.93 10:00AM DBG Service found: smartbuilding-assetservice.dbs-dev 10.233.10.193 10:00AM DBG Service found: smartbuilding-authcenter.dbs-dev 10.233.11.153 10:00AM DBG Service found: smartbuilding-bimservice.dbs-dev 10.233.28.223 10:00AM DBG Service found: smartbuilding-deviceservice.dbs-dev 10.233.2.123 10:00AM DBG Service found: smartbuilding-energyservice.dbs-dev 10.233.49.120

Environment (please complete the following information):

Additional context Add any other context about the problem here.

xuhaiL commented 10 months ago

试一试 --excludeIps

jaspertian commented 3 months ago

碰到过类似情况,connect 后,无法访问其他网站,后来发现是域名解析问题,运行 connect 命令时,需要指定 --dnsMode hosts , 让它把k8s里的服务名写在 hosts 文件中即可。