Controller to assign hetzner cloud floating IPs to current kubernetes node
50K+
This project is currently work in progress. It might not work and/or not be documented. Please use with care and feel free to open bug tickets and pull requests. :)
This is a small controller, meant to be running on a kubernetes cluster on hetzner cloud virtual machines.
The running pod will check the hetzner cloud API every 30 seconds to check if the configured IP Addresses (or subnets in case of IPv6) are assigned to the server, the running pod is scheduled to. If not it will update the assignments. You need to make sure, to have the IP Addresses configured on every node for this failover to correctly work, as the controller will not take care of the network configuration of the nodes.
Environment variables take precedence over the config file
HCLOUD_API_TOKEN
API token for the hetzner cloud access.
HCLOUD_FLOATING_IP
Floating IP you want to configure. In case of IPv6 can be any of the /64 net. If you want to use multiple IPs use config file or command line parameters
NODE_ADDRESS_TYPE, default: "external"
Address type of the nodes. This might be set to internal, if your external IPs are registered as internal IPs on the node objects (e.g. if you have no cloud controller manager). Can be "external" or "internal".
NODE_NAME
name of the scheduled node. Should be invoked via fieldRef to spec.nodeName
Valid fields in the config.json file and their respective ENV variables are
{
"hcloudFloatingIPs": [
"<HCLOUD_FLOATING_IP>"
],
"hcloudApiToken": "<HCLOUD_API_TOKEN>",
"nodeAddressType": "<NODE_ADDRESS_TYPE>",
"nodeName": "<NODE_NAME>"
}
You can install the deployment in a kubernetes cluster with the following commands
$ kubectl create namespace fip-controller
$ kubectl apply -f deploy/rbac.yaml
$ kubectl applf -f deploy/deployment.yaml
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: fip-controller-config
namespace: fip-controller
data:
config.json: |
{
"hcloudFloatingIPs": [
"<hcloud-floating-ip>",
"<hcloud-floating-ip>",
...
]
}
---
apiVersion: v1
kind: Secret
metadata:
name: fip-controller-secrets
namespace: fip-controller
stringData:
HCLOUD_API_TOKEN: <hcloud_api_token>
EOF
Content type
Helm
Digest
sha256:6a16411a2…
Size
3.8 kB
Last updated
25 days ago
helm pull oci://registry-1.docker.io/cbeneke/hcloud-fip-controller --version 0.5.2