A Complete Guide To Cloud Containers

Lakshmi Narasimhan Oct 05 - 8 min read

Audio : Listen to This Blog.

This blog article briefs the current technological trends and advances made to enable cloud scale orchestration possible. VMware brought physical machine virtualization to commercial world about a decade ago. Today it is Containers based micro services that is doing it again. Docker, Kubernetes and Mesos are being discussed everywhere and are projected as the next big thing to watch out for.

This article tries to explore this latest buzz around Containers.

1 Introduction

Physical machine virtualization has started off a great trend in many areas. Today virtualization is an umbrella term widely used everywhere. Any place, where a logical handle of a physical resource is provided, enabling sharing of the physical resource is deemed virtualized. Virtualization by extended definition enables higher utilization of deployed resources. There is not just compute [CPU] virtualization, there is storage and network virtualization too. It has been known for some time that CPU performance lay wasted, as its performance is far ahead than either the network or memory components. Therefore it was assumed virtualizing CPU would provide more benefits. The success of virtual machine adaptation in varied domain puts any argument against to rest, beyond any doubt.

Companies widely posted their success stories to describe the scaling of their physical infrastructure and failure resolution. Industry got busy integrating virtual machines as part of standard workflow. But then there was Google, who were not just experimenting but deploying with great success in live networks another new model called Containers. In short, containers are lightweight totally isolated userland sandbox for running processes when compared to virtual machines 1.

Before Software defined anything was even spoken about, Google had designed their very own Borg Cluster running and managing container based micro services. Google made lots of assumptions to begin with, and in hindsight some of them were great. This learning they had with container management is being used in the design and implementation of Kubernetes. The container lifecycle management by itself is done by Docker engine, part of Docker. And then there is Mesos.

To understand and appreciate Kubernetes, Mesos and Docker engine, it will be worth the effort to look at their fundamental building blocks.

Figure 1: VM vs Containers

2 Some History

Solaris projects/zones, BSD Jails and LXC containers all do userspace compartments. The basis for all this stems from chroot system call introduced way back in 1982! Although chroot accomplished a new root filesystem view for applications to run, it opened up the need for rest of the OS pieces to be virtualized too. And *bsd jails has been doing total container virtualization since time immemorial. But today, Linux seems to rule the world! With relatively recent advancements in Linux for control groups and namespaces, it enhanced Linux to have highly sandboxed environment for containers. And Docker Inc, opensourced a suite of tools, that provides a clean and easy workflow to distribute, create and run container based solutions.

And Kubernetes and Mesos applications are built over native OS support on containerization. It would be prudent to note that only userspace virtualization is possible in container world. If different versions of OS, or different OS are needed, then virtual machines are needed still. And with Windows OS, also working with Docker for container integration, we sure will see many cloud services being run as containers on multiple OS’es.

With that background out of our way, let us understand the major pieces that Docker has brought in today.

3 Build, Ship and Run anywhere

Why does everyone love containers? It makes development, test and deployment easy, by recreating the same environment from development everywhere.

Normally, requirements come from customers and an engineering team starts working on it. Once the application is signed off by dev team, then testing team tries to install the application, where all application dependencies needs to be satisfied. That is inhouse and the environment can be controlled. But deployment is never easy, because the customers environment can have conflicting set of applications running, and satisfying dependencies for the new application along with those existing, is to lightly put a nightmare. What does container world do here? Every application has its own set of libraries in the filesystem defined part of its image, and completely isolated from other processes/application in the system. Voila!! no more deployment nightmares. And setting up that entire applications based on containers has been nicely solved by Docker.

4 Docker Suite

Docker comes out with a suite of tools that together help organize, manage and deploy easily containers for real life applications.

4.1 Docker Engine

Docker engine is the core technology that enables creating, destroying and deploying containers. They connect to Docker Registry to pull/push container images. Docker engine has two parts to it. Docker engine server is a daemon that manages container lifecycle methods and exposes its functionality through a REST endpoint. A Docker command line program exists that can run anywhere and manage containers by connecting to the REST endpoint over the network.

4.2 Docker Registry

Docker Registry hosts container Images. These Registries are publicly available through Docker Hub. Additionally, these Registries can be setup inhouse as well. Docker Images are the containers filesystem. So, by defining a method for hosting these Images at a Registry, Docker has made is really easy to share Images across. Versioning of Docker images is also supported. Additionally, Docker Images are being developed inline with opencontainer initiative. https://www.opencontainers.org/

4.3 Docker Compose

This is a utility that helps setting up a multiple container application environment. With Docker Compose, a template can be defined that captures all the dependencies. This can then be passed along to Docker Compose, to create this environment repeatedly and easily everytime. As simple as running ”‘docker-compose up”’.

Figure 2: CloudApplications

4.4 Docker Machine

Docker machine can create virtual machines that can be readily used for container deployment. It uses virtualbox, or other supported drivers https://docs.docker.com/build/builders/drivers/docker/ to create the virtual machine that is docker ready.

4.5 KiteMatic

KiteMatic is Docker native GUI for working with containers locally on personal machine. It is currently supported on Mac and will support Windows soon. It installs a virtualbox and provisions containers inside a virtual machine locally.

4.6 Docker Swarm

Docker Swarm supports managing a cluster of machines in a network that is running Docker engine. Swarm agents running on each machine, run a voting algorithm and elect a master node for the cluster. All operations on the cluster are routed to the swarm master node. A distributed kv store like etcd, zookeeper or consul is used to keep the swarm nodes in good health and recover from node failures.

5 So what is Kubernetes and Mesos about?

Kubernetes and Mesos are higher level software stack used for managing applications on a cluster built over containers.

Just like the technology, applications 2 are changing too. We are so used to client-server applications where the applications were small and the servers powerful(consider databases, workflow apps etc). Those class of applications are fast changing. Today, cloud scale applications are another class of applications where the applications are resource hungry and individual servers can hardly satisfy them (think of youtube, twitter, facebook etc). So we should understand that LXC (linux containers) and docker engine play a key part in creating larger


Figure 3: Kubernetes Stack


Figure 4: Mesos Cluster Configuration

frameworks. But apart from using container technology as its basis, Kubernetes and Mesos approach cluster utilization in two different ways.

Kubernetes 3 understands and manages container based application lifecyles great. While Docker engine can ease out sharing container images, creating and running containers; applications are a slew of containers, that needs to be constantly updated, bugs fixed and new enhancements brought it or downgraded for any critical issues that are found, provide fault tolerance etc. Kubernetes is very good at enforcing application lifecycle management. We could really appreciate the power Kubernetes brings to the table. Google has applied its vast experience in running containers to the design, and it shows. Try comparing Kubernetes with Docker Compose or the concept of PODs, Replication Controller or Services on Kubernetes which are non-existant in Docker. But not all applications are micro services that can easily be packaged as a containers.

And that is where Mesos excels! Mesos 4 solves this other class of problems by integrating frameworks http://mesos.apache.org/documentation/latest/ mesos-frameworks/. Each of these frameworks are plugins to the Mesos. And these frameworks teach Mesos to handle new application classes, like mapreduce, MPI etc. Mesos natively only controls cluster membership and failovers.
Figure 5: Mesosphere Stack

The scheduling is offloaded to frameworks. Mesos slaves inform masters about resource availability, Mesos Master runs an Allocation Policy Module, which determines the framework to offer this resource. Frameworks decide to either accept or reject the offer. If accepted, then they provide details of the tasks to run, and the Mesos Master shares the task information to Mesos Slaves, that continue to run them and provide results and status as necessary.
What if one were to integrate these two software stacks together to get the best of both worlds! Mesosphere 5 did just that, they call it Datacenter Operating Systems (DCOS). But that is a story for another day.

 

References

  • Docker Inc, https://www.docker.com
  • Kubernetes, https://kubernetes.io
  • Mesos, http://mesos.apache.org/
  • Linux Containers, https://en.wikipedia.org/wiki/LXC
  • FreeBSD Jails, https://en.wikipedia.org/wiki/FreeBSD jail
  • Mesos, http://www.slideshare.net/Docker/building-web-scale-apps-withdocker-and-mesos
  • Mesosphere, http://www.slideshare.net/mesosphere/apache-mesos-andmesosphere-live-webcast-by-ceo-and-cofounder-florian-li
  • Mesos tech paper, http://mesos.berkeley.edu/mesos tech report.pdf
  • Kubernetes, http://www.slideshare.net/wattsteve/kubernetes-48013640
  • Containers for masses, http://patg.net/containers,virtualization,docker/2014/06/05/dockerintro/

Leave a Reply

Download our brochure to learn more about our Cloud Computing Solutions and Services