这里首先是一些背景信息,尽管它可能与问题无关。
我正在学习 Kubernetes,并建立了一个集群,其中 pi-hole 作为服务运行。我可以从 LAN 上另一台计算机上运行的浏览器访问管理控制台。
以下是服务:
$ sudo kubectl get services --all-namespaces -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 70m <none>
kube-system kube-dns ClusterIP 10.43.0.10 <none> 53/UDP,53/TCP,9153/TCP 70m k8s-app=kube-dns
kube-system metrics-server ClusterIP 10.43.78.148 <none> 443/TCP 69m k8s-app=metrics-server
pihole pihole-dhcp NodePort 10.43.41.144 <none> 67:31097/UDP 69m app=pihole,release=pihole
pihole pihole-dns-tcp LoadBalancer 10.43.36.226 192.168.1.129,192.168.1.146,192.168.1.148 53:31213/TCP 69m app=pihole,release=pihole
pihole pihole-dns-udp LoadBalancer 10.43.191.104 192.168.1.129,192.168.1.146,192.168.1.148 53:31078/UDP 69m app=pihole,release=pihole
pihole pihole-web LoadBalancer 10.43.63.236 192.168.1.129,192.168.1.146,192.168.1.148 80:30081/TCP,443:31214/TCP 69m app=pihole,release=pihole
kube-system traefik LoadBalancer 10.43.122.130 <pending> 80:30146/TCP,443:32021/TCP 68m app.kubernetes.io/instance=traefik,app.kubernetes.io/name=traefik
谜底是——谁在监听 80 端口?如前所述,我可以从浏览器或 curl 建立与 pi-hole 的连接:
$ curl http://192.168.1.129
<!doctype html>
<html lang='en'>
HTML lines omitted...
</html>
然而,以下命令是从 192.168.1.129 执行的:
$ sudo lsof -i :80
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:5f:01:b8:fc:6f brd ff:ff:ff:ff:ff:ff
inet 192.168.1.129/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
valid_lft 43882sec preferred_lft 33082sec
inet6 2603:8001:8e00:1ca9:37e7:e1f8:8ea9:571b/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 464540sec preferred_lft 464540sec
inet6 fe80::aba5:f484:5575:9864/64 scope link
valid_lft forever preferred_lft forever
Many other Kubernetes interface omitted...
netstat 和 ss 也没有显示任何人在监听端口。但是如果我在从浏览器连接到服务器时运行它,我可以使用 tcpdump 看到端口上的流量。
我错过了什么?