Tiago Almeida

Feb 8, 2021

3 min read

Kubernetes at the Snap of your Fingers

create a kubernetes lab faster than cooking noodles!

Objective

Our main goal is to setup a multi node Kubernetes cluster for development or study purposes. This setup provides a production-like cluster that can be setup on your local machine.

Why not minikube?

Minikube provides an excellent platform for getting started but it doesn’t provide the opportunity to work with a multi-node clusters which can help solve problems or bugs that are related to application design and archictecture.

With a multi node deployment you have an environment almost similar to production ones.

Reducing the pain

Deploying a kubernetes cluster is kinda easy these days and you have a lot of tools to do the job at your disposal (like kubespray, kops, conjure and so on) But you still have a little hasle.

We will going to use Vagrant and Ansible to provide you all the infra, os installed and kubernetes deployed!

Vagrant is a tool that will allow us to create a virtual environment easily and it eliminates pitfalls that cause the works-on-my-machine phenomenon. It can be used with multiple providers such as Oracle VirtualBox, VMware, KVM, Docker, and so on. It allows us to create a disposable environment by making use of configuration files.

Ansible is an infrastructure automation engine that automates software configuration management. It is agentless and allows us to use SSH keys for connecting to remote machines. Ansible playbooks are written in yaml and offer inventory management in simple text files.

Prerequisites

Software:

Hardware:

  • CPU: 4 cores or more
  • MEM: 8GB or more
  • HD: A least 10 GB

How to Do

Assuming that you have installed all prerequisite softwares above, let’s start by cloning my git repo with all files needed by the project. The command below will copy everything to your machine:

git clone https://github.com/tiagovdaa/k8s-lab.git

Now it’s time to bring all the environment up. It’s simple, just type ‘vagrant up’!

Go make your noodles or a cup of coffee and when you get back everything should be up and running! 🤘

Go play with it, deploy some apps, test it and evolve your kubernetes skils!

If you have any comments or doubts you can reach me in one of the social medias:

https://linktr.ee/tiagovdaa