Azure 容器实例和容器协调器Azure Container Instances and container orchestrators

由于规模较小并面向应用程序,容器非常适合敏捷交付环境和基于微服务的体系结构。Because of their small size and application orientation, containers are well suited for agile delivery environments and microservice-based architectures. 自动化和管理大量容器及其交互方式的任务称为协调The task of automating and managing a large number of containers and how they interact is known as orchestration. 流行的容器业务流程协调程序包括 Kubernetes、DC/OS 和 Docker Swarm。Popular container orchestrators include Kubernetes, DC/OS, and Docker Swarm.

Azure 容器实例提供了业务流程平台的一些基本调度功能。Azure Container Instances provides some of the basic scheduling capabilities of orchestration platforms. 虽然它没有涵盖那些平台提供的更高价值的服务,但 Azure 容器实例可以作为它们的补充。And while it does not cover the higher-value services that those platforms provide, Azure Container Instances can be complementary to them. 本文介绍 Azure 容器实例的处理范围,以及整套容器协调器如何与它交互。This article describes the scope of what Azure Container Instances handles, and how full container orchestrators might interact with it.

传统的协调Traditional orchestration

协调的标准定义包括以下任务:The standard definition of orchestration includes the following tasks:

  • 调度:在给定容器映像和资源请求的情况下,找到适合运行容器的计算机。Scheduling: Given a container image and a resource request, find a suitable machine on which to run the container.
  • 关联/反关联:指定一组应该彼此靠近(为提高可用性)或保持足够距离(为提高性能)运行的容器。Affinity/Anti-affinity: Specify that a set of containers should run nearby each other (for performance) or sufficiently far apart (for availability).
  • 运行状况监视:监视容器故障并自动重新调度容器。Health monitoring: Watch for container failures and automatically reschedule them.
  • 故障转移:跟踪每台计算机上运行的组件,并将容器从有故障的计算机重新调度到正常的节点。Failover: Keep track of what is running on each machine, and reschedule containers from failed machines to healthy nodes.
  • 缩放:根据需要手动或自动添加或删除容器实例。Scaling: Add or remove container instances to match demand, either manually or automatically.
  • 网络:提供覆盖网络用于协调容器,以便跨多台主机通信。Networking: Provide an overlay network for coordinating containers to communicate across multiple host machines.
  • 服务发现:使容器能够自动找到对方,即便它们在主机之间移动并更改了 IP 地址。Service discovery: Enable containers to locate each other automatically, even as they move between host machines and change IP addresses.
  • 协调的应用程序升级:管理容器升级,避免应用程序关闭,并在出错的情况下回滚。Coordinated application upgrades: Manage container upgrades to avoid application downtime, and enable rollback if something goes wrong.

Azure 容器实例的协调:分层方法Orchestration with Azure Container Instances: A layered approach

Azure 容器实例支持分层的协调方法,提供全部所需的调度和管理功能来运行单个容器,同时允许协调器平台管理容器实例顶层的多容器任务。Azure Container Instances enables a layered approach to orchestration, providing all of the scheduling and management capabilities required to run a single container, while allowing orchestrator platforms to manage multi-container tasks on top of it.

由于容器实例的底层基础结构由 Azure 管理,因此容器协调器平台不需要考虑如何查找用于运行单个容器的适当主机。Because the underlying infrastructure for container instances is managed by Azure, an orchestrator platform does not need to concern itself with finding an appropriate host machine on which to run a single container. 云的弹性确保始终有一台可用的主机。The elasticity of the cloud ensures that one is always available. 协调器可将重心放在简化多容器体系结构的开发的任务上,包括缩放和协调的升级。Instead, the orchestrator can focus on the tasks that simplify the development of multi-container architectures, including scaling and coordinated upgrades.

方案Scenarios

尽管协调器与 Azure 容器实例的集成仍处于初步阶段,但我们可以预见到将来会出现一些不同的环境:While orchestrator integration with Azure Container Instances is still nascent, we anticipate that a few different environments will emerge:

以独占方式协调容器实例Orchestration of container instances exclusively

由于 Azure 容器实例可快速启动并按秒计费,专门以容器实例为基础的环境能够以最快的速度启动,并处理较大差异的工作负荷。Because they start quickly and bill by the second, an environment based exclusively on Azure Container Instances offers the fastest way to get started and to deal with highly variable workloads.

在虚拟机中合并容器实例和容器Combination of container instances and containers in Virtual Machines

对于长时间运行的稳定工作负荷,协调专用虚拟机群集中的容器通常比使用 Azure 容器实例运行相同的容器更节省。For long-running, stable workloads, orchestrating containers in a cluster of dedicated virtual machines is typically cheaper than running the same containers with Azure Container Instances. 但是,容器实例提供理想的解决方案来快速扩展和缩减整体容量,以处理意外的或短期高发的使用量。However, container instances offer a great solution for quickly expanding and contracting your overall capacity to deal with unexpected or short-lived spikes in usage.

业务流程协调程序不必先增加群集中的虚拟机数目,然后将更多的容器部署到这些计算机,而可以直接在 Azure 容器实例中调度更多的容器,并删除不再需要的容器。Rather than scaling out the number of virtual machines in your cluster, then deploying additional containers onto those machines, the orchestrator can simply schedule the additional containers in Azure Container Instances, and delete them when they're no longer needed.

后续步骤Next steps

使用快速入门指南创建第一个包含 Azure 容器实例的容器。Create your first container with Azure Container Instances using the quickstart guide.