vagrant configuration to deploy local kubernetes cluster
- install qemu/kvm https://help.ubuntu.com/community/KVM/Installation
- install virt-manager https://help.ubuntu.com/community/KVM/VirtManager
- install libvirt https://help.ubuntu.com/lts/serverguide/libvirt.html
- enable
libvirtd
daemon withsudo systemctl libvirtd
- create a storage pool with the name
vagrant
in virt-manager https://docs.fedoraproject.org/en-US/Fedora/18/html/Virtualization_Administration_Guide/sect-partbased-storage-pool.html - install vagrant https://www.vagrantup.com/downloads.html
cd $YOUR_PROJECT_DIR
git clone https://github.com/aakashRajur/kube-dev-bootstrap.git vagrant
cd vagrant
vagrant plugin install vagrant-env
- create an
.env
with allowed configs below vagrant up
to start the VMs- get kmaster's ip address with
vagrant ssh-config
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $KMASTER_IP_ADDRESS:/home/vagrant/.kube/config ~/.kube/config
kubectl
should be configured with the deployed cluster
# allocated CPUs, should be less than
# no of cores on your machines
KMASTER_CPUS=2
# memory in MBs
KMASTER_MEMORY=2048
# specify list bash files at Vagrantfile level
# comma separated, will be run in order of
# declaration
KMASTER_SCRIPTS=kmaster.sh
KWORKER_CPUS=1
# memory in MBs
KWORKER_MEMORY=1024
KWORKER_COUNT=2
KWORKER_SCRIPTS=kworker.sh
# specify list of comma separated folders
# in the format $HOST_LOCATION:$GUEST_LOCATION
SHARED_FOLDERS=../:/app