前言
本书帮助读着学习,创建,部署容器网络以及提供一些容器网络的管理部署。Docker是一个可以提供轻量便携式部署以及生产级别的环境的Linux容器引擎,。这些环境可以逐步更新。Docker通过一些linux限制策略实现这些功能,比如:Cgroups控制以及Linux Namespace隔离,以及包含基础文件系统的镜像。
Docker提供网络原生,允许管理员给不同的应用指定不同的容器网络,在各自的网络中连接自己的组件,然后分发这些应用在服务器集群中,最后调度这些应用而不管这些应用是运行在物理机上或者虚拟机上。
这本书关注的是最新的容器网络技术并且提供深入的内容解释以及具体的步骤的细节。
这本书的主要内容
章节1,容器网络初级教程,解释了容器网络的基础组件,这些组件是从简单的耦合Docker抽象以及强大的容器组件抽象而来。比如:linux 网桥,Open vSwitch等等。这个章节也介绍了通过不同的模型来创建Docker 容器。在默认情况下,端口映射帮助我们通过使用 iptables NAT 规则,允许流量从宿主机到达容器。本章节稍后介绍了容器的基本连接以及讨论下一代容器网络技术即 libnetwork。
章节2,容器网络的内部组件,讨论了容器的内部网络架构。我们架构学到有关Docker的IPv4,IPv6以及DNS配置的知识。本章节的后部分介绍有关Docker桥接和单节点以及跨节点的容器通信知识。这个章节也阐述了overlay tunneling协议以及容器网络的不同的通信方式,比如:OVS网络,Fannel网络,以及Ware网络。
章节3,构建你的第一个网络,展示Docker容器如何使用不同的网络,比如:Weave网络,OVS网络和Flannel网络,进行跨主机通信。PipeWorks使用传统的Linux网桥,Weave创建一个虚拟网络,OVS网络使用GRE隧道技术,并且Flannel提供一个单独的子网来实现容器的跨主机通信。一些通信方案,比如:Pipework是传统的方案将会在一段时间被淘汰。然而一些方案是为了特定操作系统的环境中使用的,比如:适用于CoreOS系统的Flannel网络方案。在本章节中网络方案的基本的比较也会涉及。
章节4,Docker集群中的网络通信,深入解释了多种框架下的Docker网络,比如:原生的Docker Swarm,使用libnetwork网络或者开箱即用的overlay网络,Swarm提供了跨主机的网络通信特性。另一方面,Kubernetes有不同的Docker的方案,在Kubernetes集群中,每个pod有不同的IP地址并且pod之间通过服务实现通信。通过Open vSwitch或者IP转发高级路由规则,Kubernetes网络能被增强用以提高跨主机的不同子网之间的pod之间的连通性同时暴露端口给集群之外的服务器。在Mesosphere平台上,我们能了解到Marathon作为部署容器的网络的后端。在Mesosphere的DCOS(数据中心操作系统)平台,将完整部署机器堆栈作为一个机器为了在部署的容器服务之间提供一个丰富的网络体验。