So many parts of our society include virtualization. We will explain some uses of virtualization on Linux today. We already spoke about VirtualBox in some detail. Today, we will discuss Vagrant, Docker, Kubernetes, KVM and Xen, introducing their use cases and limitations. Most development teams need an environment to test in or deploy in. So, let’s see what there is to know about virtualization on Linux.
If you own an Android, you’re using a virtual machine every day. This is because the application layer is isolated in its own virtual machine making the Linux kernel ran on it much safer, isolating your personal information to some degree. Today, we are talking about development virtualization and also server-side virtualization. Many times, developers take great pains to get their environment just right. This is because the more identical your development environment is to your deployment environment, the better. This is so that your packages are all there, as well as to make sure you don’t have any version control issues, ultimately making the deployment process easier. With some solutions, you can just zip it up and SCP(secure copy) the virtual image right to your server, then start it right up. Other solutions require something like Ansible to duplicate the conditions on your deployment server. All of these virtualization technologies are very useful. It just depends on what your needs are and what you think virtualization can do for you.
Vagrant is a virtualization companion application written in Ruby, Vagrant uses VirtualBox to build a virtual machine very fast and headlessly, meaning there is no GUI, just a good old terminal interface. The workflow is similar to Docker, as you can load a virtual image that has been pre-built for a number of uses. It has a default starter server based on Ubuntu, used in the starter documentation. To see what is out there, all you need to do is go to Vagrant Cloud to find a Box to try out, making it effortless for beginners and very user-friendly in general. We will write a blog about it next in the virtualization series, as we will mention these in the order you see them here. So, you can see how development teams and hobbyist alike can find some value in Vagrant.
Docker is a great tool to be used on your workstation as well as your server. You can make a local image using docker compose or, similar to Vagrant, go over to Docker Hub and find a purpose-built image that can suit your needs. Docker is not a virtual machine, rather it is a virtual container. This means that it shares a lot more resources with the host machine. Effectively sand boxed for a substantial layer of security. Making it very fast to get through development straight to deployment in no time. This is also very useful if you want to spawn some crypto miners on many machines without too much hassle. During my research, I have seen some very creative solutions with Docker.
Kubernetes also known as K8s, is for managing containerized applications. Mostly used across multiple host to keep applications stay up when experiencing lots of traffic. Thus load balancing the work over many servers. Keeping your deployment environment stable and production ready. Kubernetes does this by spinning as many instances of a container as you specify across the available servers in the network. You can even setup Kubernetes on a cluster of Raspberry Pi to do some fun experiments. In fact, Kubernetes can be used to scale containers served by Docker. Multiplying your efforts as your service grows. Kubernetes is hosted by the Cloud Native Computing Foundation, forged over time in production environments at Google. Making it a market tested, proven technology.
KVM(Kernel-based Virtual Machine), the native Linux virtualization solution. Built right into the kernel, KVM provides you with a bare-metal virtualization environment. You can really make a data center using KVM. It has several advantages over the rest, starting with performance. Since it is native and not an extra layer, you are guaranteed to have higher speeds. The next excellent reason is KVM is easy to scale. Meaning, you should not have to switch up just to meet demand. The next reason is security. KVM is part of the kernel, so it benefits from one of the biggest open-source communities eyes on the code, meaning they are doing a fantastic job looking after the security issues on a kernel layer, just one reason Linux is better than Windows. Last, we would like to mention how cost-effective it is. It comes with your operating system. So if you are not paying for that, like most Linux users, then it is free. Do donate to developers that create your favorite open-source tech, as that is one way to show you appreciate the work.
Finally, Xen is a community project with quite a few years under its belt. It is possible to install Xen on many distributions. There is a ton of documentation due to how long it has been out. Making Xen a tried and true solution to build your infrastructure needs. Be it a data center, some websites, or running something like Citrix for an office. Xen is a virtualization solution for your ever-growing needs. Unlike Docker or Vagrant, you have to build it all yourself from the ground up. This can be tedious to many, but good documentation is key to making your own to follow some scripts that you ultimately will make to speed things up in the future. The other good thing about its age is, Xen already has much documentation spread all over the web. You can find other people’s projects to learn from, making it a very fun puzzle. This can be very gratifying, even if all you get is a hello world application running.
Just remember, all this technology is here to help you be creative. This means you will have to train yourself in the ways of the system admin. You can really build what you want. Don’t let anyone discourage you with how hard something might be. The harder, the higher the gratification. When you set out with an idea in your head, and you have a trusty search engine, you can make it. You can pull through with more than you think. Sure, your first creation might be less than you want, perhaps even a little ugly. In my family, we never give up; that is the Gordon way. Thanks for reading.