win10 wsl2 Ubuntu 22.04 ERR Failed to use local dns server
Describe the bug A clear and concise description of what the bug is. win10 wsl2 Ubuntu 22.04 使用命令connect时 启动失败 报错 ERR Failed to use local dns server
Log please add -d to debug log sudo ktctl -c /mnt/d/wsl-ubuntu/admin.conf -d connect 10:41AM DBG Background task log to /tmp/kt-4269918414 10:41AM INF Using cluster context kubernetes-admin@kubernetes (kubernetes) 10:41AM INF KtConnect 0.3.7 start at 27 (linux amd64) 10:41AM DBG Rectify pod kt-rectifier-hhqmc created 10:41AM INF Fetching cluster time ... 10:41AM DBG Execute command [date +%s] in kt-rectifier-hhqmc:standalone 10:41AM DBG Time difference is -2 10:41AM INF Using tun2socks mode 10:41AM DBG Find 3 kt pods 10:41AM DBG * pod kt-rectifier-mpuep expired, lastHeartBeat: 1678414027 10:41AM DBG role , config: map[] 10:41AM DBG Private Key generated 10:41AM DBG Public key generated 10:41AM INF Successful create config map kt-connect-shadow-fyipz 10:41AM INF Deploying shadow pod kt-connect-shadow-fyipz in namespace default 10:41AM INF Waiting for pod kt-connect-shadow-fyipz ... 10:41AM INF Pod kt-connect-shadow-fyipz is ready 10:41AM DBG Using port 17483 10:41AM DBG Request port forward pod:22 -> local:17483 via https://10.0.0.14:6443 10:41AM INF Port forward local:17483 -> pod kt-connect-shadow-fyipz:22 established 10:41AM INF Socks proxy established 10:41AM INF Tun device kt0 is ready 10:41AM DBG Found 27 IPs 10:41AM DBG Service CIDR are: [10.96.0.0/24 10.100.0.0/16 10.104.0.0/16 10.110.0.0/16 10.99.33.159/32 10.97.0.0/16 10.106.0.0/16 10.108.206.193/32 10.103.122.212/32 10.101.206.145/32 10.107.0.0/16 10.111.0.0/16 10.102.0.0/16 10.109.218.18/32] 10:41AM DBG Found 48 IPs 10:41AM DBG Pod CIDR are: [10.40.75.0/24 10.0.0.14/32] 10:41AM DBG Using cluster IP 10.0.0.14 10:41AM DBG Cluster CIDR are: [10.96.0.0/24 10.100.0.0/16 10.104.0.0/16 10.110.0.0/16 10.99.33.159/32 10.97.0.0/16 10.106.0.0/16 10.108.206.193/32 10.103.122.212/32 10.101.206.145/32 10.107.0.0/16 10.111.0.0/16 10.102.0.0/16 10.109.218.18/32 10.40.75.0/24] 10:41AM DBG Task /usr/sbin/ip with args [ip link set dev kt0 up] 10:41AM INF Adding route to 10.96.0.0/24 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.96.0.0/24 dev kt0] 10:41AM INF Adding route to 10.100.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.100.0.0/16 dev kt0] 10:41AM INF Adding route to 10.104.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.104.0.0/16 dev kt0] 10:41AM INF Adding route to 10.110.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.110.0.0/16 dev kt0] 10:41AM INF Adding route to 10.99.33.159/32 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.99.33.159/32 dev kt0] 10:41AM INF Adding route to 10.97.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.97.0.0/16 dev kt0] 10:41AM INF Adding route to 10.106.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.106.0.0/16 dev kt0] 10:41AM INF Adding route to 10.108.206.193/32 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.108.206.193/32 dev kt0] 10:41AM INF Adding route to 10.103.122.212/32 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.103.122.212/32 dev kt0] 10:41AM INF Adding route to 10.101.206.145/32 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.101.206.145/32 dev kt0] 10:41AM INF Adding route to 10.107.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.107.0.0/16 dev kt0] 10:41AM INF Adding route to 10.111.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.111.0.0/16 dev kt0] 10:41AM INF Adding route to 10.102.0.0/16 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.102.0.0/16 dev kt0] 10:41AM INF Adding route to 10.109.218.18/32 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.109.218.18/32 dev kt0] 10:41AM INF Adding route to 10.40.75.0/24 10:41AM DBG Task /usr/sbin/ip with args [ip route add 10.40.75.0/24 dev kt0] 10:41AM DBG Task /usr/sbin/ip with args [ip route show] 10:41AM WRN Skipped route to [10.99.33.159/32 10.108.206.193/32 10.103.122.212/32 10.101.206.145/32 10.109.218.18/32] 10:41AM INF Route to tun device completed 10:41AM INF Setting up dns in local mode 10:41AM DBG Service found: kubernetes.default 10.96.0.1 10:41AM DBG Dump hosts successful 10:41AM DBG Using port 54359 10:41AM DBG Request port forward pod:53 -> local:54359 via https://10.0.0.14:6443 10:41AM DBG Service kubernetes added 10:41AM INF Port forward local:54359 -> pod kt-connect-shadow-fyipz:53 established 10:41AM INF Setup local DNS with upstream [tcp:127.0.0.1:54359 udp:172.18.48.1:53] 10:41AM INF Creating udp dns on port 10053 10:41AM DBG Task /usr/sbin/iptables with args [iptables --table nat --insert OUTPUT --proto udp --dest 127.0.0.1/32 --dport 53 --jump REDIRECT --to-ports 10053] 10:41AM ERR Failed to use local dns server 10:41AM ERR Exit: exit status 2 10:41AM DBG Cleaning workspace 10:41AM DBG Task /usr/sbin/iptables with args [iptables --table nat --delete OUTPUT --proto udp --dest 127.0.0.1/32 --dport 53 --jump REDIRECT --to-ports 10053] 10:41AM INF Removed pid file /root/.kt/pid/connect-27.pid 10:41AM INF Removed key file /root/.kt/key/kt-connect-shadow-fyipz.key 10:41AM DBG Dropping hosts records ... 10:41AM DBG Received event "/root/.kt/pid/connect-27.pid": REMOVE 10:41AM INF Pid file was removed 10:41AM INF Drop hosts successful 10:41AM INF Cleaning configmap kt-connect-shadow-fyipz 10:41AM INF Cleaning shadow pod kt-connect-shadow-fyipz Environment (please complete the following information):
- OS: [win10 wsl2 Ubuntu 22.04]
- Kubernetes [e.g. 1.15.2]
- KT Version [e.g. 0.3.7]
Additional context Add any other context about the problem here.
Because the iptables command in WSL Ubuntu does not support the dport option. It can be fixed by switching to another version of iptables.
List the alternative iptables versions through sudo update-alternatives --config iptables , then choose the legacy version by typing 1.