MetalLB with OpenWRT
主要参考这里:https://www.cnblogs.com/hahaha111122222/p/17223152.htm,下面记录一些和OpenWRT相关操作。
我用的stupidloud/nanopi-openwrtOpenWRT镜像,安装最新版slim版,但本地软件源中没有quagga,打开snapshot源后,也没有。。。发现release版中有,于是找了最近一个stable release,下载了这些packages:
- quagga-bgpd_1.2.4-2_x86_64.ipk
- quagga-vtysh_1.2.4-2_x86_64.ipk
- quagga-zebra_1.2.4-2_x86_64.ipk
- quagga-libzebra_1.2.4-2_x86_64.ipk
- quagga-watchquagga_1.2.4-2_x86_64.ipk
- quagga_1.2.4-2_x86_64.ipk
安装好后,打开quagga,成功的话可以看到几个端口有服务在监听:
tcp 0 0 :::2605 :::* LISTEN 27389/bgpd
tcp 0 0 :::2601 :::* LISTEN 27384/zebra
tcp 0 0 :::179 :::* LISTEN 27389/bgpd
使用vtysh进入编辑,分别添加k8s的几个node,第一行是设置AS, 第二行是添加描述信息,全都加晚后可以exit一下到上一层。
OpenWrt# configure terminal
OpenWrt(config)# router bgp 65000
OpenWrt(config-router)# neighbor 192.168.x.x remote-as 65009
OpenWrt(config-router)# neighbor 192.168.x.x description "ubuntu-1"
在最上层可以看summary,看完后用write命令写入到config文件,下次启动应该会再加载这些配置。
Hello, this is Quagga (version 1.2.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
OpenWrt# show ip bgp summary
BGP router identifier 192.168.1.1, local AS number 65000
RIB entries 9, using 1008 bytes of memory
Peers 4, using 36 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.1.20 4 65009 46 45 0 0 0 00:20:52 5
192.168.1.21 4 65009 46 47 0 0 0 00:21:07 4
192.168.1.22 4 65009 46 46 0 0 0 00:21:11 4
192.168.1.24 4 65009 45 46 0 0 0 00:20:54 4
Total number of neighbors 4
Total num. Established sessions 4
Total num. of routes received 17
很快在浏览器访问192.168.2.1就能访问到ingress了,再使用域名访问服务就正常了,无需其他配置,因为这里作用是能让MetalLB分配的ip被访问到,我之前已经做了那些,就只是需要添加一个bgp支持。