|
| 1 | +# Corosyn-qnet |
| 2 | + |
| 3 | +I'm running this inside a Debian container on my Alpine's Raspberry PI server to act as a third / external node for my Proxmox cluster. |
| 4 | +See <https://pve.proxmox.com/wiki/Cluster_Manager#_corosync_external_vote_support>. |
| 5 | + |
| 6 | +**Warning:** This solution works but is kinda hacky... |
| 7 | + |
| 8 | +## Install Docker on my Server (if not done already) |
| 9 | + |
| 10 | +<https://github.com/Antiz96/Linux-Server/blob/main/Services/Docker.md> |
| 11 | + |
| 12 | +## Set up ssh connection with the proxmox nodes |
| 13 | + |
| 14 | +```bash |
| 15 | +sudo -e /etc/ssh/sshd_config |
| 16 | +``` |
| 17 | + |
| 18 | +> [...] |
| 19 | +> PermitRootLogin prohibit-password |
| 20 | +> [...] |
| 21 | +
|
| 22 | +```bash |
| 23 | +sudo rc-service sshd restart |
| 24 | +``` |
| 25 | + |
| 26 | +Proceed to SSH key exchange with every nodes (for the `root` user). |
| 27 | +Set `~/.ssh/config` if needed. |
| 28 | + |
| 29 | +## Setup the Debian container |
| 30 | + |
| 31 | +```bash |
| 32 | +sudo docker run -dit --restart=unless-stopped --network host --hostname debian --name debian debian:bookworm-slim bash # Pull and run a Debian container |
| 33 | +sudo docker exec -it debian bash # Enter the container |
| 34 | +apt update && apt install corosync-qnetd # Install the corosync-qnetd package |
| 35 | +exit # Exit the container |
| 36 | +sudo docker commit debian qnetd:latest # Commit the container as a custom image |
| 37 | +sudo docker rm -f debian # Delete the Debian container |
| 38 | +sudo docker run -dit --restart=unless-stopped --network host --hostname qnetd --name qnetd qnetd corosync-qnetd -f # Run the custom container once to retrieve the corosync files from the host |
| 39 | +sudo docker cp qnetd:/etc/corosync /etc/ # Copy the needed corosync files to host |
| 40 | +sudo docker rm -f qnetd # Delete the container |
| 41 | +sudo docker run -dit --restart=unless-stopped --network host -v /etc/corosync:/etc/corosync -v /tmp:/tmp --hostname qnetd --name qnetd qnetd corosync-qnetd -f # Run the custom container with the proper volume mapping |
| 42 | +sudo docker image prune -a # Remove dangling image |
| 43 | +``` |
| 44 | + |
| 45 | +## Setup cluster node |
| 46 | + |
| 47 | +On the QDEVICE node: |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo vim /usr/local/bin/corosync-qnetd-certutil |
| 51 | +``` |
| 52 | + |
| 53 | +> #!/bin/bash |
| 54 | +> docker exec -i qnetd corosync-qnetd-certutil "$@" |
| 55 | +
|
| 56 | +```bash |
| 57 | +sudo chmod +x /usr/local/bin/corosync-qnetd-certutil |
| 58 | +``` |
| 59 | + |
| 60 | +On **every** Proxmox (PVE) nodes: |
| 61 | + |
| 62 | +```bash |
| 63 | +sudo apt install corosync-qdevice |
| 64 | +``` |
| 65 | + |
| 66 | +From **one** of the Proxmox (PVE) nodes: |
| 67 | + |
| 68 | +```bash |
| 69 | +sudo pvecm qdevice setup <QDEVICE-IP> # **Warning:** This command expects **all** nodes to use the default 22 SSH port |
| 70 | +``` |
| 71 | + |
| 72 | +You can check that all the steps have successfully completed with: |
| 73 | + |
| 74 | +```bash |
| 75 | +sudo pvecm status |
| 76 | +``` |
| 77 | + |
| 78 | +## Update |
| 79 | + |
| 80 | +```bash |
| 81 | +sudo docker exec -it qnetd bash # Enter the container |
| 82 | +apt update && apt full-upgrade && apt autoremove # Update the system |
| 83 | +exit # Exit the container |
| 84 | +``` |
0 commit comments