Skip to content

Instantly share code, notes, and snippets.

@KJBrock
Forked from initcron/vagrant-setup-k8s.md
Created October 26, 2020 17:30
Show Gist options
  • Select an option

  • Save KJBrock/19b011b796dd4f75b5ebfc3ba2857cae to your computer and use it in GitHub Desktop.

Select an option

Save KJBrock/19b011b796dd4f75b5ebfc3ba2857cae to your computer and use it in GitHub Desktop.

Install VirtualBox and Vagrant

TOOL VERSION LINK
VirtualBox latest https://www.virtualbox.org/wiki/Downloads
Vagrant latest https://www.vagrantup.com/downloads.html

Provisioning Vagrant Nodes

Clone repo if not already

git clone https://github.com/schoolofdevops/lab-setup.git


Launch environments with Vagrant

cd lab-setup/kubernetes/vagrant-kube-cluster

vagrant up

The above command will take some time and will download the image, setup VMs and configure those with everything required to configure the kubernetes cluster. This is also the setup where you may find and have to fix the majority of the issues.

Validating the Setup

Login to nodes

Open three different terminals to login to 3 nodes created with above command. For each terminal, before you run any vagrant command, make sure you are in the directory where Vagrantfile is.

Terminal 1

cd lab-setup/kubernetes/vagrant-kube-cluster
vagrant ssh kube-01
sudo su

kubectl version 
docker version 
kubeadm 

Terminal 2

cd lab-setup/kubernetes/vagrant-kube-cluster
vagrant ssh kube-02
sudo su

kubectl version 
docker version 
kubeadm 

Terminal 3

cd lab-setup/kubernetes/vagrant-kube-cluster
vagrant ssh kube-03
sudo su

kubectl version 
docker version 
kubeadm 

If you see the output for above commands, your environment is ready for kubernetes cluster setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment