Skip to content

costela/hcloud-ip-floater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card Build Status

Hetzner Cloud™ IP Floater

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.

Installation

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.

Configuration options

Either as command line arguments or environment variables.

--hcloud-token or HCLOUD_IP_FLOATER_HCLOUD_TOKEN (required)

API token for hetzner cloud access.

--service-label-selector or HCLOUD_IP_FLOATER_SERVICE_LABEL_SELECTOR

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

--floating-label-selector or HCLOUD_IP_FLOATER_FLOATING_LABEL_SELECTOR

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-level or HCLOUD_IP_FLOATER_LOG_LEVEL

Log output verbosity (debug/info/warn/error)

Default: warn