In addition to @Kyle 's answer. I've just added it as helm chart:
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
hostNetwork: true
Then:
kubectl apply -f k3s-traefik-real-ip.yaml