Setting Up the libvirt Provider

Set up an Oracle Linux host to create Kubernetes clusters using the libvirt provider.

Clusters can be created on the localhost, or on a remote system. Perform these steps on the system to be used to create the cluster, whether that's the localhost for local clusters, or on a remote host if you're creating clusters on a remote system.

  1. Install the Oracle KVM stack.
    • Oracle Linux 9:

      If you have an existing installation of the default KVM stack, remove it:

      sudo dnf remove libvirt qemu-kvm edk2 

      Install the Oracle KVM stack:

      sudo dnf config-manager --enable ol9_kvm_utils
      sudo dnf group install "Virtualization Host"
      sudo dnf install virt-install virt-viewer

      Start the virtualization daemons.

      for drv in qemu network nodedev nwfilter secret storage interface proxy   
        do
         sudo systemctl enable virt${drv}d.service
         sudo systemctl enable virt${drv}d{,-ro,-admin}.socket
         sudo systemctl start virt${drv}d{,-ro,-admin}.socket 
        done
    • Oracle Linux 8:

      If you have an existing installation of the default KVM stack, remove it:

      sudo dnf module remove virt --all
      sudo dnf module reset virt 

      Install the Oracle KVM stack:

      sudo dnf config-manager --enable ol8_kvm_appstream
      sudo dnf module enable virt:kvm_utils3 
      sudo dnf --allowerasing distro-sync
      sudo dnf module install virt:kvm_utils3 

      Enable and start the libvirtd.service:

      sudo systemctl enable --now libvirtd.service

    For more information on installing and configuring KVM, see the Oracle Linux: KVM User's Guide.

  2. Validate the host.

    Validate the host is set up for hardware virtualization, and can be used as a KVM host:

    virt-host-validate qemu
  3. Configure the user.

    Configure the user to have privileged access to libvirt, add the user to the libvirt and qemu groups.

    sudo usermod -a -G libvirt,qemu $USER

    To enable the change to the user, log out, and log back into the host or terminal session.

  4. (Optional) Open a range of ports in the firewall.

    If you're installing libvirt on a remote host, open a series of firewall ports so you can access nodes in the cluster from the localhost. You don't need to do this if you're installing libvirt on the localhost. Use the format:

    sudo firewall-cmd --add-port 6443-endrange/tcp
    sudo firewall-cmd --add-port 6443-endrange/tcp --permanent

    Replace endrange with the highest port number you want to open. For example, to open 20 ports, use:

    sudo firewall-cmd --add-port 6443-6463/tcp
    sudo firewall-cmd --add-port 6443-6463/tcp --permanent

    Restart firewalld.service

    sudo systemctl restart firewalld.service
  5. (Optional) Set up proxy configuration.

    If you use a proxy server, configure the libvirt host so container images can be pulled from the Oracle Container Registry using HTTPS. For example:

    export HTTPS_PROXY=https://proxy.example.com:3128