千云物流 - 使用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.pswp.cn/news/161414.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/161414.shtml
英文地址,請注明出處:http://en.pswp.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語句,可以執行非常復…