Skip to content

Create a local kubernetes cluster using virtualbox.

Notifications You must be signed in to change notification settings

panta-123/k8s-vagrant-virtualbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

k8s-vagrant-virtualbox

Create a local kubernetes cluster using virtualbox. A modification of the great work danielepolencic did in his gist.

The vagrant file will do the following:

  1. Provision all local VMs using VirtualBox
  2. Patch the OS
  3. Install Docker
  4. Install k8s control plane
  5. Initialize cluster with Flannel CIDR block & install Flannel
  6. Join the nodes to the master
  7. Create and copy the SSH key to all machines so you can SSH to any node from the Master. Add names & IPs to the local hosts file on each master and node. Create alias in vagrant home for kubectl...just use k
  8. Make required Ubuntu OS mods for the cluster to function properly

Dependencies

You should install VirtualBox and Vagrant before you start.

Open a shell and install the vagrant disksize plugin:

$ vagrant plugin install vagrant-disksize

Make sure git is installed

Instal git if you don't already have it.

Open a shell and clone

$ git clone [email protected]:LocusInnovations/k8s-vagrant-virtualbox.git
$ cd k8s-vagrant-virtualbox

Starting the cluster

You can create the cluster with:

$ vagrant up

Clean up

You can delete the cluster with:

$ vagrant destroy -f

SSH and other Commands

SSH to Master and other Nodes:

$ vagrant ssh master
$ vagrant ssh node1
$ vagrant ssh node2
$ vagrant ssh node3

Get the status of the Nodes:

$ k get nodes -o wide
NAME     STATUS   ROLES    AGE     VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
master   Ready    master   16m     v1.17.4   10.0.0.10     <none>        Ubuntu 18.04.4 LTS   4.15.0-88-generic   docker://19.3.6
node1    Ready    <none>   11m     v1.17.4   10.0.0.11     <none>        Ubuntu 18.04.4 LTS   4.15.0-88-generic   docker://19.3.6
node2    Ready    <none>   6m31s   v1.17.4   10.0.0.12     <none>        Ubuntu 18.04.4 LTS   4.15.0-88-generic   docker://19.3.6
node3    Ready    <none>   102s    v1.17.4   10.0.0.13     <none>        Ubuntu 18.04.4 LTS   4.15.0-88-generic   docker://19.3.6

SSH to other Nodes in the cluster from the Master:

$ ssh node1
$ ssh node2
$ ssh node3

About

Create a local kubernetes cluster using virtualbox.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published