This image is part of a multi node cluster for production-like environment using Vagrant and Ansible
340
#+STARTUP: inlineimages
This a multi node cluster playground which offers a production-like environment using kubeadm, Vagrant and Ansible for provisioning the cluster on multiple providers such as VirtualBox and KVM/libvirt. By using Ansible as the infrastructure automation engine we can have playbooks written in yaml that offer inventory management the infrastructure-as-code way.
#+CAPTION: Multi-node kubernetes cluster diagram #+NAME: fig:Diagram-1 #+ATTR_ORG: :width 400 [[file:./kubernetes-setup/Diagram.png]]
Note that Docker might be supported in the future, depending on having a fully working image that can fit with the Ansible playbooks.
** Using config.yaml external file
It is advisable to copy the file config.sample to config.yaml in order to set configuration.
** Running kubectl
After pulling this repository run vagrant up on the base folder.
When the cluster is up and running you can ssh and
can use kubectl on the master:
#+BEGIN_SRC $ vagrant ssh k8s-master $ kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready master 4m28s v1.19.0 node-1 Ready 2m12s v1.19.0 node-2 NotReady 1s v1.19.0 #+END_SRC
Or if you have kubectl installed locally, try:
#+BEGIN_SRC $ kubectl --kubeconfig=.kube/config get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready master 4m28s v1.19.0 node-1 Ready 2m12s v1.19.0 node-2 NotReady 1s v1.19.0 #+END_SRC
*** On Ubuntu
#+BEGIN_SRC
sudo apt-get install -y libvirt-dev make gcc ruby-dev qemu-kvm libvirt0 virt-manager libguestfs-tools
vagrant plugin install vagrant-libvirt #+END_SRC
*** On Centos/Redhat/FEdora
#+BEGIN_SRC
yum install -y https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.rpm
yum install -y libvirt libvirt-devel make gcc rpm-build ruby-devel zlib-devel qemu-kvm
vagrant plugin install vagrant-libvirt #+END_SRC
*** Default pool images
Vagrant expects a storage pool named 'default'. In case you don't have it already, run the following: #+BEGIN_SRC mkdir -p /var/lib/libvirt/default virsh pool-define-as --name default --type dir --target /var/lib/libvirt/default virsh pool-autostart default virsh pool-start default #+END_SRC
*** Running
Temporary uncomment the line #provider = "libvirt" in the Vagrantfile.
Run vagrant up as normal.
Content type
Image
Digest
Size
521.6 MB
Last updated
about 6 years ago
docker pull ricardoamaro/vagrant-kubernetes-node