Docker Overlay 部署条件

要想使用Docker原生Overlay网络,需要满足以下任意条件:

1、Docker运行在Swarm模式

2、使用键值存储的Docker主机集群

本次部署使用键值存储的Docker主机集群,需要满足以下条件:

1. 集群中主机连接到键值存储,Docker支持Consul、Etcd和Zookeeper;

2. 集群中主机运行一个Docker守护进程;

3. 集群中主机必须具有唯一的主机名,因为键值存储使用主机名来标识集群成员;

4. 集群中Linux主机内核版本3.12+,支持VXLAN数据包处理,否则可能无法通信。

5. Docker通过overlay网络驱动程序支持多主机容器网络通信。


内核版本升级方案https://www.cnblogs.com/xiangsikai/p/9899844.html


Docker Overlay 应用部署

  • 节点1/键值存储:192.168.1.77
  • 节点2:192.168.1.78

节点1节点2操作

# 修改两个测试端主机名,并退出终端生效
hostname overlay-01
hostname overlay-02

 一、部署Consul并运行服务

1.1 节点1操作:下载Consul二进制包并启动

  • 百度云:https://pan.baidu.com/s/1MsVJtYUDJ8LzBqVxwmdc8A
  • 密码:g5jd
  • 命令行下载:wget https://releases.hashicorp.com/consul/0.9.2/consul_0.9.2_linux_amd64.zip
# 1、解压Consul压缩包
unzip consul_0.9.2_linux_amd64.zip

# 2、将consul移动到/bin/目录下并添加执行权限
mv consul /usr/bin/consul && chmod +x /usr/bin/consul

# 3、启动consul并指定本机IP
nohup consul agent -server -bootstrap -ui -data-dir /var/lib/consul -client=192.168.1.77 -bind=192.168.1.77 &>/var/log/consul.log &

1.2 节点1操作:查看日志启动情况

tail /var/log/consul.log -f
2018/10/29 15:17:39 [INFO] agent: Started HTTP server on 192.168.1.77:8500

2018/10/29 15:17:45 [WARN] raft: Heartbeat timeout from "" reached, starting election

2018/10/29 15:17:45 [INFO] raft: Node at 192.168.1.77:8300 [Candidate] entering Candidate state in term 2

2018/10/29 15:17:45 [INFO] raft: Election won. Tally: 1

2018/10/29 15:17:45 [INFO] raft: Node at 192.168.1.77:8300 [Leader] entering Leader state

2018/10/29 15:17:45 [INFO] consul: cluster leadership acquired

2018/10/29 15:17:45 [INFO] consul: New leader elected: localhost.localdomain

2018/10/29 15:17:45 [INFO] consul: member 'localhost.localdomain' joined, marking health alive

2018/10/29 15:17:45 [INFO] agent: Synced node info

==> Newer Consul version available: 1.3.0 (currently running: 0.9.2)
日志

相关文章:

  • 2021-12-06
  • 2021-10-11
  • 2022-02-05
  • 2022-01-04
  • 2021-12-04
  • 2021-11-24
  • 2021-08-22
  • 2021-10-24
猜你喜欢
  • 2021-10-13
  • 2021-10-13
  • 2021-10-13
  • 2021-12-02
  • 2022-02-08
  • 2020-02-13
  • 2022-02-07
相关资源
相似解决方案