Category: openshift

Today i will install Code Ready. You can install Openshift on your laptop. See this link . My RHEL 8.4 VM has a small disk and first i need to resize the disk and then install CodeReady

Using this commands i change from 20 GB to 50GB disk

First you need to locate the vm disk with the command

sudo virsh domblklist rhel8-1

the output was:

Target Source
——————————————————-
vda /var/lib/libvirt/images/rhel8-2-clone.qcow2
sda –

To resize the disk the VM must be not running and must not have a snapshot.

Just type this command and add 30GB

sudo qemu-img resize /var/lib/libvirt/images/rhel8-2-clone.qcow2 +30G

Start the vm and verify the disk using lsblk command

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 50G 0 disk
|-vda1 252:1 0 1G 0 part /boot
`-vda2 252:2 0 29G 0 part
|-rhel-root 253:0 0 26G 0 lvm /
`-rhel-swap 253:1 0 3G 0 lvm [SWAP]

 

Linux openshift

Continuing with the preparation of my lab I have installed a vm with RHEL 8.4 updated and from there I will create a template.

To create a template and use it later in the KVM the steps are as follows:

obs: My host is an Ubuntu 20.04

Install the tools to work with guests:

sudo apt install libguestfs-tools

List the vms:

virsh list --all

Prepare the rhel8-2 virtual machine to be a template

sudo virt-sysprep -d rhel8-2

Rename the vm to be a template

sudo virsh domrename rhel8-2 rhel8-Template

Open the VM Manager (virt-manager), and then select the rhel-Template. Right-click on it and select the Clone option, which will open the Clone Virtual Machine window.

Linux openshift

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

  1. Update ubuntu : sudo apt-get update
  2. Install OpenSSH: sudo apt-get install openssh-server
  3. Verify the status: sudo systemctl status sshd
  4. Enable ssh connections on the host: sudo ufw allow ssh
  5.  Check if openssh is enabled:  sudo systemctl list-unit-files | grep enabled | grep ssh6
  6. 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.

  1. Add the repository: add-apt-repository -y ppa:teejee2008/ppa2
  2. Install TimeShift: apt install timeshift

Then I made the first backup and started the KVM installation

Install KVM on Ubuntu 20.04

Install KVM:

  1. sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utilsb
  2. sudo systemctl enable libvirtd
  3. 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

openshift