SwarmKit

SwarmKit

SwarmKit是随着docker 1.12发布的集群管理系统,并内置在docker daemon中,主要提供以下的功能:

配合SwarmKit的发布,docker也新增了docker swarmdocker nodedocker service命令来提供上述的功能(即swarm mode),其使用方法可以参考这里

整体架构

服务发现

网络

每个service中的容器都会加入三个网络:

# docker exec c2e7fa656ce9 ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
11: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default
    link/ether 02:42:0a:ff:00:06 brd ff:ff:ff:ff:ff:ff
    inet 10.255.0.6/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.255.0.4/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:aff:feff:6/64 scope link
       valid_lft forever preferred_lft forever
13: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:ac:12:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.3/16 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe12:3/64 scope link
       valid_lft forever preferred_lft forever
16: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default
    link/ether 02:42:0a:00:00:04 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.4/24 scope global eth2
       valid_lft forever preferred_lft forever
    inet 10.0.0.2/32 scope global eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::42:aff:fe00:4/64 scope link
       valid_lft forever preferred_lft forever

该容器内多个网卡跟其他部分的连接关系为:

负载均衡

每个Publish的Service都会开放端口到host上,并通过ingress_sbox内的ipvs负载均衡到后端容器的eth0上:

3

而用户自定义网络也同样是通过ipvs复杂均衡的:

4

Comments

comments powered by Disqus