k8s部署OpenELB
-
- k8s部署OpenELB
- [配置示例: layer2模式](#配置示例: layer2模式)
k8s部署OpenELB
部署OpenELB
至K8s集群
yaml
# k8s部署OpenELB
kubectl apply -f https://raw.githubusercontent.com/openelb/openelb/refs/heads/master/deploy/openelb.yaml
# 查看openelb的pod状态
kubectl get pods -n openelb-system
配置示例: layer2模式
下面的示例创建了一个EIP资源对象, 它提供了一个IP地址池
给LoadBlancer Service
使用.
yaml
apiVersion: network.kubesphere.io/v1alpha2 # 定义资源的 API 版本
kind: Eip # 定义资源的类型为 Eip
metadata: # 元数据部分
name: eip-pool # 资源的名称为 eip-pool
annotations: # 注解部分
eip.openelb.kubesphere.io/is-default-eip: "true" # 标记该 EIP 为默认的 EIP
spec: # 资源的具体配置
address: 172.29.7.51-172.29.7.80 # 可用的 EIP 地址范围
# 使用的二层网络协议
protocol: layer2 # OpenELB 模式,支持 BGP、layer2、VIP 三种模式,此处为 layer2
interface: enp1s0 # 监听 ARP 或 NDP 请求时使用的网卡名称,仅在 layer2 模式下有效
disable: false # 是否禁用该 EIP,false 表示未禁用
查看
shell
# 查看名为 eip-tool 的 Eip 资源对象的详细信息
kubectl get eip eip-tool