最新版本Docker网络部分所用的macvlan和ipvlan
$ su root # rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # yum install http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm # yum --enablerepo=elrepo-kernel install kernel-ml
下载插件
[root@ceph_docker ~]# git clone https://github.com/gopher-net/ipvlan-docker-plugin.git Cloning into 'ipvlan-docker-plugin'... remote: Counting objects: 874, done. remote: Total 874 (delta 0), reused 0 (delta 0), pack-reused 874 Receiving objects: 100% (874/874), 22.40 MiB | 566.00 KiB/s, done. Resolving deltas: 100% (225/225), done. [root@ceph_docker ~]# git clone https://github.com/gopher-net/ipvlan-docker-plugin.git Cloning into 'ipvlan-docker-plugin'... remote: Counting objects: 874, done. remote: Total 874 (delta 0), reused 0 (delta 0), pack-reused 874 Receiving objects: 100% (874/874), 22.40 MiB | 566.00 KiB/s, done. Resolving deltas: 100% (225/225), done.
运行该插件,并指定接口enp5sf0
[root@ceph_docker binaries]# ./ipvlan-docker-plugin-0.3-Linux-x86_64 –host-interface “enp5s0f0” -d
创建docker的网络模块
[root@ceph_docker ~]# docker network create -d ipvlan –subnet=192.168.19.0/24 –gateway=192.168.19.1 -o ipvlan_mode=l2 -o parent=enp5s0f0 db_net
a4bfe81593960c9a42ed7a9c89f5de8100f2efbec46aadb0bf10b8d1c6a33ea3
查看当前网络模块
[root@ceph_docker ~]# docker network ls
NETWORK ID NAME DRIVER a4bfe8159396 db_net ipvlan b7e4d3265869 bridge bridge fc5183b62ec3 none null 466a69268805 host host
开始部署容器,
docker run -d --net=db_net --ip=192.168.19.103 -v /etc/ceph:/etc/ceph -v /var/lib/ceph/:/var/lib/ceph/ -e MON_IP=192.168.19.103 -e CEPH_PUBLIC_NETWORK=192.168.19.0/24 ceph/daemon mon docker run -d --net=db_net --ip =192.168.19.104 --privileged=true -v /etc/ceph:/etc/ceph -v /var/lib/ceph/:/var/lib/ceph/ -v /dev/:/dev/ -e OSD_DEVICE=/dev/sdb -e OSD_FORCE_ZAP=1 ceph/daemon osd [root@ceph_docker ~]# docker run -d --net=db_net --ip =192.168.19.105 --privileged=true -v /etc/ceph:/etc/ceph -v /var/lib/ceph/:/var/lib/ceph/ -v /dev/:/dev/ -e OSD_DEVICE=/dev/sdc -e OSD_TYPE=disk ceph/daemon osd
查看部署后的状态
root@6d6aa76ce897:/# ceph -s cluster 7f12aae0-fa5c-4ec3-934a-d51969fabefe health HEALTH_OK monmap e3: 3 mons at {43d5248d080c=192.168.19.102:6789/0,6d6aa76ce897=192.168.19.103:6789/0,87f923e5c26c=192.168.19.101:6789/0} election epoch 6, quorum 0,1,2 87f923e5c26c,43d5248d080c,6d6aa76ce897 osdmap e13: 3 osds: 3 up, 3 in flags sortbitwise pgmap v31: 64 pgs, 1 pools, 0 bytes data, 0 objects 115 MB used, 5582 GB / 5582 GB avail 64 active+clean