“With the cloud, individuals and small businesses can snap their fingers and instantly set up enterprise-class services.”
~ Roy Stephan, Founder, and CEO of PierceMatrix.
What is Containerization?
Docker is dominating the world of containers. Container orchestration helps you to manage the complete lifecycle of the docker containers. It includes deployment, scaling up / down, monitoring the health of the containers, provisioning of the hosts, load balancing, resource sharing, etc.
Most of the applications consists of many components interconnected to make the application to be running. Likewise, when your application keeps growing, the number of docker containers associated with the applications also keep growing. Consider, your application consists of 100 docker containers, managing each and every container in terms of deployment, scaling, monitoring etc. would be extremely painful. Container orchestration comes into picture to solve this problem.
The orchestration layer bundles all the docker containers in an environment and takes up the responsibility for dynamically assigning work to the nodes which are available. Orchestration also helps in automating and streamlining many essential tasks which are associated to the docker container.
The major benefit of container orchestration is its flexibility to make sure all the concerns of the individual docker containers are addressed. Container orchestration is also portable so that you can move it to any cloud infrastructure.
Leaders of Container Orchestration
Two major container orchestration platforms in the current world are
- Docker Swarm
Let’s see about each one in a little detail and also compare the two container orchestration platforms against some metrics.
Docker swarm is the simplest Orchestration platforms amongst the two. This product is built from the docker team itself and it is built on top of docker. If you wanted to configure container orchestration platform quickly, then docker swarm is the most viable option to prefer.
Docker swarm is the collection of nodes / virtual machines which can be grouped to either manager nodes / worker nodes based on the requirements. Using Docker swarm, you can run the docker container in terms of service so that the service can be scaled up / down and can be replicated across multiple nodes within the cluster environment. Services can be run either globally or in a replicated fashion. When a service is marked to be deployed globally, every node within the Swarm cluster will hold a replica of the container, whereas in replication mode, the number of replicas decide the placement of the containers within the cluster. The manager nodes are responsible for the entire Swarm cluster and manage the resources of the worker nodes. Manger nodes uses Ingress load balancing to expose the service externally.
One another advantage of using Docker swarm is the availability of inbuilt DNS component. This can be used to distribute all the incoming requests to the service using the name of the service. Docker swarm uses volume mounts for storage purposes. Shared filesystems, NFS, iSCSI, and fibre channel can be configured within the nodes and the Docker containers can make use of the filesystems for persistent storage. Docker swarm has been tested with up to 30,000 containers running within 1000 nodes among which 1 node is a master node and 999 nodes are worker nodes.
The features of Kubernetes are listed as follows.
- Automatic Binpacking: Kubernetes helps in packaging the application and scheduling the containers automatically based on the resources available.
- Service Discovery & Load Balancing: Kubernetes will automatically assign IP address to the docker containers and also provides a separate DNS name for the set of containers which can load balance the inbound traffic within the cluster.
- Storage Orchestration: Kubernetes supports both local storage and public cloud provider. It also supports network storage systems such as NFS and iSCSI.
- Self-Healing: One of the main benefits of Kubernetes is the ability to self-heal. It automatically restarts the containers that fail during the execution. If a node itself becomes irresponsive, then the containers will be marked for scheduling to other available cluster nodes.
- Secret & Configuration Management: Without the need to rebuild the image, Kubernetes has the ability to update and deploy the secrets and the application configuration.
- Batch Execution: Kubernetes also helps in managing the batch and CI workloads.
- Horizontal Scaling: Scaling up / down of containers is possible in Kubernetes with just one command while using CLI or it can also be done easily using Kubernetes dashboard.
- Automatic Rollbacks & Rollouts: Kubernetes rollouts the updates progressively to the application by making sure not all the containers are updated at the same time. Instead, each replica will be updated one by one ensuring the high availability.
Docker Swarm Vs Kubernetes
Both Docker swarm and Kubernetes have its own advantages and disadvantages. The best pick will completely depend on the requirements. We have compared some of the features in the below table.
|Installation & cluster configuration||Quick and easy to install||Requires more time to get the cluster up and running|
|Scalability||Quick container deployment and scaling||It guarantees the cluster state thereby slowing down the container deployment and scaling|
|Load Balancing||Automated built-in load balancing||Load balancing can be done with manual service configuration thereby providing more control|
|Rollouts & rollbacks||The update is rolled out in stages to prevent service outage. It also allows rollback if something goes wrong||Kubernetes provides the update progressively to retain the availability of the service.|
|Networking||Docker swarm provides multi-host ingress network that connects the containers which are running on all the nodes within the cluster||Flannel is commonly used by Kubernetes to achieve networking. Containers are communication is possible via etcd.|
|Service Discovery||All containers within the cluster join the ingress network. Containers communicate through virtual private IP address and service names||Kubernetes mainly rely on etcd for service discovery. Some manually defined services can also provide service discovery in Kubernetes.|