Few scripts which can quickly create multinode Kubernetes cluster using vagrant + libvirt
Few scripts which may help you to quickly build Multinode Kubernetes cluster.
By running the scripts you got access to 4 node cluster running on VMs.
Packages (+dependencies):
sudo apt install -y --no-install-recommends ansible curl dnsmasq ebtables git gcc jq libc-dev libvirt-bin libvirt-dev pkg-config pv qemu-kvm qemu-utils
VAGRANT_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/vagrant | jq -r -M '.current_version')
curl https://releases.hashicorp.com/vagrant/${VAGRANT_LATEST_VERSION}/vagrant_${VAGRANT_LATEST_VERSION}_x86_64.deb --output /tmp/vagrant_x86_64.deb
sudo apt install -y /tmp/vagrant_x86_64.deb
rm /tmp/vagrant_x86_64.deb
vagrant plugin install vagrant-libvirt vagrant-hostmanager
sudo curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl --output /usr/local/bin/kubectl && sudo chmod a+x /usr/local/bin/kubectl
test -f $HOME/.ssh/id_rsa || ( install -m 0700 -d $HOME/.ssh && ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_rsa -q -N '' )
sudo reboot
sudo dnf install -y ansible git kubernetes-client libvirt vagrant-libvirt vagrant-hostmanager
test -f $HOME/.ssh/id_rsa || ( install -m 0700 -d $HOME/.ssh && ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_rsa -q -N '' )
service libvirtd restart
Make sure your system meet all requirements.
For Ubuntu Xenial (16.04) you can see the installation details here: .appveyor.yml
Simply run one of the commands run-kubeadm.sh
or run-kubespray.sh
and wait for few minutes.
You can see the example of scripts executions here:
run-kubeadm.sh
run-kubespray.sh
run-kubeadm-demo.sh
Once you installed the cluster use these commands to test your connection:
export KUBECONFIG=$PWD/kubeconfig.conf
kubectl get nodes
kubectl get pods --all-namespaces
kubectl cluster-info
build_kubernetes_kubeadm-demo.sh
build_kubernetes_kubespray-demo.sh
build_kubernetes_kubeadm-demo.sh
build_kubernetes_kubespray-demo.sh
MIT / BSD
Scripts were created in 2018 by petr.ruzicka@gmail.com