在上一章中我们完成了部署DCE(DaoCloud Enterprise)的准备工作,本章主要介绍DCE容器云管平台的在线方式部署。
dce镜像
DCE环境的配置和管理工作是基于名为daocloud.io/daocloud/dce:latest的镜像来完成的,将该镜像run成临时容器并指定相应的命令或参数即可完成环境中的大多数工作。
# bash -c "$(docker run --rm daocloud.io/daocloud/dce)" DaoCloud Enterprise Toolbox. Usage: bash -c "$(docker run -i --rm daocloud.io/daocloud/dce:1.4.0 [options] [COMMAND] [ARGS...])" Options: --verbose Show more output. Commands: install Install the DCE Controller. join Install the DCE Engine and join Cluster. pull Pull the DCE Images. uninstall Uninstall the DCE Controller or Engine. upgrade Upgrade the DCE Existing Controller or Engine. setup-overlay Setup DCE Controller or Engine Overlay network configuration. setup-insecure Setup DCE Controller or Engine insecure registry configuration. setup-storage Setup Docker Storage to configure the devicemapper backends. build-template Build DCE Engine template. start Start the DCE. stop Stop the DCE. restart Restart the DCE. logs Show the DCE logs. status Show the DCE status. info Show the DCE information. backup Backup DCE data. restore Restore DCE data from backup. version Show the DCE version information.
通过以上输出我们可以看到dce临时容器可以完成很多工作,如DCE的安装卸载、启动停止、备份恢复等等…
我们也可以使用–help参数查看每个命令具体如何使用,这里以我们即将用到的install和join为例。
install命令
用来完成DCE Controller的安装
# bash -c "$(docker run --rm daocloud.io/daocloud/dce install --help)" Install the DCE Controller. Usage: do-install [options] Description: The command will install the DCE controller on this machine. Options: -q, --quiet Quiet. Do not ask for anything. --force-pull Always Pull Image, default is pull when missing. --swarm-port PORT Specify the swarm manager port(default: 2376). --controller-port PORT Specify the dce controller port(default: 80). --replica Install as a replica for HA. --replica-controller IP Specify the primary controller IP installed. --no-overlay Do not config Overlay network. --secure-registry Config insecure-registry. --experimental Enable experimental Swarm Experimental Features. --host-address IP Specify the node IP address. --dry-run Start as a test process without install DCE.
join命令
用来完成DCE Agent的安装
# bash -c "$(docker run --rm daocloud.io/daocloud/dce join --help)" Install the DCE Engine and join Cluster. Usage: do-join [options] CONTROLLER_IP Description: The command will install the DCE Engine on this machine and join it to the DCE Cluster. Options: -q, --quiet Quiet. Do not ask for anything. --force-pull Always Pull Image, default is pull when missing. --no-overlay Do not config Overlay network. --secure-registry Config insecure-registry. --experimental Enable experimental Swarm Experimental Features. --host-address IP Specify the node IP address. --dry-run Start as a test process without install DCE.
以上每个命令和参数的英文说明已经很详细且明了,这里就不一一翻译了。
下面我们开始安装DCE最新的1.4.0版本。
主控节点安装
[root@dce-master ~]# bash -c "$(docker run -i --rm daocloud.io/daocloud/dce:1.4.0 install)" . . . DCE Controller Installed Successfully -------------------------------------------------------------------------------- WEB: http://192.168.2.173 CLI: export DOCKER_HOST="tcp://192.168.2.173:80"; docker info NOTES: * Enable Insecure Registry need restart docker daemon: systemctl restart docker --------------------------------------------------------------------------------
安装过程会持续一定的时间,主要是下载DCE相关的镜像。在安装成功后会提示WBE和CLI的信息,如果默认有创建Registry,则需要按照NOTES的内容重启docker服务。
下载的镜像
[root@dce-master ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE daocloud.io/daocloud/dce-agent 1.4.0 9aa5363791da 27 hours ago 222.7 MB daocloud.io/daocloud/dce 1.4.0 4ed618a04533 27 hours ago 27.28 MB daocloud.io/daocloud/dce-controller 1.4.0 89f326f355dc 27 hours ago 399.1 MB daocloud.io/daocloud/dce latest bea168e941d3 3 weeks ago 27.28 MB daocloud.io/daocloud/dce-swarm 1.4.0 5d2738ff85a1 4 weeks ago 19.36 MB daocloud.io/daocloud/dce-lb 1.4.0 8cdfe6b07891 6 weeks ago 65.75 MB daocloud.io/daocloud/dce-etcd 1.4.0 e81032a59e55 9 weeks ago 32.29 MB daocloud.io/daocloud/dce-compose 1.4.0 103f2726e032 3 months ago 23.95 MB
安装过程会下载多个镜像,其中dce-agent,dce-swarm,dce-controller我们在第一章介绍的时候已经提到过,是控制节点运行的4个容器的基础镜像。dce-lb和dce-compose两个镜像是会在后续使用DCE的过程中被作为临时容器而调用。
## 运行的容器
[root@dce-master ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3ce62135cfd3 daocloud.io/daocloud/dce-agent:1.4.0 "bash /usr/local/bin/" About a minute ago Up About a minute 0.0.0.0:12376->2376/tcp dce_agent_1 bb3f01318008 daocloud.io/daocloud/dce-controller:1.4.0 "bash /usr/local/bin/" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp dce_controller_1 04bd98f90385 daocloud.io/daocloud/dce-swarm:1.4.0 "/swarm manage --repl" About a minute ago Up About a minute 0.0.0.0:2375->2375/tcp dce_swarm-manager_1 b67e84ebb7e7 daocloud.io/daocloud/dce-etcd:1.4.0 "/etcd --name dce-etc" About a minute ago Up About a minute 2380/tcp, 4001/tcp, 7001/tcp, 0.0.0.0:12380->12380/tcp, 0.0.0.0:12379->2379/tcp dce_etcd_1
主控节点运行四个容器,dce_agent_1,dce_controller_1,dce_swarm-manager_1和dce_etcd_1
辅控节点安装
[root@dce-slave01 ~]# bash -c "$(docker run --rm daocloud.io/daocloud/dce install --force-pull --replica --replica-controller 192.168.2.173)" . . . DCE Controller Installed Successfully -------------------------------------------------------------------------------- WEB: http://192.168.2.158 CLI: export DOCKER_HOST="tcp://192.168.2.158:80"; docker info NOTES: * Enable Insecure Registry need restart docker daemon: systemctl restart docker --------------------------------------------------------------------------------
副控节点安装需要添加replica参数,并指定主控节点的IP。
下载的镜像
[root@dce-slave01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE daocloud.io/daocloud/dce-agent 1.4.0 9aa5363791da 27 hours ago 222.7 MB daocloud.io/daocloud/dce 1.4.0 4ed618a04533 27 hours ago 27.28 MB daocloud.io/daocloud/dce-controller 1.4.0 89f326f355dc 27 hours ago 399.1 MB daocloud.io/daocloud/dce latest bea168e941d3 3 weeks ago 27.28 MB daocloud.io/daocloud/dce-swarm 1.4.0 5d2738ff85a1 4 weeks ago 19.36 MB daocloud.io/daocloud/dce-lb 1.4.0 8cdfe6b07891 6 weeks ago 65.75 MB daocloud.io/daocloud/dce-etcd 1.4.0 e81032a59e55 9 weeks ago 32.29 MB daocloud.io/daocloud/dce-compose 1.4.0 103f2726e032 3 months ago 23.95 MB
运行的容器
[root@dce-slave01 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4859933641dc daocloud.io/daocloud/dce-agent:1.4.0 "bash /usr/local/bin/" About a minute ago Up 59 seconds 0.0.0.0:12376->2376/tcp dce_agent_1 325bce1f79be daocloud.io/daocloud/dce-controller:1.4.0 "bash /usr/local/bin/" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp dce_controller_1 7342903c9d8b daocloud.io/daocloud/dce-swarm:1.4.0 "/swarm manage --repl" About a minute ago Up About a minute 0.0.0.0:2375->2375/tcp dce_swarm-manager_1 e4af92947ee5 daocloud.io/daocloud/dce-etcd:1.4.0 "/etcd --name dce-etc" About a minute ago Up About a minute 2380/tcp, 4001/tcp, 7001/tcp, 0.0.0.0:12380->12380/tcp, 0.0.0.0:12379->2379/tcp dce_etcd_1
由于副控节点和主控节点提供的功能是一样且在本例中是“三活”状态,所以副控节点下载的镜像和运行的容器完全跟主控节点一样。
容器节点安装
[root@dce-agent01 ~]# bash -c "$(docker run --rm daocloud.io/daocloud/dce join --force-pull 192.168.2.173)" . . . DCE Agent Installed Successfully -------------------------------------------------------------------------------- WEB: http://192.168.2.173 CLI: export DOCKER_HOST="tcp://192.168.2.173:80"; docker info NOTES: * Enable Insecure Registry need restart docker daemon: systemctl restart docker --------------------------------------------------------------------------------
容器节点的安装需要用到join命令且需指定主控节点的IP。
拉取的镜像
[root@dce-agent01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE daocloud.io/daocloud/dce-agent 1.4.0 9aa5363791da 27 hours ago 222.7 MB daocloud.io/daocloud/dce 1.4.0 4ed618a04533 27 hours ago 27.28 MB daocloud.io/daocloud/dce latest bea168e941d3 3 weeks ago 27.28 MB daocloud.io/daocloud/dce-lb 1.4.0 8cdfe6b07891 6 weeks ago 65.75 MB
容器节点下载dce-agent镜像,作为运行DCE Agent应用/服务的基础镜像。
运行的容器
[root@dce-agent01 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d3b1f2d24235 daocloud.io/daocloud/dce-agent:1.4.0 "bash /usr/local/bin/" 28 seconds ago Up 27 seconds 0.0.0.0:12376->2376/tcp dce_agent_1
容器节点仅运行dce_agent_1容器,负责与控制节点之间的通信和调度。
部署验证
访问测试
浏览器中访问主控节点的IP地址
登录测试
登录控制面板,输入已配置的用户名和密码登录
环境验证
查看整个DCE环境的基础信息
可以看到5台Docker宿主机均以规划的角色加入到DCE环境中
至此整个DaoCloud Enterprise环境的部署就到这里,后续会不定期更新DCE环境具体使用相关的文章,敬请期待。
评论前必须登录!
注册