Skip to content

Instantly share code, notes, and snippets.

@matheusmota
Last active February 17, 2020 02:11
Show Gist options
  • Save matheusmota/5ff2f816b07634f37ebb25832a37823c to your computer and use it in GitHub Desktop.
Save matheusmota/5ff2f816b07634f37ebb25832a37823c to your computer and use it in GitHub Desktop.
A step by step guide
#/etc/network/interfaces:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet manual
metric 0
auto br0
iface br0 inet static
address 10.1.1.10
netmask 255.255.255.0
gateway 10.1.1.1
dns-nameservers 10.1.1.2 8.8.8.8
dns-search companyname companyname.com
bridge_ports eno1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
metric 1

steps

1 Preparing the host for the Local Cluster

sudo apt-get install virt-manager qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo adduser `id -un` libvirtd #(after reboot)

Next:

  1. Create network for cluster (NAT)
  2. Add storage pool for isos

Optional: modifing default pool path

virsh pool-list
virsh pool-destroy default
virsh pool-undefine default
virsh pool-define-as --name default --type dir --target /home/matheus/resources/kvm-images
virsh pool-autostart default
virsh pool-start default
virsh pool-list

2 The template node

Installing Docker

sudo apt-get install docker-compose -y
sudo usermod -aG docker $USER

Installing main packages and update

sudo apt-get install htop vim ssh sshfs -y
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y &&  sudo apt-get autoclean -y && sudo apt-get autoremove -y && sudo shutdown -r 0

3 Editing nodes

  • Set ip
sudo vim /etc/netplan/50-cloud-init.yaml
  • Edit hostname
sudo vim /etc/cloud/cloud.cfg
# preserve_hostname: true
sudo shutdown -r 0
sudo hostnamectl set-hostname nodeX
sudo hostnamectl
sudo vim /etc/hosts
10.10.10.11   node1
10.10.10.12   node2
10.10.10.13   node3
10.10.10.14   node4
10.10.10.15   node5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment