# Container Orchestration

## Summary


Container orchestration is the process of deploying containers on a compute cluster consisting of multiple nodes. Orchestration tools extend lifecycle management capabilities to complex, multi-container workloads deployed on a cluster of machines. By abstracting the host infrastructure, container orchestration tools allow the users deploying to entire cluster as a single deployment target. 

The rise of lightweight and flexible containers, have given rise to new application architectures and fundamentally changed how applications are deployed and visualised today. The containerisation approach is to package the different services that constitute an application into separate compute containers, and to deploy those containers across a cluster of physical or virtual machines. With the rise of containerisation the need container orchestration all but obvious. As a definition, 

> Container orchestration is a process that automates the deployment, management, scaling, networking, and availability of container-based applications.

## Discussion

### What's the process of Container Orchestration?

The process of deploying containers to multiple virtual machines or physical machines within a cluster to implement an application can be optimized through automation. This becomes more and more valuable as the number of containers and hosts grow. Container Orchestration envisions a number of features, some of which are mentioned below: 

    + Provisioning hosts
    + Instantiating a set of containers
    + Rescheduling failed containers
    + Linking containers together through agreed interfaces
    + Exposing services to machines outside of the cluster
    + Scaling out or down the cluster by adding or removing containers

### Where does container orchestration fit within the system stack?

Container orchestration mediates between the apps or services above and the container runtimes below. Three main functional aspects of what they do include: 

    + **Service Management**: Labels, groups, namespaces, dependencies, load balancing, readiness checks.
    + **Scheduling**: Allocation, replication, resurrection, rescheduling, rolling deployment, upgrades, downgrades.
    + **Resource Management**: Memory, CPU, GPU, volumes, ports, IPs.A survey from 2016 indicated that among the features considered important are Scheduling, Cluster Management, Service Discovery, Provisioning and Monitoring. 

In addition to the above, there are a number of non-functional aspects that are important: scalability, availability, flexibility, usability, portability, and security. 


### What are some Container Orchestration tools available?

Some container orchestration tools worth mentioning include the following: 

    + **Docker Swarm:** Provides native clustering functionality for Docker containers, which turns a group of Docker engines into a single, virtual Docker engine.
    + **Google Container Engine:** Google Container Engine, built on Kubernetes, lets you run Docker containers on the Google Cloud.
    + **Kubernetes:** An orchestration system for Docker containers. It handles scheduling and manages workloads based on user-defined parameters.
    + **Mesosphere Marathon:** Marathon is a container orchestration framework for Apache Mesos that is designed to launch long-running applications.
    + **Amazon ECS:** The ECS supports Docker containers and lets you run applications on a managed cluster of Amazon EC2 instances.
    + **Azure Container Service (ACS):** ACS lets you create a cluster of virtual machines that act as container hosts along with master machines that are used to manage your application containers.
    + **Cloud Foundry’s Diego:** Container management system that combines a scheduler, runner, and health manager.
    + **CoreOS Fleet:** Container management tool that lets you deploy Docker containers on hosts in a cluster as well as distribute services across a cluster.

### Which container orchestration tool should I use?

It's been said that Kubernetes has been widely adopted, particularly for stateless, composable workloads. Marathon is designed for long-running apps. Marathon can handle persistent containers. Those offered by Google, Amazon and Microsoft may result in vendor lock-in: it may be difficult to move your app to another provider at a later point. If you wish to build your own Platform-as-a-Service (PaaS), take a look at Cloud Foundry. 

Among the lesser known names are Cattle, Shipyard, Nomad, Empire, Aurora, Singularity, PaaSTA and Titus. In fact, some are tools and some are frameworks. Kubernetes is an orchestrator by itself. Apache Mesos is a distributed systems kernel upon which you can build custom orchestrators. DC/OS and Marathon is implementations on top of Mesos. Shipyard is considered an orchestrator orchestrator because it uses Docker Swarm. Amazon EC2 is an IaaS and Empire is a PaaS for containers, and both these have orchestrators built into them. 


### What are some security considerations when working with container orchestration tools?

While many of the concerns when using containers are common to bare metal deployments, containers provide an opportunity to improve levels of security if used properly. Because containers are so lightweight and easy to use, it's easy to deploy them for very specific purposes, and the container technology helps ensure that only the minimum required capabilities are exposed. 


### Are there alternatives to managing containers without using an orchestration platform?

While orchestration platforms (Docket Swarm, Kubernetes) are easier to use, there are other alternatives that may suit some teams. Those with programming background could use shell scripting to customize to their requirements. The same can be said of those who use configuration management tools for deployment. On the other end of the scale, teams can simply subscribe to a Containers-as-a-Service (CaaS) for minimal maintenance. For example, Google Kubernetes Engine (GKE) abstracts away and manages Kubernetes master nodes for you. 

## Milestones

2009

At UC Berkeley, **Mesos** starts as a research project to improve cluster utilization. The concept of containers is unknown at this time but there's a need to manage clusters of resources. Cluster frameworks MapReduce and MPI are examples. Mesos gives a common layer spanning diverse cluster computing frameworks. 

Jul  
2015

Version 1.0 of **Kubernetes** is released. It also becomes part of Cloud Native Computing Foundation (CNCF). Kubernetes was previously open sourced by Google in June 2014. 

Sep  
2015

Hashicorp's **Nomad** is released as a "cluster manager and scheduler designed for microservices and batch workloads". 

Nov  
2015

Version 1.0 of **Docker Swarm** is released. During beta, it was used for running 1,000 nodes and 30,000 containers on EC2. It was able to schedule containers in less than half a second. In July 2016, this is released as part of Docker v1.12 and is known as **Swarm Mode**. 

Oct  
2017

Docker announces that it will support Kubernetes. This means that operations have more choice (Docker Swarm Mode or Kubernetes) for managing their clusters/containers.