This small kubernetes controller manages the attachment of hetzner cloud ("hcloud") floating IPs to kubernetes nodes.
It watches for changes to kubernetes LoadBalancer
services, chooses one of the nodes where its pods are scheduled and
attaches its assigned floating IP to the selected node.
The service IP assignment is left to a separate component, like MetalLB.
The controller can be installed to a cluster using e.g. kustomize. Simply kubectl apply -k
the
following kustomization.yaml
:
namespace: hcloud-ip-floater
bases:
- github.com/costela/hcloud-ip-floater/deploy?ref=v0.1.6
secretGenerator:
- name: hcloud-ip-floater-secret-env
literals:
- HCLOUD_IP_FLOATER_HCLOUD_TOKEN=<YOUR HCLOUD API TOKEN HERE>
The provided deployment manifest expects a secret named hcloud-ip-floater-secret-env
to exist, which is the
recommended location for storing the hcloud API token.
It's also possible to provide a configMapGenerator
called hcloud-ip-floater-config-env
with the non-secret options
listed in the configuration options section below.
⚠ in order for the controller to attach IPs to the hcloud nodes, the k8s nodes must use the same names as in hcloud.
Either as command line arguments or environment variables.
API token for hetzner cloud access.
Service label selector to use when watching for kubernetes services. Any services that do not match this selector will be ignored by the controller.
Default: hcloud-ip-floater.cstl.dev/ignore!=true
Label selector for hcloud floating IPs. Floating IPs that do not match this selector will be ignored by the controller.
Default: hcloud-ip-floater.cstl.dev/ignore!=true
Log output verbosity (debug/info/warn/error)
Default: warn