首页 > 其他分享 >Kubernetes(k8s) v1.30.1 本地集群部署 安装metallb 支持LoadBalancer 生产环境 推荐 BGP模式部署

Kubernetes(k8s) v1.30.1 本地集群部署 安装metallb 支持LoadBalancer 生产环境 推荐 BGP模式部署

时间:2024-05-27 21:01:00浏览次数:32  
标签:metallb Kubernetes 部署 discuz 192.168 BGP yaml 60.2

1 metallb 安装参考:Kubernetes(k8s) v1.30.1 本地集群部署 默认不支持LoadBalancer metallb来解决-CSDN博客

2  删除 Layer 2 模式 配置

kubectl delete -f IPAddressPool.yaml
kubectl delete -f L2Advertisement.yaml
kubectl delete -f discuz-srv.yaml

3 配置 k8s MetalLB BGP

#路由器配置,参考:OpenWrt 安装Quagga 支持ospf Bgp等动态路由协议 软路由实测 系列四-CSDN博客

#k8s master11 配置ip地址池等

[root@master11 soft]# cat bgpippool.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: first-pool
  namespace: metallb-system
spec:
  addresses:
   - 192.168.60.2-192.168.60.100

[root@master11 soft]# cat bgpad1.yaml 
apiVersion: metallb.io/v1beta1
kind: BGPAdvertisement
metadata:
  name: local
  namespace: metallb-system
spec:
  ipAddressPools:
  - first-pool
  aggregationLength: 32
  localPref: 100

[root@master11 soft]# cat bgppeer.yaml 
apiVersion: metallb.io/v1beta2
kind: BGPPeer
metadata:
  name: local
  namespace: metallb-system
spec:
  myASN: 65108
  peerASN: 65100
  peerAddress: 192.168.50.1
  peerPort: 179
#
kubectl apply -f  bgpippool.yaml
kubectl apply -f  bgpad1.yaml
kubectl apply -f  bgppeer.yaml
查看speaker日志,可以看到BGP连接
{"caller":"native.go:109","event":"sessionUp","level":"info","localASN":65108,"msg":"BGP session established","peer":"192.168.50.1:179","peerASN":65100,"ts":"2024-05-25T14:48:25Z"}

#安装discuz loadbalancer 应用 

kubectl apply -f  discuz-srv.yaml

#查看controller日志,看到IP 192.168.60.2 已经分配
{"caller":"service.go:150","event":"ipAllocated","ip":["192.168.60.2"],"level":"info","msg":"IP address assigned by controller","ts":"2024-05-25T15:11:31Z"}
#查看speaker日志,看到BGP路由信息
{"caller":"bgp_controller.go:309","event":"updatedAdvertisements","ips":["192.168.60.2"],"level":"info","msg":"making advertisements using BGP","numAds":1,"pool":"first-pool","protocol":"bgp","ts":"2024-05-25T15:11:31Z"}
{"caller":"main.go:409","event":"serviceAnnounced","ips":["192.168.60.2"],"level":"info","msg":"service has IP, announcing","pool":"first-pool","protocol":"bgp","ts":"2024-05-25T15:11:31Z"}

 4 k8s 查看

root@master11 ~]# kubectl get node,po,svc -A -owide|grep discuz
default                pod/discuz-859bc9f964-5wlwp                                 1/1     Running   7 (5h9m ago)    3d2h   10.244.199.25    slave12    <none>           <none>
default                pod/discuz-859bc9f964-8jpct                                 1/1     Running   7 (5h9m ago)    3d2h   10.244.199.27    slave12    <none>           <none>
default                pod/discuz-859bc9f964-qmx8z                                 1/1     Running   7 (5h9m ago)    3d2h   10.244.199.39    slave12    <none>           <none>
default                service/discuz-service                         LoadBalancer   10.111.38.239    192.168.60.2   88:30036/TCP                    5m11s   app=discuz

5 路由器检查

#看看BGP状态
show ip bgp  summary 
BGP router identifier 192.168.50.1, local AS number 65100
RIB entries 1, using 112 bytes of memory
Peers 3, using 27 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.50.11   4 65108     656    2244        0    0    0 00:10:31        0
192.168.50.12   4 65108     661    2251        0    0    0 00:10:31        1
192.168.50.13   4 65108     664    2252        0    0    0 00:10:30        1

Total number of neighbors 3

Total num. Established sessions 3
Total num. of routes received     2
#查看路由表

 show ip route 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, P - PIM, A - Babel, N - NHRP,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 via 192.168.1.1, eth1
C>* 127.0.0.0/8 is directly connected, lo
C>* 192.168.1.0/24 is directly connected, eth1
C>* 192.168.50.0/24 is directly connected, br-lan
B>* 192.168.60.2/32 [20/0] via 192.168.50.12, br-lan, 00:10:20
#
show ip bgp  
BGP table version is 0, local router ID is 192.168.50.1
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
              i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.168.60.2/32  192.168.50.12                          0 65108 i
*                   192.168.50.13                          0 65108 i

Displayed  1 out of 2 total prefixes

6  pc端浏览器访问

在正式环境中,如果条件满足,推荐使用K8S BGP模式 .

标签:metallb,Kubernetes,部署,discuz,192.168,BGP,yaml,60.2
From: https://blog.csdn.net/tonyhi6/article/details/139198203

相关文章

  • 基于SpringBoot+Vue+uniapp的IT技术交流和分享平台的详细设计和实现(源码+lw+部署文档
    文章目录前言具体实现截图技术栈后端框架SpringBoot前端框架Vue持久层框架MyBaitsPlus系统测试系统测试目的系统功能测试系统测试结论为什么选择我代码参考数据库参考源码获取前言......
  • 基于 Debian 部署 NFS 及其 NFS 配置
    基于Debian部署NFS及其NFS配置安装NFSServer安装NFS软件包sudoapt-getinstall-ynfs-kernel-server创建一个目录,通过NFS服务器共享文件和文件夹sudomkdir–p/nfs-test由于该文件夹将会被共享给客户端中的任何用户使用,因此权限设置为nobody用......
  • Windows系统使用Docker部署Focalboard团队协作工具详细流程
    文章目录前言1.使用Docker本地部署Focalboard1.1在Windows中安装Docker1.2使用Docker部署Focalboard2.安装Cpolar内网穿透工具3.实现公网访问Focalboard4.固定Focalboard公网地址前言本篇文章将介绍如何使用Docker本地部署Focalboard项目管理工具,并且结合cp......
  • CI工具Jenkins本地部署结合内网穿透实现无公网IP访问Jenkins站点
    文章目录1.安装Jenkins2.局域网访问Jenkins3.安装cpolar内网穿透软件4.配置Jenkins公网访问地址5.公网远程访问Jenkins6.固定公网地址本文主要介绍如何在LinuxCentOS7中安装Jenkins并结合cpolar内网穿透工具实现远程访问管理本地部署的Jenkins服务.Jenkins......
  • .net 8 api部署到iis出现500.19
    1.先下载了.net8sdk包,sdk包自带运行时。2.通过文件发布api到iis3.点击运行出现500.19,已经程序池改为无托管代码,并无效果4.点击模块发现core的api无法展示模块列表,framework可以展示 5.下载dotnet-hosting-2.2.5-win 问题解决链接:https://download.visualstudio.microsoft.com......
  • 部署经典黄金架构LAMP----编译安装MySQL----2
    版本要求:mysql-5.6.49安装目录:/usr/local/msyql数据目录:/usr/local/msyql/data端口:33061、检查是否安装了mariadb(如果有会返回,给它卸载了) [root@localhostlocal]#rpm-qa|grep-imariadbmariadb-libs-5.5.65-1.el7.x86_64[root@localhostlocal]#rpm-qa|grep-im......
  • Ubuntu 22.04 部署 TDengine 3.3.0.3
    背景主机名IPtest1172.16.16.77test2172.16.16.78test3172.16.16.79前期准备(所有节点都执行)#添加hosts配置vi/etc/hosts172.16.16.77test1172.16.16.78test2172.16.16.79test3#关闭防火墙ufwstatusverbose#Status:inactive结果显......
  • Windows中,Jenkins上部署ui自动化自启动浏览器(不使用无头模式)
    1、window上安装jenkins,我是借助以下链接进行安装的:Windows系统下Jenkins安装、配置和使用_jenkinswindows-CSDN博客2、jenkins安装中与github连接:jenkins+github集成自动化测试环境搭建(2)-jenkins+github集成_jenkins自动化测试集成github-CSDN博客3、解决jenkins运行ui......
  • 【OpenVINO™】在C#中使用 OpenVINO™ 部署 YOLOv10 模型实现目标
     最近YOLO家族又添新成员:YOLOv10,YOLOv10提出了一种一致的双任务方法,用于无nms训练的YOLOs,它同时带来了具有竞争力的性能和较低的推理延迟。此外,还介绍了整体效率-精度驱动的模型设计策略,从效率和精度两个角度对YOLOs的各个组成部分进行了全面优化,大大降低了计算开销,增强了......
  • k8s配置文件方式部署pod
    1.配置文件方式部署pod1.1 生成yaml文件#1.项目尝试启动,生成项目启动yaml文件kubectlcreatedeploymentspringboot-k8s--image=38-springboot-k8s-1.0.0-jar--dry-run-oyaml>deploy.yaml 1.2 修改yaml文件,配置从本地拉取镜像apiVersion:apps/v1kind:Depl......