k3s: [svclb-traefik] can't create /proc/sys/net/ipv4/ip_forward: Read-only file system
I also encounter this problem. Taking the traefik service for an instance
# kubectl get service -A -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 2d23h <none>
kube-system kube-dns ClusterIP 10.43.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d23h k8s-app=kube-dns
kube-system metrics-server ClusterIP 10.43.146.109 <none> 443/TCP 2d23h k8s-app=metrics-server
kube-system traefik-prometheus ClusterIP 10.43.224.69 <none> 9100/TCP 2d23h app=traefik,release=traefik
kube-system traefik LoadBalancer 10.43.49.23 192.168.192.180,192.168.192.2,192.168.192.205 80:30373/TCP,443:32464/TCP 2d23h app=traefik,release=traefik
it should be accessible from all three external IPs displayed, however, it is actually accessible only from the external IP of the node where the pod is running, and not the other two.
I have ran the kubectl -n kube-system logs svclb-traefik-pl28k lb-port-80 command on each of the three svclb-traefik pods, and the output returned is as follows:
+ trap exit TERM INT
/usr/bin/entry: line 6: can't create /proc/sys/net/ipv4/ip_forward: Read-only file system
+ echo 1
+ true
+ cat /proc/sys/net/ipv4/ip_forward
+ '[' 1 '!=' 1 ]
+ iptables -t nat -I PREROUTING '!' -s 10.43.49.23/32 -p TCP --dport 80 -j DNAT --to 10.43.49.23:80
+ iptables -t nat -I POSTROUTING -d 10.43.49.23/32 -p TCP -j MASQUERADE
+ '[' '!' -e /pause ]
+ mkfifo /pause
I would like to know if it is right that the service is accessible only from the node where the traefik pod is running? Or should i manually set the iptables on the every node hosts?
_Originally posted by @tobunka-git in https://github.com/k3s-io/k3s/issues/3116#issuecomment-843680425_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 18 (2 by maintainers)
it seems nobody cares about this
Adding some new discoveries. I ran
iptables -Lon all the three nodes in the cluster, and found out that forward policies on the three nodes are different. What makes me curious is that the results ofsysctl net.ipv4.ip_forwardare the same:net.ipv4.ip_forward = 1. The details are listed below. On the master nodeOn the first worker node
On the second worker node
I’ll try to change the iptables forwarding policy manually, and will report the results later.