I am studying to take some RedHat certification exams including the OpenShift Enterprise Administration (DO280) exam. I could set up Linux cloud servers such as IBM Cloud or even on AWS but I have an old laptop and decided to setup
a cluster with 3 Linux machines on it. I will start building a small k8s cluster. The first step was to install Ubuntu 20.04 as host.
My old laptop is a Toshiba Satellite P875 – S3210 32GB RAM 512GB SSD 750 GB HD SATA
Install and Enable SSH server on Ubuntu 20.04
- Update ubuntu :
sudo apt-get update
- Install OpenSSH:
sudo apt-get install openssh-server
- Verify the status:
sudo systemctl status sshd
- Enable ssh connections on the host:
sudo ufw allow ssh
- Check if openssh is enabled:
sudo systemctl list-unit-files | grep enabled | grep ssh6
- If you have no results on step 5:
sudo systemctl enable ssh
Now I can connect to my ubuntu laptop using ssh.
The second step was to install Timeshift and perform a backup of the system.
- Add the repository:
add-apt-repository -y ppa:teejee2008/ppa2
- Install TimeShift:
apt install timeshift
Then I made the first backup and started the KVM installation
Install KVM on Ubuntu 20.04
Install KVM:
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utilsb
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
Configure VNC: VNC support should be available by default, and I do this configuration:
Edit /etc/libvirt/qemu.conf and add: vnc_listen = “0.0.0.0”
This will enable VNC on all networks. This is not a problem for me because it’s a local machine. Don’t do this if you are using a machine exposed to internet.b.
Edit /etc/libvirt/libvirtd.conf and add: listen_tcp = 1
Reboot the machine.
Enable VNC connections: sudo ufw allow 5900:5903
(VNC uses TCP port 5900+n and I will setup 3 machines)
Setup a bridge network
The default network virbr0, created by KVM does not allow virtual machines to communicate with external hosts (inbound and outbound).
Using the nmcli tool I setup a bridge network. I try to use my wireless connection but it’s not work, some documents show that this only work with ethernet interfaces. My host ethernet connection is enp1s0
nmcli con add ifname br0 type bridge con-name br0
nmcli con add type bridge-slave ifname enp1s0 master br0
nmcli con down “Wired connection 1”
nmcli con up br0
Declaring KVM Bridged Network Create a xml file anmed bridge.xml with the lines:
<network> <name>br0</name> <forward mode="bridge"/> <bridge name="br0" /></network>
Use the file to define the new network:
virsh net-define ./bridge.xml
Start the network and configure it for auto-start
virsh net-start br0virsh net-autostart br0
Now I can use this network on the Virtual Machines
For example using virt-install –network
option
Next step is to setup 3 machines and K8s