k3os-1 [~]$ ip route list
default via 10.0.0.1 dev eth0
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.236
10.0.0.1 dev eth0 scope link
10.42.0.0/24 dev cni0 proto kernel scope link src 10.42.0.1
10.42.1.0/24 via 10.42.1.0 dev flannel.1 onlink
10.42.2.0/24 via 10.42.2.0 dev flannel.1 onlink
127.0.0.0/8 dev lo scope host
169.254.169.254 via 10.0.0.1 dev eth0
k3os-1 [~]$ sudo traceroute google.com
traceroute to google.com (142.250.186.174), 30 hops max, 46 byte packets
1 140.91.198.103 (140.91.198.103) 0.096 ms 140.91.198.106 (140.91.198.106) 0.091 ms 140.91.198.111 (140.91.198.111) 0.162 ms
2 185.1.102.135 (185.1.102.135) 0.719 ms ipv4.de-cix.fra.de.as31898.oracle.com (80.81.196.168) 0.319 ms 13.348 ms
3 185.1.102.59 (185.1.102.59) 0.990 ms 0.615 ms ipv4.de-cix.fra.de.as15169.google.com (80.81.192.108) 0.454 ms
4 108.170.251.129 (108.170.251.129) 0.644 ms 108.170.252.1 (108.170.252.1) 3.295 ms 1.701 ms
5 142.250.214.203 (142.250.214.203) 0.656 ms 0.676 ms 142.250.214.201 (142.250.214.201) 0.612 ms
6 fra24s08-in-f14.1e100.net (142.250.186.174) 0.646 ms 0.641 ms 0.612 ms
k3os-1 [~]$ ping google.com
PING google.com (142.250.186.174): 56 data bytes
64 bytes from 142.250.186.174: seq=0 ttl=42 time=0.696 ms
64 bytes from 142.250.186.174: seq=1 ttl=42 time=0.788 ms
64 bytes from 142.250.186.174: seq=2 ttl=42 time=0.763 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.696/0.749/0.788 ms
Shell on the worker machine
k3os-3 [~]$ sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N KUBE-EXTERNAL-SERVICES
-N KUBE-FIREWALL
-N KUBE-FORWARD
-N KUBE-KUBELET-CANARY
-N KUBE-PROXY-CANARY
-N KUBE-ROUTER-FORWARD
-N KUBE-ROUTER-INPUT
-N KUBE-ROUTER-OUTPUT
-N KUBE-SERVICES
-A INPUT -m comment --comment "kube-router netpol - 4IA2OSFRMVNDXBVV" -j KUBE-ROUTER-INPUT
-A INPUT -m conntrack --ctstate NEW -m comment --comment "kubernetes externally-visible service portals" -j KUBE-EXTERNAL-SERVICES
-A INPUT -j KUBE-FIREWALL
-A FORWARD -m comment --comment "kube-router netpol - TEMCG2JMHZYE7H7T" -j KUBE-ROUTER-FORWARD
-A FORWARD -m comment --comment "kubernetes forwarding rules" -j KUBE-FORWARD
-A FORWARD -m conntrack --ctstate NEW -m comment --comment "kubernetes service portals" -j KUBE-SERVICES
-A FORWARD -m conntrack --ctstate NEW -m comment --comment "kubernetes externally-visible service portals" -j KUBE-EXTERNAL-SERVICES
-A FORWARD -s 10.42.0.0/16 -j ACCEPT
-A FORWARD -d 10.42.0.0/16 -j ACCEPT
-A OUTPUT -m comment --comment "kube-router netpol - VEAAIY32XVBHCSCY" -j KUBE-ROUTER-OUTPUT
-A OUTPUT -m conntrack --ctstate NEW -m comment --comment "kubernetes service portals" -j KUBE-SERVICES
-A OUTPUT -j KUBE-FIREWALL
-A KUBE-FIREWALL -m comment --comment "kubernetes firewall for dropping marked packets" -m mark --mark 0x8000/0x8000 -j DROP
-A KUBE-FIREWALL ! -s 127.0.0.0/8 -d 127.0.0.0/8 -m comment --comment "block incoming localnet connections" -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP
-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP
-A KUBE-FORWARD -m comment --comment "kubernetes forwarding rules" -m mark --mark 0x4000/0x4000 -j ACCEPT
-A KUBE-FORWARD -m comment --comment "kubernetes forwarding conntrack pod source rule" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A KUBE-FORWARD -m comment --comment "kubernetes forwarding conntrack pod destination rule" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A KUBE-ROUTER-INPUT -d 10.43.0.0/16 -m comment --comment "allow traffic to cluster IP - M66LPN4N3KB5HTJR" -j RETURN
-A KUBE-ROUTER-INPUT -p tcp -m comment --comment "allow LOCAL TCP traffic to node ports - LR7XO7NXDBGQJD2M" -m addrtype --dst-type LOCAL -m multiport --dports 30000:32767 -j RETURN
-A KUBE-ROUTER-INPUT -p udp -m comment --comment "allow LOCAL UDP traffic to node ports - 76UCBPIZNGJNWNUZ" -m addrtype --dst-type LOCAL -m multiport --dports 30000:32767 -j RETURN
k3os-3 [~]$ ip route list
default via 10.0.0.1 dev eth0
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.48
10.0.0.1 dev eth0 scope link
10.42.0.0/24 via 10.42.0.0 dev flannel.1 onlink
10.42.1.0/24 via 10.42.1.0 dev flannel.1 onlink
10.42.2.0/24 dev cni0 proto kernel scope link src 10.42.2.1
127.0.0.0/8 dev lo scope host
169.254.169.254 via 10.0.0.1 dev eth0
k3os-3 [~]$ sudo traceroute google.com
traceroute to google.com (142.250.186.142), 30 hops max, 46 byte packets
1 140.91.198.107 (140.91.198.107) 0.163 ms 140.91.198.158 (140.91.198.158) 0.144 ms 140.91.198.108 (140.91.198.108) 0.140 ms
2 185.1.102.135 (185.1.102.135) 0.552 ms ipv4.de-cix.fra.de.as31898.oracle.com (80.81.196.168) 0.332 ms 0.397 ms
3 185.1.102.59 (185.1.102.59) 0.551 ms 0.584 ms ipv4.de-cix.fra.de.as15169.google.com (80.81.192.108) 1.288 ms
4 108.170.252.1 (108.170.252.1) 1.768 ms 1.858 ms 108.170.251.129 (108.170.251.129) 0.676 ms
5 142.250.214.197 (142.250.214.197) 0.606 ms 0.674 ms 142.250.214.195 (142.250.214.195) 0.572 ms
6 fra24s07-in-f14.1e100.net (142.250.186.142) 0.643 ms 0.607 ms 0.596 ms
k3os-3 [~]$ ping google.com
PING google.com (142.250.186.142): 56 data bytes
64 bytes from 142.250.186.142: seq=0 ttl=42 time=0.632 ms
64 bytes from 142.250.186.142: seq=1 ttl=42 time=0.759 ms
64 bytes from 142.250.186.142: seq=2 ttl=42 time=0.728 ms
64 bytes from 142.250.186.142: seq=3 ttl=42 time=0.758 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.632/0.719/0.759 ms
/ # ip route list
default via 10.42.0.1 dev eth0
10.42.0.0/24 dev eth0 scope link src 10.42.0.47
10.42.0.0/16 via 10.42.0.1 dev eth0
/ # traceroute google.com
traceroute to google.com (172.217.16.142), 30 hops max, 46 byte packets
1 10.42.0.1 (10.42.0.1) 0.003 ms 0.003 ms 0.001 ms
2 140.91.198.99 (140.91.198.99) 0.102 ms 140.91.198.102 (140.91.198.102) 0.106 ms 0.101 ms
3 ip4.gtt.net (154.14.43.66) 0.583 ms 0.590 ms 0.546 ms
4 ae23-3201.cr2-fra6.ip4.gtt.net (154.14.43.65) 1.322 ms 1.095 ms 0.695 ms
5 ae10.cr6-fra2.ip4.gtt.net (141.136.107.233) 0.704 ms ae9.cr6-fra2.ip4.gtt.net (141.136.110.41) 1.294 ms 16.245 ms
6 ip4.gtt.net (46.33.79.250) 0.666 ms 0.566 ms 0.550 ms
7 * * *
8 142.251.64.182 (142.251.64.182) 2.809 ms 142.251.64.184 (142.251.64.184) 0.911 ms 108.170.252.65 (108.170.252.65) 2.393 ms
9 66.249.94.245 (66.249.94.245) 1.412 ms 1.491 ms 108.170.252.83 (108.170.252.83) 1.675 ms
10 fra15s46-in-f14.1e100.net (172.217.16.142) 0.855 ms 0.874 ms 0.891 ms
/ # ping google.com
PING google.com (142.250.186.46): 56 data bytes
64 bytes from 142.250.186.46: seq=0 ttl=121 time=0.770 ms
64 bytes from 142.250.186.46: seq=1 ttl=121 time=0.937 ms
64 bytes from 142.250.186.46: seq=2 ttl=121 time=0.852 ms
64 bytes from 142.250.186.46: seq=3 ttl=121 time=0.839 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.770/0.849/0.937 ms
It would be great when this rule would be installed and persisted automatically.
When this is not possible or my setup is broken, please let me know.
I'm still checking how I can persist this rule to survive a reboot.
Version (k3OS / kernel)
k3os version v0.20.7-k3s1r0 5.4.0-73-generic #82 SMP Thu Jun 3 01:19:50 UTC 2021
Architecture
aarch64
Describe the bug
Issues with establishing outgoing connections on the worker node. For example, when trying to start a pod, pulling the image fails:
Shell on the main machine
Shell on the worker machine
Shell on
svclb-traefik
pod on the main node:Shell on
svclb-traefik
pod on the worker node:To Reproduce
Create a main node
Create a worker node
Try to establish an outside connection from the worker node.
Expected behavior
A successful connection to the internet from the pods on the worker node.
Actual behavior
The connections time out.
Additional context
Executing this line fixed the issue (https://github.com/k3s-io/k3s/issues/24#issuecomment-469759329):
It would be great when this rule would be installed and persisted automatically. When this is not possible or my setup is broken, please let me know. I'm still checking how I can persist this rule to survive a reboot.