代码拉取完成,页面将自动刷新
English | 中文
wget https://github.com/kubesphere/porter/releases/download/v0.1.1/porter.yaml
kubectl apply -f porter.yaml
不同的路由器配置不同,这边仅列出一个样例的思科三层交换机的配置,更多的请参考路由器配置。
以admin进入N9K配置界面。按照实际情况修改下面的配置。(注:实际输入不能有注释)
feature bgp ##开启BGP功能
router bgp 65001 #设置本路由器AS域
router-id 10.10.12.1 #设置本路由器IP
address-family ipv4 unicast
maximum-paths 8 #开启ECMP,并且最多接受8个等价路由
additional-paths send # 能够发送多个等价路由
additional-paths receive # 能够接受多个等价路由
neighbor 10.10.12.5 #邻居IP
remote-as 65000 #邻居AS,必须和本机AS不同
timers 10 30
address-family ipv4 unicast
route-map allow in #允许导入系统路由表
route-map allow out #允许导出路由表到系统
soft-reconfiguration inbound always # 自动更新邻居状态
capability additional-paths receive # 开启接受该邻居多条等价路由的能力
配置完成之后,查看邻居状态为Established
即可。show bgp ipv4 unicast neighbors
myswitvh(config)# show bgp ipv4 unicast neighbors
BGP neighbor is 10.10.12.5, remote AS 65000, ebgp link, Peer index 3
BGP version 4, remote router ID 10.10.12.5
BGP state = Established, up for 00:00:02
Peer is directly attached, interface Ethernet1/1
Last read 00:00:01, hold time = 30, keepalive interval is 10 seconds
Last written 0.996717, keepalive timer expiry due 00:00:09
Received 5 messages, 0 notifications, 0 bytes in queue
Sent 13 messages, 0 notifications, 0(0) bytes in queue
Connections established 1, dropped 0
Last reset by us 00:01:29, due to session closed
Last reset by peer never, due to No error
Neighbor capabilities:
Dynamic capability: advertised (mp, refresh, gr)
Dynamic capability (old): advertised
Route refresh capability (new): advertised received
Route refresh capability (old): advertised
4-Byte AS capability: advertised received
Address family IPv4 Unicast: advertised received
Graceful Restart capability: advertised
添加一个 EIP 池
kubectl apply -f - <<EOF
apiVersion: network.kubesphere.io/v1alpha1
kind: Eip
metadata:
name: eip-sample-pool
spec:
address: 10.11.11.0/24
disable: false
EOF
样例: EIP
注:EIP 地址现在支持 3 种类型
192.168.0.1
192.168.0.0/24
192.168.0.1-192.168.0.10
部署测试Service. Service必须要添加如下一个annotations,type也要指定为LoadBalancer,如下:
kind: Service
apiVersion: v1
metadata:
name: mylbapp
annotations:
lb.kubesphere.io/v1alpha1: porter
#eip.porter.kubesphere.io/v1alpha1: 1.1.1.1 如果需要手动指定eip,可以添加这个注记
spec:
selector:
app: mylbapp
type: LoadBalancer
ports:
- name: http
port: 8088
targetPort: 80
样例: Service
注:如果你想为 Service 指定 IP 地址,有两种方式:
spec.loadBalancerIP: <ip>
(推荐)eip.porter.kubesphere.io/v1alpha1: <ip>
在路由器上查看是否有对应的路由。如果有,那么连接这个路由器的任何主机应该都能通过EIP+ServicePort的方式访问了。
# show bgp all
10.11.11.11/32, ubest/mbest: 3/0
*via 10.10.12.2, [20/0], 00:03:38, bgp-65001, external, tag 65000
*via 10.10.12.3, [20/0], 00:03:38, bgp-65001, external, tag 65000
*via 10.10.12.4, [20/0], 00:03:38, bgp-65001, external, tag 65000
在集群上使用kubectl get eip
观察当前集群 EIP 的使用情况
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。