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

ktctl在cluster.server为私有域名时出现启动失败 #316

Closed cryice closed 2 years ago

cryice commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

ktctl在cluster.server为私有域名时出现启动失败

cluster.server为私有域名vip-apiserver.test.com,DNS上没有注册,采用在本机hosts里配置,如10.10.10.30 vip-apiserver.test.com 启动过程中forwardport失败,导致启动失败,vip-apiserver.test.com为k8s节点的私有域名

Log please add -d to debug log

12:03PM DBG Background task log to C:\Users\cryice\AppData\Local\Temp\kt-574717743
12:03PM INF Using cluster context admin-cluster.local (cluster.local)
12:03PM INF KtConnect 0.3.4 start at 12000 (windows amd64)
12:03PM DBG Rectify pod kt-rectifier-sayfu created
12:03PM INF Fetching cluster time ...
12:03PM DBG Execute command [date +%s] in kt-rectifier-sayfu:standalone
12:03PM DBG Time difference is -90
12:03PM DBG Find 1 kt pods
12:03PM DBG Private Key generated
12:03PM DBG Public key generated
12:03PM INF Successful create config map kt-connect-shadow-ftrlz
12:03PM INF Deploying shadow pod kt-connect-shadow-ftrlz in namespace default
12:03PM INF Waiting for pod kt-connect-shadow-ftrlz ...
12:03PM INF Pod kt-connect-shadow-ftrlz is ready
12:03PM DBG Using port 15928
12:03PM DBG Request port forward pod:22 -> local:15928 via https://vip-apiserver.test.com:8443
12:03PM INF Port forward local:15928 -> pod kt-connect-shadow-ftrlz:22 established
12:03PM INF Socks proxy established
2022/05/23 12:03:38 Using existing driver 0.14
2022/05/23 12:03:38 Creating adapter
12:03PM INF Tun device KtConnectTunnel is ready
2022/05/23 12:03:38 Removed orphaned adapter "KtConnectTunnel 1"
12:03PM DBG Cluster CIDR are: [100.105.0.0/16 100.101.0.0/16 10.110.55.0/24]
12:03PM DBG Using cluster ip 10.110.55.200
12:03PM INF Adding route to 100.105.0.0/16
12:03PM DBG Task netsh.exe with args [netsh interface ipv4 set address KtConnectTunnel static 100.105.0.0 255.255.0.0]
12:03PM DBG Task netsh.exe with args [netsh interface ipv4 add route 100.105.0.0/16 KtConnectTunnel 100.105.0.0]
12:03PM INF Adding route to 100.101.0.0/16
12:03PM DBG Task netsh.exe with args [netsh interface ipv4 add address KtConnectTunnel 100.101.0.0 255.255.0.0]
12:03PM DBG Task netsh.exe with args [netsh interface ipv4 add route 100.101.0.0/16 KtConnectTunnel 100.101.0.0]
12:03PM INF Route to tun device completed
12:03PM INF Setting up dns in local mode
12:03PM DBG Service found: gw-customer-reception-aggregation.default 100.105.156.231
12:03PM DBG Headless service found: kafka.default 100.101.194.128
12:03PM DBG Service found: kubernetes.default 100.105.0.1
12:03PM DBG Headless service found: mongo.default 100.101.194.128
12:03PM DBG Headless service found: mongo1.default 100.101.194.128
12:03PM DBG Headless service found: mongo2.default 100.101.194.128
12:03PM DBG Service found: mynginx.default 100.105.35.110
12:03PM DBG Headless service found: redis-cluster.default 100.101.107.150
12:03PM DBG Service found: redis-ext-service.default 100.105.202.22
12:03PM DBG Dump hosts successful
12:03PM DBG Service redis-ext-service added
12:03PM DBG Service redis-cluster added
12:03PM DBG Service gw-customer-reception-aggregation added
12:03PM DBG Service mynginx added
12:03PM DBG Service kubernetes added
12:03PM DBG Service mongo added
12:03PM DBG Service mongo2 added
12:03PM DBG Service kafka added
12:03PM DBG Service mongo1 added
12:03PM DBG Using port 31478
12:03PM DBG Request port forward pod:53 -> local:31478 via https://vip-apiserver.test.com:8443
12:03PM ERR Failed to setup port forward local:31478 -> pod kt-connect-shadow-ftrlz:53 error="error upgrading connection: error sending request: Post \"https://vip-apiserver.test.com:8443/api/v1/namespaces/default/pods/kt-connect-shadow-ftrlz/portforward\": dial tcp: lookup vip-apiserver.test.com: no such host"
12:03PM DBG Port forward reconnecting ...
12:03PM ERR Failed to start: connect to port-forward failed
12:03PM DBG Request port forward pod:53 -> local:31478 via https://vip-apiserver.test.com:8443
12:03PM DBG Cleaning workspace
12:03PM INF Removed pid file C:\Users\cryice/.ktctl/connect-12000.pid
12:03PM DBG Received event "C:\\Users\\cryice\\.ktctl\\connect-12000.pid": REMOVE
12:03PM INF Pid file was removed
12:03PM INF Removed key file C:\Users\cryice/.ktctl/pk/kt-connect-shadow-ftrlz_id_rsa
12:03PM DBG Dropping hosts records ...
12:03PM INF Drop hosts successful
12:03PM INF Cleaning configmap kt-connect-shadow-ftrlz
12:03PM DBG Port forward local:31478 -> pod kt-connect-shadow-ftrlz:53 interrupted error="error upgrading connection: error sending request: Post \"https://vip-apiserver.test.com:8443/api/v1/namespaces/default/pods/kt-connect-shadow-ftrlz/portforward\": dial tcp: lookup vip-apiserver.test.com: no such host"
12:03PM INF Cleaning shadow pod kt-connect-shadow-ftrlz

Environment (please complete the following information):

Additional context Add any other context about the problem here.

master分支调试

image

cryice commented 2 years ago

317