π§ Maintained fork of
cbeneke/hcloud-fip-controller
A robust Kubernetes controller for managing Hetzner Cloud Floating IPs (FIPs). Automatically assigns floating IPs to healthy nodes based on pod labels and node IPs.
- π― Leader Election β Only one active controller instance
- π Periodic Reconciliation β Automatic floating IP reassignment
- π₯ Health & Readiness Probes β Kubernetes-native health checks
- π‘οΈ Resilient β Handles transient Hetzner API issues gracefully
- π Structured Logging β Detailed, parseable logs
- π Security Hardened β Signed images, SBOMs, CVE scanning
- π¦ Distroless Runtime β Minimal attack surface (Chainguard Static)
- π Multi-Architecture β Supports
linux/amd64andlinux/arm64
The original project is no longer actively maintained. This fork addresses critical issues:
| Issue | Original | This Fork |
|---|---|---|
| API Error Handling | β Crashes on 503 errors |
β Retry with exponential backoff |
| Health Endpoints | β None | β
/healthz and /readyz |
| Observability | β Structured, detailed logs | |
| Container Security | β Distroless, signed, SBOM | |
| Active Maintenance | β Archived | β Actively maintained |
- Kubernetes cluster running on Hetzner Cloud
- Hetzner Cloud API token with read/write access
kubectlconfigured to access your cluster
kubectl create namespace fip-controller
kubectl create secret generic hcloud-token \
--namespace fip-controller \
--from-literal=token=YOUR_HETZNER_API_TOKENkubectl apply -f https://raw.githubusercontent.com/mpowr-it/hetzner-fip-controller/main/deploy/manifests.yamlEdit the ConfigMap to specify your floating IPs:
kubectl edit configmap fip-controller-config -n fip-controllerAdd your floating IPs:
data:
HCLOUD_FLOATING_IPS: "1.2.3.4,5.6.7.8"
NAMESPACE: "default"
POD_LABEL_SELECTOR: "app=myapp"kubectl get pods -n fip-controller
kubectl logs -n fip-controller -l app=fip-controllerhelm repo add mpowr https://charts.mpowr.io
helm repo update
helm install hetzner-fip-controller mpowr/hetzner-fip-controller \
--namespace fip-controller \
--create-namespace \
--set hcloudToken=YOUR_HETZNER_API_TOKEN \
--set floatingIPs="{1.2.3.4,5.6.7.8}"All container images are signed with Sigstore/Cosign:
# Verify image signature
cosign verify \
--certificate-identity-regexp=https://github.com/mpowr-it/hetzner-fip-controller \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
mpowr/hetzner-fip-controller:latest
# Download SBOM
cosign download sbom mpowr/hetzner-fip-controller:latest > sbom.json
# Verify attestations
cosign verify-attestation \
--certificate-identity-regexp=https://github.com/mpowr-it/hetzner-fip-controller \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--type=https://spdx.dev/Document \
mpowr/hetzner-fip-controller:latest- β Signed Images β Verifiable with Cosign
- β SBOM Included β Software Bill of Materials (SPDX + CycloneDX)
- β CVE Scanning β Automated with Trivy & Grype
- β Distroless Base β Chainguard Static (zero packages)
- β Non-Root User β Runs as UID 65532
- β Read-Only Root FS β Immutable container filesystem
- β No Shell β Attack surface minimization
Check the Security Tab for the latest vulnerability scan results.
# Build binary
make build
# Run tests
make test
# Build Docker image
make docker-build
# Security scan
make docker-securityThis project uses Devbox for reproducible dev environments:
# Install devbox
curl -fsSL https://get.jetpack.io/devbox | bash
# Enter dev shell
devbox shell
# All tools (Go, golangci-lint, trivy, etc.) are now available
make all| Variable | Description | Default | Required |
|---|---|---|---|
HCLOUD_TOKEN |
Hetzner Cloud API token | - | β |
HCLOUD_FLOATING_IPS |
Comma-separated list of floating IPs | - | β |
NAMESPACE |
Kubernetes namespace to watch | default |
β |
POD_NAME |
Specific pod name to watch | - | β |
POD_LABEL_SELECTOR |
Label selector for pods | - | β |
NODE_NAME |
Kubernetes node name | Auto-detected | β |
NODE_ADDRESS_TYPE |
Address type to use (external, internal) |
external |
β |
LOG_LEVEL |
Log level (debug, info, warn, error) |
info |
β |
LEASE_DURATION |
Leader election lease duration (seconds) | 15 |
β |
LEASE_RENEW_DEADLINE |
Leader election renew deadline (seconds) | 10 |
β |
BACKOFF_DURATION |
Initial backoff duration | 1s |
β |
BACKOFF_FACTOR |
Backoff multiplier | 1.2 |
β |
BACKOFF_STEPS |
Maximum backoff retries | 5 |
β |
apiVersion: v1
kind: ConfigMap
metadata:
name: fip-controller-config
namespace: fip-controller
data:
HCLOUD_FLOATING_IPS: "1.2.3.4,5.6.7.8"
NAMESPACE: "production"
POD_LABEL_SELECTOR: "app=nginx,tier=frontend"
NODE_ADDRESS_TYPE: "external"
LOG_LEVEL: "info"
LEASE_DURATION: "15"
LEASE_RENEW_DEADLINE: "10"
BACKOFF_DURATION: "2s"
BACKOFF_FACTOR: "1.5"
BACKOFF_STEPS: "5"- Leader Election: Multiple controller replicas elect a leader using Kubernetes leases
- Pod Discovery: Watches pods matching the configured label selector
- Node Selection: Identifies healthy nodes running the target pods
- IP Assignment: Assigns floating IPs to the selected node via Hetzner API
- Reconciliation: Periodically verifies and corrects floating IP assignments
- Failover: Automatically reassigns IPs when nodes become unhealthy
- Liveness Probe:
GET /healthzβ Returns200if controller is running - Readiness Probe:
GET /readyzβ Returns200if controller is ready to handle requests
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 5
periodSeconds: 5Prometheus metrics endpoint will be available in a future release at /metrics.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Run
make fmtbefore committing - Ensure
make lintpasses - Add tests for new features
- Update documentation as needed
- Leader election
- Health and readiness endpoints
- Structured logging
- Retry logic with exponential backoff
- Multi-architecture Docker images
- Security hardening (signing, SBOM, CVE scanning)
- Prometheus metrics
- Helm chart
- Automated testing suite
- IPv6 support
- Multiple floating IP pools
This project is a maintained fork of the original
cbeneke/hcloud-fip-controller,
which is licensed under the Apache License, Version 2.0.
All modifications in this fork are also provided under the Apache License, Version 2.0.
See LICENSE for details.
- Original project by Christian Beneke
- Hetzner Cloud for their excellent API and cloud platform
- The Kubernetes community for the amazing ecosystem
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: See SECURITY.md for reporting vulnerabilities
Made with β€οΈ by mpowr