Cluster is a term used to combine 2 or more similar devices to become a single unit. So the proxmox cluster can be interpreted as merging 2 or more proxmox servers so that the 2 proxmox servers seem to be one unit. The advantages of using a cluster include centralized management using a web base and we can migrate live virtual machines to other nodes on proxmox.
How to create a proxmox cluster?
If you want to create a proxmox cluster then there are a few things to consider:
- All nodes or servers must be in one network
- Time on the proxmox server must be synchronized. As far as I know, the time on proxmox version 7 is controlled by the chrony application, and the application is installed by default in proxmox.
- It is recommended to use the same server specifications
In this article I will create a proxmox cluster using 2 proxmox servers where:
Proxmox1 IP: 192.168.100.21
Proxmox2 IP: 192.168.100.22
and I made proxmox1 as master. Make sure the two proxmox servers have not created a virtual machine.
A. On Proxmox1
There are 2 ways to create a cluster in proxmox, namely using the web or the CLI.
1. Using Web
If you want to use the web, then click DataCenter > Cluster > Create Cluster as shown below:
So there will be a pop-up display like in the image below:
Write the name of the cluster, select IP and click the Create button, then a pop-up will appear as below:
Wait until it says TASK OK and after that close the pop-up by clicking the cross in the upper right corner. After that press the Join Information button as shown in the image below:
then a pop-up will appear as below:
2. Using CLI
If you want to use the CLI, then type the command in the following format:
pvecm create CLUSTERNAME
If you’re going to name ClusterProxmox then we type the command below:
pvecm create ClusterProxmox
to see the status of the cluster, then type the command below:
Like on proxmox1, we can join the cluster using web or CLI.
1. Using Web
On proxmox 2 click DataCenter > Cluster > Join Cluster and select the Join Cluster button as shown in the image below:
then there will be a pop-up like below:
copy the information we just copied by right-clicking so that a pop-up will appear as shown below:
enter the proxmox1 server password and select the proxmox2 server IP and click the Join ‘ClusterProxmox’ button then the screen below will appear:
Close the pop-up by clicking the cross in the upper right corner.
1. Using CLI
If you want to use the CLI to join the proxmox cluster, then type the command format as follows:
pvecm add IP-ADDRESS-CLUSTER -link0 LOCAL-IP-ADDRESS-LINK0
In this case, we type the command below:
pvecm add 192.168.100.21 -link0 192.168.100.22
Type the master server password then if the password is correct then the clustering process in proxmox will start as shown below:
After that type the command below to ensure that the clustering process is successfully created:
If you want to display how many nodes are on your cluster, type the below command:
C. Test Cluster
Refresh the proxmox1 web dashboard, it should look like this:
Likewise, refresh the proxmox2 web dashboard, then it should look like the image below:
It can be seen that the proxmox1 and proxmox2 dashboards have the same display and that means you have successfully created a cluster in proxmox. Then we try to test the cluster that we created earlier. Create a virtual machine on one of the nodes (servers) and point the storage to shared storage for example using TrueNAS. After the virtual machine is successfully installed, try migrating the virtual machine by clicking the migration button as shown below:
then there will be a pop-up showing the migration progress of the virtual machine:
Wait until the progress is complete and preferably when the migration process occurs, you ping the virtual machine to see if there is downtime or not on the virtual machine. When it is finished, the virtual machine should have been successfully moved to the proxmox2 node:
So that virtual machines can do live migration, we should use shared storage such as TrueNAS and so on so that the live migration process does not have problems. Please note that when we use a cluster on proxmox, we can only use live migration when each node in the proxmox cluster is on. If the node in the virtual machine dies, the virtual machine will not be able to move to another node and if we want the virtual machine to move when the node dies, we must turn on the high availability (HA) feature on proxmox.