k8s跨集群网络互通submariner

基本概述
Submariner由几个主要组件组成,它们协同工作,安全地连接多个Kubernetes集群的工作负载。

代理
Broker是一个API,所有参与的集群都可以访问,其中两个对象通过.sub .io中的crd进行交换:
集群:定义参与集群及其IP cidr。
Endpoint:定义到集群的连接端点,以及从该连接端点可访问的集群ip。
Broker必须部署在一个Kubernetes集群上。 该集群的API服务器必须由Submariner连接的所有Kubernetes集群可访问。 它可以是一个专用集群,也可以是一个连接的集群。

一旦Submariner被部署到一个集群,并向Broker提供了适当的凭证,它将与其他集群交换cluster和Endpoint对象(通过push/pull/监视),并开始形成到其他集群的连接和路由。
至少3个Kubernetes集群,其中一个被指定为中央代理,可供所有连接集群访问;
不同的集群需要使用不同的CIDR

假设已有三个集群:
集群1的kubeconfig /root/.kube/configip
集群2的kubeconfig /root/.kube/configheader
集群3的kubeconfig /root/.kube/config3
集群1:
安装subctl

https://submariner.io/operations/deployment/subctl/
curl -Ls https://get.submariner.io | bash
export PATH=$PATH:~/.local/bin
echo export PATH=\$PATH:~/.local/bin >> ~/.profile
source   ~/.profile

集群1操作:

–natt Enable NAT for IPsec (default enabled)

#部署Broker在集群1
subctl deploy-broker --kubeconfig /root/.kube/configip
subctl join --kubeconfig /root/.kube/configheader broker-info.subm --clustercidr=10.246.0.0/16  --natt=false
subctl join --kubeconfig /root/.kube/config3 broker-info.subm --clustercidr=10.244.0.0/16  --natt=false
#验证网关引擎在节点上是否正常运行
kubectl get node --selector=submariner.io/gateway=true -o wide  --kubeconfig /root/.kube/configheader
kubectl get node --selector=submariner.io/gateway=true -o wide  --kubeconfig /root/.kube/config3

在这里插入图片描述
在这里插入图片描述

kubectl  -n submariner-operator describe Gateway --kubeconfig /root/.kube/configheader
kubectl  -n submariner-operator describe Gateway --kubeconfig /root/.kube/config3

在这里插入图片描述
确保每一个服务的STATUS都是Running
在这里插入图片描述

删除submariner

subctl uninstall --kubeconfig /root/.kube/config3 broker-info.subm --yes
subctl uninstall --kubeconfig /root/.kube/configheader broker-info.subm --yes
subctl uninstall deploy-broker /root/.kube/config

在各集群看查看coredns cm

kubectl -n submariner-operator get service submariner-lighthouse-coredns --kubeconfig /root/.kube/configheader

kubectl -n submariner-operator get service submariner-lighthouse-coredns --kubeconfig /root/.kube/config3

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
目前header remote之间的pod 网络,SVC网络已经 是互通的

svc一旦导出, 在跨集群集的本地,svc服务就可以被发现为{{servicename}}.{{namespace}}.svc.clusterset.local.

使用命令:

show
show networks
subctl show networks [flags]

Inspects the cluster and reports information about the detected network plugin and detected Cluster and Service CIDRs.

show versions
subctl show versions [flags]

Shows the version and image repository of each Submariner component in the cluster.

show gateways
subctl show gateways [flags]

Shows summary information about the Submariner gateways in the cluster.

show connections
subctl show connections [flags]

Shows information about the Submariner endpoint connections with other clusters.

show endpoints
subctl show endpoints [flags]

Shows information about the Submariner endpoints in the cluster.

show all
subctl show all [flags]

Shows the aggregated information from all the other show commands.

show flags
Flag	Description
--kubeconfig <string>	Absolute path(s) to the kubeconfig file(s) (default $HOME/.kube/config)
--kubecontext <string>	Kubeconfig context to use

由于k8s版本迭代等原因,不同的版本存在兼容性问题,所以在部署的时候可以指定使用镜像版本:
如:

subctl deploy-broker --version 0.12.0  --kubeconfig /root/.kube/config
subctl join  --version 0.12.0 --kubeconfig /root/.kube/remoteconfig broker-info.subm --clustercidr=10.245.0.0/16  --natt=false
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值