cozystack
cozystack copied to clipboard
Document how to configure source-based routing for MetalLB
While Talos Linux itself does not support setting source-based routing, we have to provide the information how to configure it using DaemonSet.
We have to add reference on article https://blog.aenix.io/configuring-routing-for-metallb-in-l2-mode-7ea26e19219e, and configuration like this:
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: routes
namespace: cozy-metallb
spec:
selector:
matchLabels:
app: routes
template:
metadata:
labels:
app: routes
spec:
hostNetwork: true
containers:
- name: routes
image: alpine
command:
- /bin/sh
- -c
args:
- |
set -xe
ip_rule_replace() {
ip rule del $@ || true
ip rule add $@
}
# Setup custom routing table
ip route replace 1.2.3.0/24 dev bond0.100 table 100
ip route replace default via 1.2.3.4 table 100
# Setup policy based routing
ip_rule_replace from 1.2.3.0/24 lookup 100
ip_rule_replace from 1.2.3.0/24 to 10.244.0.0/16 lookup main
exec sleep infinity
securityContext:
privileged: true
terminationGracePeriodSeconds: 0
tolerations:
- operator: Exists
upstream issues:
- https://github.com/siderolabs/talos/issues/7184
- https://github.com/siderolabs/talos/issues/8738