Swarm mode环境模型-小结篇

本文总结了Swarm mode的环境模型,包括内置的overlay网络ingress在VIP负载均衡中的作用,Routing Mesh的工作原理,以及DNS负载均衡的实现。在VIP负载均衡中,ingress网络和ingress-sbox容器通过IPVS实现服务的主机端口到容器的映射。而DNS负载均衡则依赖于用户自定义的overlay网络,并不使用ingress网络。
摘要由CSDN通过智能技术生成

环境准备:1)搭建一个swarm mode集群环境

root@docker1:/home/docker/xu/swarm# docker node ls
ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
2bjtayk2pbbcl384ef9dxvyi0 *  docker1   Down    Active        Leader
b4f80o1a32afg5buim66w71se    docker2   Down    Active  

2)创建一个基于overlay的mysql(名称)网络

root@docker1:/home/docker/xu/swarm# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
1b1c3a449781        bridge              bridge              local               
041a4a5c12d7        docker_gwbridge     bridge              local               
a7c3520d5f74        host                host                local               
10xf6wjdp7kc        ingress             overlay             swarm               
2t21vsd267ms        mysql               overlay             swarm               
a5b817842a3a        none                null                local  

1、Swarm mode有个内置的overlay网络ingress,该网络主要是用于swarm vip方式的负载均衡

root@docker1:/home/docker/xu/swarm# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
1b1c3a449781        bridge              bridge              local               
041a4a5c12d7        docker_gwbridge     bridge              local               
a7c3520d5f74        host                host                local               
10xf6wjdp7kc        ingress             overlay             swarm               
2t21vsd267ms        mysql               overlay             swarm               
a5b817842a3a        none                null                local  

2Swarm mode vip负载均衡的官方解释

The swarm manager uses ingress load balancing to expose the services you want to make available externally to the swarm. The swarm manager can automatically assign the service a PublishedPort or you can configure a PublishedPort for the service. You can specify any unused port. If you do not specify a port, the swarm manager assigns the service a port in the 30000-32767 range.

External components, such as cloud load balancers, can access the service on the PublishedPort of any node in the cluster whether or not the node is currently running the task for the service. All nodes in the swarm route ingress connections to a running task instance.

3、Routing Mesh是实现vip负载均衡的关键技术, Routing Mesh的目的是每个主机上都为服务预留端口, 保证每台

器上都可以访问到服务。实现的办法就是Ingress网络, 之前我们提到容器中会多出一块网络,我们Inspect ingress

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值