Skip to content

OpenShift 4 Installation on Libvirt

Endi S. Dewata edited this page Sep 15, 2023 · 1 revision

Table of Contents

Overview

This page describes the process to install OpenShift with libvirt based on Libvirt HOWTO.

Installing Dependencies

$ yum install golang-bin gcc-c++ libvirt-devel dep
$ yum install libvirt libvirt-devel libvirt-daemon-kvm qemu-kvm
$ systemctl enable --now libvirtd

Environment Variables

$ export GOPATH=$HOME/go
$ export PATH=$PATH:$GOPATH/bin
$ export OS_OUTPUT_GOPATH=1

Configuring Permissions

$ cat <<EOF >> /etc/polkit-1/rules.d/80-libvirt.rules
polkit.addRule(function(action, subject) {
  if (action.id == "org.libvirt.unix.manage" && subject.local && subject.active && subject.isInGroup("wheel")) {
      return polkit.Result.YES;
  }
});
EOF

Enabling IP Forwarding

Make sure IP forwarding is enabled:

$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

Configuring libvirt

Edit /etc/libvirt/libvirtd.conf:

listen_tls = 0
listen_tcp = 1
auth_tcp="none"
tcp_port = "16509"

Edit /etc/sysconfig/libvirtd:

LIBVIRTD_ARGS="--listen"

Then:

$ systemctl restart libvirtd

Configuring Firewall

Either disable firewall or allow connections from the IP range used by the cluster nodes. See Firewall.

Configuring Storage Pool

Make sure a default storage pool has been defined. See libvirt.

Configure NetworkManager DNS Overlay

Configure NetworkManager to use dnsmasq:

$ echo -e "[main]\ndns=dnsmasq" | tee /etc/NetworkManager/conf.d/openshift.conf

Configure dnsmasq to use the cluster:

$ echo server=/tt.testing/192.168.126.1 | tee /etc/NetworkManager/dnsmasq.d/openshift.conf

Reload NetworkManager:

$ systemctl reload NetworkManager

Getting the Source Code

$ git clone https://github.com/openshift/installer.git $GOPATH/src/github.com/openshift/installer

Building OpenShift Installer

$ cd $GOPATH/src/github.com/openshift/installer
$ hack/build.sh

Installing OpenShift Cluster

$ bin/openshift-install create cluster --dir test

Removing OpenShift Cluster

$ bin/openshift-install destroy cluster

See Also