You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
大家好,我本地有一个xray代理(tproxy),入站端口为12345, 设置了代理iptables,最近我有一个需求,搭建一个k3s集群,因为k3s集群默认dns是coredns,当我搭建完毕之后,发现pod不能使用我的宿主机代理,我使用kubectl logs -n kube-system -l k8s-app=kube-dns 查看发现上游dns指向了我的无线路由器(192.168.124.1:53) ,于是我返回192.168.124.1:53,之后在pod里面执行,nslookup www.baidu.com 返回了ipv6 和ipv4 ,但是我在宿主机执行nslookup www.baidu.com 同样的返回了ipv4和ipv6,发现唯一区别是返回的ipv6和ipv4顺序不同,pod里面是ipv6优先。
之后我使用ubuntu:22.04 pod,kubectl run dns-test --image=ubuntu:22.04 -it --rm,在pod容器里面执行apt update ,结果一直卡在0% [Connecting to archive.ubuntu.com (2620:2d:4000:1::101)] [Connecting to security.ubuntu.com (2620:2d:4000:1::102)] ,紧接着出现了Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4002:1::102). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::102). ,
但是如果我添加iptables设置 iptables -t mangle -A XRAY -i cni0 -j RETURN,重启服务,发现pod里面不能访问ping www.google.com,但是可以进行ping www.baidu.com ,并且我在ubuntu:22.04pod容器里面也可以进行apt update 没有错误。
如果,我使用curl -x socks5://192.168.124.3:10808 www.google.com 可以返回网页数据,我知道这样cni0不会走xray代理,但是我的需求是pod 必须走xray,包括pod的dns,我应该如何正确设置,才能实现我的需求。
Beta Was this translation helpful? Give feedback.
All reactions