How to configure and add Hetzner dedicated servers to my Cloud.net cloud?
Cloud.net, all versions.
Let’s add Compute Resource and Backup Server to Cloud.net using Hetzner hardware.
First, we need to order two servers for this purpose. The hardware specifications are chosen depending on the required quantity of VMs.
Both servers have been ordered and have public IP addresses. They are visible in the UI. The first one has more memory and a little bit better CPU, so it will be a Compute Resource for hosting VMs.
Compute Resource should also have additional public and private subnets for VM’s appliance network and for communication between Compute Resource and Backup Server.
Then, we’re going to build networks using Hetzner vSwitches:
Go to the client login area > Robot > Servers. Choose the vSwitch tab > Create vSwitch.
We’re going to create 3 vSwitches:
- Name: Public appliance network
- VLAN ID: 4012
- Name: Private appliance network
- VLAN ID: 4014
- Name: Provisioning/backup network
- VLAN ID: 4013
For the first one we are going to order an additional public subnet we were talking about earlier:
Go to the vSwitch tab > vSwitch. Click on the Public Appliance network vSwitch and then click the IPs tab.
Do not forget to add both servers to each network:
Go the vSwitch tab > vSwitch. Click on the Virtual switch tab, and add both servers by clicking on Add servers button.
As soon as we are finished with networks, we can go through the OS installation and preparing both servers:
Go to the Servers and click on the Rescue tab.
Choose 64 bit Linux with no public key and click Activate system rescue. You'll see the root password, please note it. Later after installation, you may change it.
Then, go to the tab Reset, choose Send CTRL+ALT+DEL to the server, and click Send to confirm.
After few minutes you will be able to jump in rescue mode using SSH with previously provided credentials:
Go to the current server and open the tab Rescue.
Now we can run installimage script provided by Hetzler for partitioning and OS installation.
root@rescue ~ # installimage -a -n bk01 -r yes -l 1 -p /boot:ext2:512M,swap:swap:4G,/:ext4:100G,/storage:ext2:all -i ~/images/CentOS-79-64-minimal.tar.gz
It will create RAID 1 from two disks available and create separate partitions for /boot, swap, / and the rest will be used for storing VMs.
-n <hostname> set the specified hostNAME.
-r <yes|no> activate software RAID or not.
-l <0|1|5|6|10> set the specified raid LEVEL.
-p <partitions> define the PARTITIONS.
-i <imagepath> use the specified IMAGE to install (full path to the OS image)
A similar command can be executed for BS installation, but you may change some partitions according to your requirements.
We are applying the same partitioning procedure and OS installing both for the Compute resource and Backup server. Here’s a command for that below:
root@rescue ~ #installimage -a -n hv01 -r yes -l 1 -p /boot:ext2:512M,swap:swap:8G,/:ext4:100G,/storage:ext2:all -i ~/images/CentOS-79-64-minimal.tar.gz
Once it is complete you can reboot the servers to boot into the new OS:
[root@rescue ~]# reboot
After a few minutes, the Compute Resource and Backup Server will be ready for the SSH connection.
Let’s create a provisioning/backup network between CR and BS according to our VLAN ID.
Create the file on both servers: /etc/sysconfig/network-scripts/ifcfg-enp3s0.4014 and paste the following contents into it:
Bring up network interfaces to provide communication between both servers:
# ifup enp3s0.4013
Remove the last partition which will be used on CR for storing VMs’ vDisks from the /etc/fstab file:
[root@hv01 ~]# sed -e '/storage/ s/^#*/#/' -i /etc/fstab
Unmount this partition:
[root@hv01 ~]# umount /storage/
Switch to cloud.net Control Panel and go to Settings → Infrastructure Wizard
Using the details from Hetzner, fill in Compute resource information:
And click Add Compute Resource.
Once the wizard approves connectivity, you may add another CR or click Next.
Choose the name for a new datastore, choose the local partition we have left for storing the VMs and click Next.
In the same way, we’re adding Backup Server into the newly created Backup Servers zone and Click Add Backup Server, then click Next.
Add a mount point on the Backup Server for storing the backups and provide its path (usually it is /storage) and choose network interfaces we set up for provisioning and backup networks.
Add the Public network using VLAN id we created above and the available NIC on HV:
We went through all wizard steps and we can confirm it by clicking on the OK, build button, or review some previous steps if needed.
Please pay attention to the fact that the building may some time to complete.
After the building process is finished, we can configure the billing bucket for the new zone.
Click Configure Billing.
Configure billing for just created Hetzner zone according to your requirements or use a previously created bucket.
You may choose the limitations for the current zone here:
This step requires adding the user here:
Then click Save.
The resources' configuration is finished, so, we're going to add a private network for the VMs.
Go back to Settings > Network Zones. We will create a network zone for our private traffic:
Click Submit, and add New IP net. Go to Setting > Networks and click Add new Network. Fill in the private network details and VLAN and click Submit.
Now let’s add a usable range that includes the gateway, Choose the gear icon and Add new IP range:
Go to Settings > Compute Resources.
Choose the Hetzner Compute Resource we added earlier, and go to Tools > Manage Networks.
And click Add network.
Add our new network using the same physical NIC we used earlier:
Choose Buckets from the Billing section of the menu, and choose the Hetzner bucket.
And click Submit.
Now you are able to build VMs using both private and public networks.