Kubernetes入门-03.容器编排
本系列课程翻译自Linux Foundation开源软件学园的课程——kubernetes入门(LFS158)
Chapter Overview
Container images allow us to confine the application code, its runtime, and all of its dependencies in a pre-defined format. The container runtimes like runC, containerd, or cri-o can use pre-packaged images as a source to create and run one or more containers. These runtimes are capable of running containers on a single host, however, in practice, we would like to have a fault-tolerant and scalable solution, achieved by building a single controller/management unit, a collection of multiple hosts connected together. This controller/management unit is generally referred to as a container orchestrator.
In this chapter, we will explore why we should use container orchestrators, different implementations of container orchestrators, and where to deploy them.
译:
容器镜像允许我们将应用程序代码、它的runtime、以及所有它们的依赖限定在一个预先定义好的格式(把它们打包到一起)。容器runtime比如runC、containerd、cri-o可以使用预打包镜像作为资源,来创建和运行一个或多个容器。这些runtime有能力在一个单独的主机上运行容器,然而在实践中,我们需要一个有容错能力的、可扩展的解决方案,即通过构建一个控制器/管理单元来将多个主机连接到一起。这种控制器/管理单元通常被称之为“容器编排器-container orchestrator”
在这个章节中,我们将探索我们为什么需要使用容器编排器,容器编排器的不同实现,在哪里部署它们。
Learning Objectives
By the end of this chapter, you should be able to:
- Define the concept of container orchestration.
- Explain the benefits of using container orchestration.
- Discuss different container orchestration options.
- Discuss different container orchestration deployment options.
译:
在本章的最后,你将能够:
- 定义容器编排方案的概念
- 解释使用容器编排方案的优势
- 讨论不同的容器编排方案
- 讨论不同的容器编排方案部署模式
What Are Containers?
Before we dive into container orchestration, let's review first what containers are.
Containers are an application-centric method to deliver high-performing, scalable applications on any infrastructure of your choice. Containers are best suited to deliver microservices by providing portable, isolated virtual environments for applications to run without interference from other running applications.
译:
在我们深入探讨容器编排方案之前,让我们首先来回顾一下什么是容器。容器是以应用程序为中心的,以便在你选择的任何基础设施上交付高性能、可扩展的应用的一种方式。容器是交付微服务的最佳选择,因为它提供了可移植的、为应用程序运行提供了隔离的虚拟环境,从而让应用的运行不会与其他运行中应用产生相互干扰。

Container Deployment
Microservices are lightweight applications written in various modern programming languages, with specific dependencies, libraries and environmental requirements. To ensure that an application has everything it needs to run successfully it is packaged together with its dependencies.
Containers encapsulate microservices and their dependencies but do not run them directly. Containers run container images.
A container image bundles the application along with its runtime, libraries, and dependencies, and it represents the source of a container deployed to offer an isolated executable environment for the application. Containers can be deployed from a specific image on many platforms, such as workstations, Virtual Machines, public cloud, etc.
译:
微服务是轻量级的应用程序,由各种现代化编程语言所编写,拥有特定的依赖、库和运行环境需求。为了确保应用程序成功运行所需要的一切,容器会将这些所有的依赖、库、运行环境需求打包到一起。
容器封装了微服务和它们的依赖,但不会直接运行它们,容器里运行的是容器镜像。
一个容器镜像将应用程序和它的runtime、库、依赖做好绑定。容器为应用程序提供隔离的可执行环境,而容器镜像就是容器的源。容器可以在很多平台上由一个特定的镜像进行部署,这些平台包括workstation、虚拟机、公有云等。
What Is Container Orchestration?
In Development (Dev) environments, running containers on a single host for development and testing of applications may be a suitable option. However, when migrating to Quality Assurance (QA) and Production (Prod) environments, that is no longer a viable option because the applications and services need to meet specific requirements:
- Fault-tolerance
- On-demand scalability
- Optimal resource usage
- Auto-discovery to automatically discover and communicate with each other
- Accessibility from the outside world
- Seamless updates/rollbacks without any downtime.
Container orchestrators are tools which group systems together to form clusters where containers' deployment and management is automated at scale while meeting the requirements mentioned above. The clustered systems confer the advantages of distributed systems, such as increased performance, cost efficiency, reliability, workload distribution, and reduced latency.
译:
在开发环境中,在一个单台主机上运行容器来进行应用开发或者测试是非常合适的方案。然而,当我们迁移到QA环境和生产环境时,在单机运行容器就不是一个切实可行的方案,因为我们的应用程序和服务必须满足下面所列举的要求:
- 容错
- 按需扩展
- 最佳的资源利用率
- 自动发现,自动发现彼此并自动完成通信
- 可以从外部世界进行访问
- 无缝更新/回滚,而不会造成任何downtime
容器编排器是一种满足上述需求的工具,它将系统组织在一起以形成集群。在集群中,容器的部署和管理可以在满足上述需求的同时实现大规模自动化。集群系统具有分布式系统的优点,例如提升了性能、成本效率、可靠性、工作负载的均衡、减少延迟等。
Container Orchestrators
With enterprises containerizing their applications and moving them to the cloud, there is a growing demand for container orchestration solutions. While there are many solutions available, some are mere re-distributions of well-established container orchestration tools, enriched with features and, sometimes, with certain limitations in flexibility.
Although not exhaustive, the list below provides a few different container orchestration tools and services available today:
- Amazon Elastic Container Service
Amazon Elastic Container Service (ECS) is a hosted service provided by Amazon Web Services (AWS) to run containers at scale on its infrastructure. - Azure Container Instances
Azure Container Instance (ACI) is a basic container orchestration service provided by Microsoft Azure. - Azure Service Fabric
Azure Service Fabric is an open source container orchestrator provided by Microsoft Azure. - Kubernetes
Kubernetes is an open source orchestration tool, originally started by Google, today part of the Cloud Native Computing Foundation (CNCF) project. - Nomad
Nomad is the container and workload orchestrator provided by HashiCorp. - Docker Swarm
Docker Swarm is a container orchestrator provided by Docker, Inc. It is part of Docker Engine.
Container orchestrators are also explored in another Linux Foundation course, "Introduction to Cloud Infrastructure Technologies" (LFS151). We highly recommend that you take this course.
译:
当企业把应用程序进行容器化,并且将应用搬迁到云上,容器编排解决方案的需求将越发旺盛。尽管当前有许多可用的方案,但有些仅仅只是已有容器编排方案/工具的重新发版,丰富了其特性,有时还在灵活性上有一些限制。
虽然不是特别详尽,下面这个清单还是罗列了一些现在可以使用的不同容器编排方案和服务:
- Amazon Elastic Container Service
Amazon Elastic Container Service(ECS)是一个托管服务,由AWS提供,用于在AWS的基础设施上大规模运行容器。
- Azure Container Instance
ACI是一个基础的容器编排方案服务,由微软Azure提供
- Azure Service Fabric
Azure Service Fabric是一个开源容器编排器,由微软Azure提供
- Kubernetes
Kubernetes是一个开源容器编排工具,最早起源于Google,现在属于CNCF项目的一部分
- Nomad
Nomad是一个容器和workload编排工具,由HashCorp提供。
- Docker Swarm
Docker Swarm是一个容器编排器,由Docker公司提供,现在是Docker Engine的一部分。
容器编排方案在其他的linux基金会课程中也有提及,“Introduction to Cloud Infrastructure Technologies(LFS151)”,我们强烈推荐你参加这门课程。
Why Use Container Orchestrators?
Although we can manually maintain a couple of containers or write scripts to manage the lifecycle of dozens of containers, orchestrators make things much easier for users especially when it comes to managing hundreds or thousands of containers running on a global infrastructure.
Most container orchestrators can:
- Group hosts together while creating a cluster, in order to leverage the benefits of distributed systems.
- Schedule containers to run on hosts in the cluster based on resources availability.
- Enable containers in a cluster to communicate with each other regardless of the host they are deployed to in the cluster.
- Bind containers and storage resources.
- Group sets of similar containers and bind them to load-balancing constructs to simplify access to containerized applications by creating an interface, a level of abstraction between the containers and the client.
- Manage and optimize resource usage.
- Allow for implementation of policies to secure access to applications running inside containers.
With all these configurable yet flexible features, container orchestrators are an obvious choice when it comes to managing containerized applications at scale. In this course, we will explore Kubernetes, one of the most in-demand container orchestration tools available today.
译:
尽管我们可以手动维护一些容器,或者是通过编写脚本来管理一组容器的生命周期,不过有编排器则会让用户更加轻松,尤其是当你的基础设施遍布全球,有着数百、上千个运行着的容器的时候。
大部分容器编排方案都可以:
- 将主机组织在一起组成一个集群,以便充分利用分布式系统的优势
- 基于资源可用率,在集群中的主机上调度容器的运行
- 允许集群中的容器相互通信,而无论主机在集群中是如何部署的
- 将容器和存储资源绑定
- 将一系列类似的容器进行分组,来实现负载均衡,并通过创建接口(一个抽象的级别)来简化用户到容器之间的访问。
- 管理和优化资源利用率
- 允许部署(访问)策略来确保容器中应用程序的安全
由于具有以上这些可配置的、灵活的特性,容器编排方案很明显是管理大规模容器应用的优选。在这门课程中,我们将探索kubernetes,是当前最受欢迎的容器编排方案。
Where to Deploy Container Orchestrators?
Most container orchestrators can be deployed on the infrastructure of our choice - on bare metal, Virtual Machines, on-premises, on public and hybrid clouds. Kubernetes, for example, can be deployed on a workstation, with or without an isolation layer such as a local hypervisor or container runtime, inside a company's data center, in the cloud on AWS Elastic Compute Cloud (EC2) instances, Google Compute Engine (GCE) VMs, DigitalOcean Droplets, IBM Virtual Servers, OpenStack, etc.
In addition, there are turnkey cloud solutions which allow production Kubernetes clusters to be installed, with only a few commands, on top of cloud Infrastructures-as-a-Service. These solutions paved the way for the managed container orchestration as-a-Service, more specifically the managed Kubernetes as-a-Service (KaaS) solution, offered and hosted by the major cloud providers. Examples of KaaS solutions are Amazon Elastic Kubernetes Service (Amazon EKS), Azure Kubernetes Service (AKS), DigitalOcean Kubernetes, Google Kubernetes Engine (GKE), IBM Cloud Kubernetes Service, Oracle Container Engine for Kubernetes, or VMware Tanzu Kubernetes Grid.
大部分容器编排方案都可以部署在我们所选择的基础设施上--裸金属、虚拟机、本地化、公有云或混合云。以Kubernetes为例,就可以部署在workstation,with/without隔离层作为本地hypervisor或容器运行时,在公司的数据中心内,在AWS的EC2实力上,Google的GCE虚机上,DigitalOcean Droplets上,IBM虚拟服务器上,Openstack等等。
除此之外,还有一些开箱即用的云服务方案,允许通过少量命令就可以在云上安装生产级别的kubernetes集群,这样的服务在云的IaaS之上。这些方案为管理容器化编排as a service铺平道路,它们将管理容器编排作为一种服务,或者更具体地说管理Kubernetes为服务(Kubernetes as a service),由大部分云厂所提供和托管。这些KaaS服务例如Amazon EKS,AKS,DigitalOcean Kubernets,GKE,IBM cloud kubernetes service,Oracle Container Engine for Kubernetes,Vmware tanzu Kubernetes Grid。
更多推荐
所有评论(0)