Skip to content

Commit

Permalink
docs: Amend the PXE server configuration guide
Browse files Browse the repository at this point in the history
Change the PXE server guide so that it does not need to run the commands
as root.

Signed-off-by: Dimitris Poulopoulos <[email protected]>
  • Loading branch information
dpoulopoulos committed Feb 7, 2024
1 parent 2e7a401 commit 1dbdb8e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
71 changes: 43 additions & 28 deletions docs/source/pxe-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,87 @@ In this section you will create a KVM VM for the PXE server, using a Debian `12.

### Procedure

1. Change to root user:
1. Create a new `QCOW2` virtual disk for the VM:

```console
user:~$ sudo su -
root:~#
user:~/kubeflow-on-kvm$ qemu-img create -f qcow2 ~/.local/libvirt/disks/pxe-server.qcow2 32G
Formatting '/home/user/.local/libvirt/disks/pxe-server.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=34359738368 lazy_refcounts=off refcount_bits=16
```

1. Navigate to the project's root directory:
1. Define a new VM for the PXE server, using the XML file inside the `infra` directory:

```console
root:~# cd kubeflow-on-kvm
user:~/kubeflow-on-kvm$ virsh define --file infra/pxe-server.xml
Domain 'pxe-server' defined from infra/pxe-server.xml
```

1. Create a new `QCOW2` virtual disk for the VM:
> **Note**: The `pxe-server.xml` file is a template for the PXE server VM. You can modify it to
> fit your needs. Pay close attention to the sections where you specify the path to the
> `QCOW2` file and the Debian `12.4` ISO.

1. Start the PXE server VM:

```console
root:~/kubeflow-on-kvm# qemu-img create -f qcow2 /var/lib/libvirt/images/pxe-server.qcow2 32G
Formatting '/var/lib/libvirt/images/pxe-server.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=34359738368 lazy_refcounts=off refcount_bits=16
user:~/kubeflow-on-kvm/infra$ virsh start pxe-server
Domain 'pxe-server' started
```

1. Define a new VM for the PXE server, using the XML file inside the `infra` directory:
<details>
<summary>Troubleshoot</summary>
If you get the following error during the VM start process:
```console
error: Failed to start domain 'pxe-server'
error: /usr/lib/qemu/qemu-bridge-helper --use-vnet --br=virbr0 --fd=33: failed to communicate with bridge helper: stderr=failed to parse default acl file `/etc/qemu/bridge.conf'
: Transport endpoint is not connected
```

Make sure you have the following line in your `/etc/qemu/bridge.conf` file:

```console
root:~/kubeflow-on-kvm# cd infra
root:~/kubeflow-on-kvm/infra# virsh define pxe-server.xml
Domain 'pxe-server' defined from pxe-server.xml
allow virbr0
```

> **Note**: The `pxe-server.xml` file is a template for the PXE server VM. You can modify it to
> fit your needs. Pay close attention to the sections where you specify the path to the
> `QCOW2` file and the Debian `12.4` ISO.
If the file does not exist, create it and add the line above.

1. Start the PXE server VM:
Also, make sure that the `qemu-bridge-helper` binary has the correct permissions:

```console
root:~/kubeflow-on-kvm/infra# virsh start pxe-server
Domain 'pxe-server' started
user:~/kubeflow-on-kvm/infra$ sudo chmod u+s /usr/local/libexec/qemu-bridge-helper
```

Then, try to start the VM again. For more information, see the [here](https://wiki.qemu.org/Features/HelperNetworking#Setup).
</details>

1. Connect to the PXE server VM through the "Virtual Machine Manager" UI and run the Debian
installer. The Debian installer will guide you through the installation process. You can use the
default settings for most of the options.

> **Note**: We recommend doing a minimal installation of Debian, without any graphical interface.

### Verify

1. Verify that the PXE server VM is running:

```console
root:~/kubeflow-on-kvm/infra# virsh list --all
user:~/kubeflow-on-kvm$ virsh list --all
Id Name State
-----------------------------
1 pxe-server running
```

1. Change back to your user:
```console
root:~/kubeflow-on-kvm/infra# exit
user:~/kubeflow-on-kvm/infra$
```

1. Verify that you can SSH into the PXE server VM:

```console
user:~/kubeflow-on-kvm/infra$ ssh user@pxe-server
The authenticity of host '192.168.122.89 (192.168.122.89)' can't be established.
ED25519 key fingerprint is SHA256:dNnHdISPbUDbtJWqSLDpEdGEO3tGEIQ1TiSrfPxyRHg.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.122.89' (ED25519) to the list of known hosts.
[email protected]'s password:
Linux pxe-server 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64

The programs included with the Debian GNU/Linux system are free software;
Expand All @@ -89,9 +105,8 @@ In this section you will create a KVM VM for the PXE server, using a Debian `12.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Feb 7 16:43:02 2024 from 192.168.1.1
Last login: Wed Feb 7 18:10:32 2024
```

> **Note**: Replace `user` with your username and `pxe-server` with the IP address of the PXE
> server VM.

4 changes: 2 additions & 2 deletions infra/pxe-server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<graphics type='spice' autoport='yes'/>
<disk type='file' device='cdrom'>
<driver name='qemu'/>
<source file='/var/lib/libvirt/images/debian-12.4.0-amd64-netinst.iso'/>
<source file='/home/user/.local/libvirt/images/debian-12.4.0-amd64-netinst.iso'/>
<target dev='sda' bus='sata'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/pxe-server.qcow2'/>
<source file='/home/user/.local/libvirt/disks/pxe-server.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='bridge'>
Expand Down

0 comments on commit 1dbdb8e

Please sign in to comment.