容器化和Docker的兴起
容器平台的优势
容器和容器平台提供了对于传统虚拟化更多的优势。容器是在内核级别中进行隔离,所以更加高效,快速和轻量
。容器在独立的环境中封装带来很多优势,如:程序快速部署,具有可伸缩性,部署环境更接近开发环境等。
Docker出现
Docker是目前最流行的平台之一。尽管隔离环境的想法很早提出,而且有很多其他的容器软件,但Docker的出现在对的时间,并且一开始就开源,更容易在那时候的市场占领主导权。
Docker的特点
- Container Runtime: Docker Engine 是一个运行时,允许创建和运行容器
- Docker Hub: 是一个对于存储和分享images的服务
编排系统的需求
问题与解决
问题:当Docker提供了一个对于打包和分发容器化应用的标准,就出现了新问题。 这些容器间如何协调和调度?不同容器间如何交互?容器实例又如何进行伸缩?
解决:这时候,编排容器的解决方案就出现了。一些流行的选择,如Kubernetes
, Mesos
, 和Docker Swarm
, 提供了对于一个集群机器像是操作一台机器一样的概念,这个对于大型环境是非常重要的。
当人们在说Kubernetes 和 Docker
比较时,其实是想比较 Kubernetes和Docker Swarm
.
选型:但如果你想快速组建非关键应用的集群,可以用Docker Swarm; 但如果想要用在商业关键应用上还是Kubernetes更成熟可靠,当然学习成本更高一些。
Docker Swarm
Docker swarm是Docker自己的容器编排的解决方案,优点是轻量和是Docker原生API。像是大多数的调度系统一样,Docker Swarm也提供了在不同服务集群之中管理大量的容器的方法。其调度系统可以在一个集群中选择节点去部署容器。
Docker Swarm is a clustering and scheduling tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system.
Kubernetes
Kubernetes 是Google开发的容器编排系统,现在由CNCF( Cloud Native Computing Foundation)维护,已开源。具有Google多年在容器管理的经验的产品。是一个全面的系统,可以对于容器化的应用进行自动部署,调度,伸缩。
Kubernetes定义: is an open-source container-orchestration system for automating application deployment, scaling, and management. It was originally designed by Google, and is now maintained by the Cloud Native Computing Foundation.
kubernetes的使用场景:With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day.
Containerization helps package software to serve these goals, enabling applications to be released and updated in an easy and fast way without downtime. Kubernetes helps you make sure those containerized applications run where and when you want, and helps them find the resources and tools they need to work.
现在,Kubernetes 占领领先地位,具有编排容器和部署分布式应用的的标准化方法。Kubernetes 可以在云或是内部部署(on-premises), 高度模块化,开源并且有活跃的社区。许多云服务商也提供Kubernetes作为服务。
计算机英语词汇
container
con·tain·er /kən'teɪnər / noun [C] ** something such as a box or bowl that you use to keep things in
Docker is the world’s leading software container runtime platform.
orchestrate
or·ches·trate / 'ɔrkə,streɪt/ verb [T] to arrange something carefully, and sometimes unfairly, so as to achieve a desired result
Solutions for orchestrating containers, like Kubernetes, Mesos, and Docker Swarm, soon emerged.
cluster
clus·ter/'klʌstər/ noun [C] * a number of similar things that occur together
You need multiple machines (also called nodes) to be running in a cluster (i.e networked and talking to each other) and deploy these containers to them.