Few scripts which can quickly create multinode Kubernetes cluster using vagrant + libvirt
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
images
.appveyor.yml
.gitignore
.travis.yml
README.md
Vagrantfile
build_kubernetes_kubeadm-demo.sh
build_kubernetes_kubespray-demo.sh
run-kubeadm-demo.sh
run-kubeadm.sh
run-kubespray.sh

README.md

Multinode Kubernetes Cluster

Build Status

Kubernetes Logo

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.

Requirements

Packages (+dependencies):

Requirements installation

  • Ubuntu 18.04
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
  • Fedora 28
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

Login Credentials

  • Username: root / vagrant
  • Password: vagrant

Usage

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

asciicast

  • run-kubespray.sh

asciicast

  • run-kubeadm-demo.sh

asciicast

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

Demo asciinema examples

  • build_kubernetes_kubeadm-demo.sh

asciicast

  • build_kubernetes_kubespray-demo.sh

asciicast

Diagrams

  • build_kubernetes_kubeadm-demo.sh

kubeadm_diagram

  • build_kubernetes_kubespray-demo.sh

kubespray_diagram

Documentation with CI

License

MIT / BSD

Author Information

Scripts were created in 2018 by petr.ruzicka@gmail.com