千云物流 - 使用k8s负载均衡openelb

openelb的介绍

具体根据官方文档进行安装官方文档,这里作为测试环境的安装使用.
OpenELB 是一个开源的云原生负载均衡器实现,可以在基于裸金属服务器、边缘以及虚拟化的 Kubernetes 环境中使用 LoadBalancer 类型的 Service 对外暴露服务。OpenELB 项目最初由 KubeSphere 社区 发起,目前已作为 CNCF 沙箱项目 加入 CNCF 基金会,由 OpenELB 开源社区维护与支持。
与MetalLB类似,OpenELB也拥有两种主要工作模式:Layer2模式和BGP模式。OpenELB的BGP模式目前暂不支持IPv6。

  • layer2 Mode
    在这里插入图片描述
    在这里插入图片描述

  • BGP Mode
    -在这里插入图片描述

准备k8s的环境

千云物流测试环境部署使用openelb部署.

所需要的软件&版本对应依赖软件版本
linux [CentOS]7.9.2009
kubernetesv1.22.12
docker [20.10.8]20.10.8
openelbkubesphere/openelb:v0.5.1

准备Layer2 Mode配置

  • 配置ARP参数
    部署Layer2模式需要把k8s集群中的ipvs配置打开strictARP,

strict ARP configure arp_ignore and arp_announce to avoid answering ARP queries from kube-ipvs0 interface

# 查看kube-proxy中的strictARP配置
$ kubectl get configmap -n kube-system kube-proxy -o yaml | grep strictARP
#strictARP: false# 手动修改strictARP配置为true
$ kubectl edit configmap -n kube-system kube-proxy
configmap/kube-proxy edited# 使用命令直接修改并对比不同
$ kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | kubectl diff -f - -n kube-system# 确认无误后使用命令直接修改并生效
$ kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | kubectl apply -f - -n kube-system# 重启kube-proxy确保配置生效
$ kubectl rollout restart ds kube-proxy -n kube-system# 确认配置生效
$ kubectl get configmap -n kube-system kube-proxy -o yaml | grep strictARPstrictARP: true

开启之后k8s集群中的kube-proxy会停止响应kube-ipvs0网卡之外的其他网卡的arp请求,而由MetalLB接手处理。
strict ARP开启之后相当于把将arp_ignore设置为1;并将arp_announce设置为2启用严格的ARP,这个原理和LVS中的DR模式对RS的配置一样,可以参考之前的文章中的解释。

网卡配置

在这里插入图片描述

#多个网卡,需要指定master节点IP,一个网卡不需要
# kubectl annotate nodes k8s-master01 layer2.openelb.kubesphere.io/v1alpha1="masterip"

创建EIP

接下来我们需要配置loadbalancerIP所在的网段资源,这里我们创建一个Eip对象来进行定义,后面对IP段的管理也是在这里进行。

  • 部署eip
apiVersion: network.kubesphere.io/v1alpha2
kind: Eip
metadata:# Eip 对象的名称。name: layer2-eip
spec:# Eip 对象的地址池address: 10.0.0.122-10.0.0.123# openELB的运行模式,默认为bgpprotocol: layer2# OpenELB 在其上侦听 ARP/NDP 请求的网卡。该字段仅在protocol设置为时有效layer2。interface: ens160# 指定是否禁用 Eip 对象# false表示可以继续分配# true表示不再继续分配disable: false
status:# 指定 Eip 对象中的IP地址是否已用完。occupied: false# 指定 Eip 对象中有多少个 IP 地址已分配给服务。# 直接留空,系统会自动生成usage:# Eip 对象中的 IP 地址总数。poolSize: 2# 指定使用的 IP 地址和使用 IP 地址的服务。服务以Namespace/Service name格式显示(例如,default/test-svc)。# 直接留空,系统会自动生成used:# Eip 对象中的第一个 IP 地址。firstIP: 10.0.0.122# Eip 对象中的最后一个 IP 地址。lastIP: 10.0.0.123ready: true# 指定IP协议栈是否为 IPv4。目前,OpenELB 仅支持 IPv4,其值只能是true.v4: true
  • 检查eip状态
 kubectl apply -f openelb/openelb-eip.yaml#部署完成后检查eip的状态kubectl get eip

部署openelb

这里我们还是使用yaml进行部署,官方把所有部署的资源整合到了一个文件中,我们还是老规矩先下载到本地再进行部署

apiVersion: v1
kind: Namespace
metadata:name: openelb-system
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:annotations:controller-gen.kubebuilder.io/version: v0.4.0creationTimestamp: nullname: bgpconfs.network.kubesphere.io
spec:group: network.kubesphere.ionames:kind: BgpConflistKind: BgpConfListplural: bgpconfssingular: bgpconfscope: Clusterversions:- name: v1alpha1schema:openAPIV3Schema:description: BgpConf is the Schema for the bgpconfs APIproperties:apiVersion:description: 'APIVersion defines the versioned schema of this representationof an object. Servers should convert recognized schemas to the latestinternal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'type: stringkind:description: 'Kind is a string value representing the REST resource thisobject represents. Servers may infer this from the endpoint the clientsubmits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'type: stringmetadata:type: objectspec:description: struct for container bgp:config. Configuration parametersrelating to the global BGP router.properties:as:description: original -> bgp:as bgp:as's original type is inet:as-number.Local autonomous system number of the router.  Uses the 32-bit as-numbertype from the model in RFC 6991.format: int32type: integerport:description: original -> gobgp:portformat: int32maximum: 65535minimum: 1type: integerrouterID:description: original -> bgp:router-id bgp:router-id's original typeis inet:ipv4-address. Router id of the router, expressed as an 32-bitvalue, IPv4 address.pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}$type: stringrequired:- as- port- routerIDtype: objectstatus:description: BgpConfStatus defines the observed state of BgpConftype: objecttype: objectserved: truestorage: false- name: v1alpha2schema:openAPIV3Schema:description: BgpConf is the Schema for the bgpconfs APIproperties:apiVersion:description: 'APIVersion defines the versioned schema of this representationof an object. Servers should convert recognized schemas to the latestinternal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'type: stringkind:description: 'Kind is a string value representing the REST resource thisobject represents. Servers may infer this from the endpoint the clientsubmits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'type: stringmetadata:type: objectspec:description: Configuration parameters relating to the global BGP router.properties:as:format: int32type: integerasPerRack:additionalProperties:format: int32type: integertype: objectfamilies:items:format: int32type: integertype: arraygracefulRestart:properties:deferralTime:format: int32type: integerenabled:type: booleanhelperOnly:type: booleanlocalRestarting:type: booleanlonglivedEnabled:type: booleanmode:type: stringnotificationEnabled:type: booleanpeerRestartTime:format: int32type: integerpeerRestarting:type: booleanrestartTime:format: int32type: integerstaleRoutesTime:format: int32type: integertype: objectlistenAddresses:items:type: stringtype: arraylistenPort:format: int32type: integerpolicy:type: stringrouterId:type: stringuseMultiplePaths:type: booleantype: objectstatus:description: BgpConfStatus defines the observed state of BgpConfproperties:nodesConfStatus:additionalProperties:properties:as:format: int32type: integerrouterId:type: stringtype: objecttype: objecttype: objecttype: objectserved: truestorage: truesubresources:status: {}
status:acceptedNames:kind: ""plural: ""conditions: []storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:annotations:controller-gen.kubebuilder.io/version: v0.4.0creationTimestamp: nullname: bgppeers.network.kubesphere.io
spec:group: network.kubesphere.ionames:kind: BgpPeerlistKind: BgpPeerListplural: bgppeerssingular: bgppeerscope: Clusterversions:- name: v1alpha1schema:openAPIV3Schema:description: BgpPeer is the Schema for the bgppeers APIproperties:apiVersion:description: 'APIVersion defines the versioned schema of this representationof an object. Servers should convert recognized schemas to the latestinternal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'type: stringkind:description: 'Kind is a string value representing the REST resource thisobject represents. Servers may infer this from the endpoint the clientsubmits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'type: stringmetadata:type: objectspec:properties:addPaths:description: original -> bgp:add-paths Parameters relating to theadvertisement and receipt of multiple paths for a single NLRI (add-paths).properties:sendMax:description: original -> bgp:send-max The maximum number of pathsto advertise to neighbors for a single NLRI.type: integertype: objectconfig:description: original -> bgp:neighbor-address original -> bgp:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/161414.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

redis的性能管理及集群架构(主从复制、哨兵模式)

一、redis的性能管理 1、内存指标info memory 内存指标(重要) used_memory:853736 数据占用的内存 used_memory_rss:10551296 redis向操作系统申请的内存 used_memory_peak:853736 redis使用内存的峰值 注:单位:字节 系…

策略模式应用(内窥镜项目播放不同种类的视频)

新旧代码对比 策略模式 基本概念 策略模式是一种行为设计模式,它定义了一系列算法,将每个算法封装起来,并且使它们可以互相替换。策略模式允许客户端选择算法的具体实现,而不必改变客户端的代码。这样,客户端代码就…

中国区域250米归一化植被指数数据集(2000-2022)

中国区域250米归一化植被指数数据集(2000-2022)数据集是中国区域2000至2022年月度归一化植被指数产品,空间分辨率250米,合成方式采用月最大值合成,每年12期,共275期。本产品是基于Aqua/Terra-MODIS卫星传感器MOD13Q1产品以及土地利…

寄存器、缓存、内存之间的关系和区别

https://blog.csdn.net/m0_46761060/article/details/124689209 目录 关系1、寄存器2、缓存(Cache) 2.1、寄存器和缓存的区别2.2、一级缓存和二级缓存3、内存 3.1、只读存储器 ROM(Read Only Memory)3.2、随机存储器 RAM&#xf…

基于LLM+场景识别+词槽实体抽取实现多轮问答

前言 随着人工智能技术的不断进步,大语言模型(LLM)已成为技术前沿的热点。它们不仅能够理解和生成文本,还能在多种应用场景中实现复杂的交互。本文将深入探讨一段结合了大语言模型能力、意图识别和词槽实体抽取的Python代码&…

链表OJ--上

文章目录 前言一、反转链表二、移除链表元素三、链表中倒数第K个结点四、相交链表五、链表的中间结点 前言 一、反转链表 力扣206:反转链表- - -点击此处传送 思路图: 方法一:改变指向 方法二: 代码: //方法一 /…

十一、h.264编码

前言 测试环境: ffmpeg的4.3.2自行编译版本windows环境qt5.12 使用H.264编码对YUV视频进行压缩 ffmpeg -s 640x480 -pix_fmt yuv420p -i in.yuv -c:v libx264 out.h264 -c:v libx264是指定使用libx264作为编码器完整代码: H264EncodeThread.h #ifnd…

用HALCON标定助手对相机进行标定

任务要求: 已知相机镜头焦距f为8mm,相机单个CCD像素在水平和竖直两个方向上的尺寸均为3.75微米,相机为普通透光镜头和面阵相机,对相机进行标定,测量相机的内外参数。 操作步骤: 1. 在HALCON中运行gen_ca…

C#使用whisper.net实现语音识别(语音转文本)

目录 介绍 效果 输出信息 项目 代码 下载 介绍 github地址:https://github.com/sandrohanea/whisper.net Whisper.net. Speech to text made simple using Whisper Models 模型下载地址:https://huggingface.co/sandrohanea/whisper.net/tree…

Nginx高级

Nginx高级 第一部分:扩容 通过扩容提升整体吞吐量 1.单机垂直扩容:硬件资源增加 云服务资源增加 整机:IBM、浪潮、DELL、HP等 CPU/主板:更新到主流 网卡:10G/40G网卡 磁盘:SAS(SCSI) HDD(机械…

如何使用ArcGIS Pro进行坐标转换

不同来源的数据坐标系可能是不同的,为了统一使用这些数据就需要进行坐标转换,ArcGIS Pro作为专业的GIS软件,坐标转换功能肯定也是包含的,这里为大家介绍一下ArcGIS Pro如何进行坐标转换,希望能对你有所帮助。 数据来源…

【Exception】npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

Talk is cheap, show me the code. 环境 | Environment kversionOSwindows 11nodev18.14.2npm9.5.0 报错日志 | Error log >npm create vitelatest Need to install the following packages:create-vite5.0.0 Ok to proceed? (y) y npm ERR! code UNABLE_TO_GET_ISSUER_…

2023亚太杯数学建模B题思路+模型+代码+论文

2023亚太地区数学建模A题思路:开赛后第一时间更新,获取见文末 名片 2023亚太地区数学建模B题思路:开赛后第一时间更新,获取见文末 名片 2023亚太地区数学建模C题思路:开赛后第一时间更新,获取见文末 名片…

idea修改行号颜色

前言 i当idea用了深色主题后,发现行号根本看不清,或者很模糊 例如下面这样 修改行号颜色 在IntelliJ IDEA中,你可以根据自己的喜好和需求定制行号的颜色。下面是修改行号颜色的步骤: 打开 IntelliJ IDEA。 转到 “File”&…

ChatGPT规模化服务的经验与教训

2022年11月30日,OpenAI发布ChatGPT,以很多人未曾预料的速度迅速走红。与此同时,由于短时间内用户量的暴涨,导致服务器过载,迫使OpenAI停止新用户的注册。 ChatGPT发布这一年,同样的情景发生了好几次。在最近…

opencv-图像金字塔

图像金字塔是一种图像处理技术,它通过不断降低图像的分辨率,形成一系列图像。金字塔分为两种类型:高斯金字塔和拉普拉斯金字塔。 高斯金字塔(Gaussian Pyramid): 高斯金字塔是通过使用高斯滤波和降采样&a…

专业远程控制如何塑造安全体系?向日葵“全流程安全闭环”解析

安全是远程控制的重中之重,作为国民级远程控制品牌,向日葵远程控制就极为注重安全远控服务的塑造。近期向日葵发布了以安全和核心的新版“向日葵15”以及同步发布《贝锐向日葵远控安全标准白皮书》(下简称《白皮书》),…

使用微信小程序openMapApp接口,报错问题解决openMapApp:fail invaild coord

使用微信小程序的 openMapApp 接口时遇到了坐标无效的错误 (openMapApp:fail invalid coord)。这个错误通常是由于提供的地理坐标不符合预期的格式或范围而引起的: 坐标格式: 确保提供的坐标符合正确的格式。常见的格式是 "纬度,经度"&#xf…

【11月比赛合集】5场可报名的「创新应用」、「数据分析」和「程序设计」大奖赛,任君挑选!

CompHub[1] 实时聚合多平台的数据类(Kaggle、天池…)和OJ类(Leetcode、牛客…)比赛。本账号会推送最新的比赛消息,欢迎关注! 以下信息仅供参考,以比赛官网为准 目录 创新应用赛(1场比赛)数据分析赛&#…

逸学java【初级菜鸟篇】9.3 Stream流

hi,我是逸尘,一起学java吧 得益于Lambda所带来的函数式编程,引入了一个全新的Stream流概念(就是都基本使用lambda的形式)。 流处理 我们首先理解什么是流处理,它类似于sql语句,可以执行非常复…