A comparison between VM’s and Containers

A comparison between VM’s and Containers

Hey Guys,

This article is the first in the series of articles where we will learn all about Kubernetes and the details of container orchestration systems and their impact in today's DevOps. Follow me for more !

Let's get started by laying out some foundation !!

Virtual Machines and Containers......

Virtual Machines

Virtual Machines are virtualisation of a computer system often to run an operating system on top of a hypervisor. A hypervisor is a software that creates and runs virtual machines. A hypervisor allows one host computer to support multiple guest VMs by virtually sharing its resources, such as memory and CPU.

So if you have a Linux virtual machine, the application running on top of it should support Linux operating system and all the dependencies of the application should be installed on the virtual machine, like the dependant libraries, binaries and the correct version of each of them.

So here is the problem with the application lifecycle consisting of development -> test -> integration/staging -> production maintaining all of these versions is hard and obviously there is a lot of overhead of configuring these VM’s every time you want to use a new VM for deployment.

Scaling the workloads during the time of the day, time of the month or time of the year is hard. Abrupt traffic during holidays or some news or marketing campaign is really hard to manage or you need to pre-provision and loose a lot of $ dollars for the time when there is no need to have so many resources for so little traffic.

Containers

Containers on the other hand are units of deployment that can be easily ported between dev/test/integration/production environments. You can package all of your dependencies with your application code in a single binary and then deploy it wherever you want, the condition is linux containers will only run on linux based VM’s or physical machines. You can although run different flavoured linux containers since the kernel space usually remains the same and most of the changes are in the user space.

Containers are very light weight and do not take as much time to spin up as the VM, hence the scaling is far more easier. A VM image is around 20 - 30 GB whereas a container image is merely 30-40 Mb. The size although can vary but you get the idea!.

Containers can easily run on container runtime software like Docker , And this is something you can do in your production environment and Local Environment with the same effort.

Deploying to production has never been easier, you can easily setup your CI/CD pipelines (Continuous Integration/Continuous Deployment) to do some checks and create a fresh container image with the changes which can be deployed to your production environment.

All the containers are generally pushed to a container registry and pulled from there by anyone around the globe.

Resources such as Memory and Cpu of the host machine are much better utilised by the containers than by the VMs.

Kubernetes helps us create, manage and scale these workloads. It also helps in balancing load between multiple containers of our application.

Kubernetes is awesome, I can’t wait to get into the details.