⚠ This project is unmaintained, but has a "spiritual successor" in hcloud-ip-floater
Minimalistic floating IP setter for container clusters (currently tested on docker swarm) running on Hetzner Cloud.
This project should be used as a container. It will run once and update a given floating IP to point to the node currently running it. This can be used to ensure the floating IP will be reassigned upon node failure, by relying on the underlying cluster to redeploy this service on a healthy node.
This is an example deployment for docker stack deploy
:
services:
app:
image: costela/hetzner-ip-floater
secrets:
- hetzner_api_key_for_floating_ip # set via `docker secret create`
environment:
API_KEY_FILE: /run/secrets/hetzner_api_key_for_floating_ip
TARGET_HOST: '{{ .Node.Hostname }}' # uses docker swarm's templating to get node name
FLOATING_IP_ID: 12345 # taken from Hetzner cloud console
deploy:
replicas: 1
This assumes the node's hostnames are the same as their API names, which is the case unless the hostname has been changed after provisioning.
The deployment of hetzner-ip-floater
should be limited to those nodes where the floating IP is locally configured, otherwise incoming trafic will be dropped.
The same nodes should also be configured as ingress nodes. When using the default mesh networking on docker swarm, this is already the case for all worker nodes.