Skip to content

checktor/virtkube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

virtkube

virtkube implements a local Kubernetes cluster running on multiple virtual machines provisioned by Vagrant. It uses kubeadm to set up the cluster from scratch based on minimal Ubuntu images for each node. In comparison to minikube, this tool does not provision a single-node cluster. The smallest possible infrastructure consists of one controlplane and one worker node. This is intentional because virtkube's primary goal is to provide a development cluster as close as possible to a productive Kubernetes deployment.

Prerequisites

Vagrant

Vagrant can be installed on macOS, Linux, and Windows. Follow HashiCorp's installation manual for your desired operating system.

Virtualization tool like VirtualBox

Vagrant works with multiple virtualization tools. This project is tested with VirtualBox. Consult the official documentation for further information on the installation procedure.

Cluster management

Create cluster

vagrant up

Configure kubectl to work with cluster

Use kubeconfig file in sync folder for kubectl authentication.

export KUBECONFIG=/path/to/sync/kubeconfig
kubectl get pods -A

Connect to cluster VMs

You can access a specific cluster VM by running vagrant ssh <VM-name>, e.g. vagrant ssh worker_0 to connect to first worker node.

Remove cluster

vagrant destroy -f

Integration tests

Use Helm chart in canary folder to test Kubernetes cluster setup. You might need to install Helm first.

Install chart

export KUBECONFIG=/path/to/sync/kubeconfig
helm install canary ./canary

Execute tests

helm test canary

You might need to manually delete canary-test-connection pod by running kubectl delete pod canary-test-connection before re-executing the tests.

Remove chart

helm uninstall canary

Cluster configuration

The number of controlplane and worker nodes can be configured using num_controlplanes and num_workers variables in Vagrantfile. In case multiple controlplane nodes are configured, a corresponding load balancer based on HAProxy will be provisioned.

Further tools

The following dependencies are used to provision the cluster: