Zum Hauptinhalt springen

Adding a Node

To add a node to your cluster, you can execute this script

Install flynnt on a node
curl -sL https://github.com/flynnt-io/flynnt-agent-install/releases/latest/download/flynnt.sh | bash -s - install -c <cluster-name> -n <node-name>

Of course, replace <cluster-name> and <node-name> with real values. The cluster name can be copied from Web UI. The node name should be unique-per-cluster, but can be made up by you.

Open Source

The agent installer is Open Source and lives at Github

If you execute this script, it will prompt you to authenticate with a device code. Just follow the instructions on screen.

As user-interaction is not possible in most automation scenarios, you can also use an API Key to authenticate.

API Keys

You can create an API Key in the Web UI.

Create API Key

You can than go ahead and use it with the install script like so:

Install node with API key
curl -sL https://github.com/flynnt-io/flynnt-agent-install/releases/latest/download/flynnt.sh | API_KEY=<api_key> bash -s - install -c <cluster-name> -n <node-name>

This will not prompt you for device-code authentication and can be used in cloud-config scripts.

Terraform

This is an example that you can use to provision and join VMs from Hetzner Cloud to a flynnt cluster through terraform. This should be easily to port to other public cloud providers.

main.tf
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.44.1"
}
}
}

variable "hcloud_token" {
type = string
description = "The token for hcloud access"
sensitive = true
}

variable "flynnt_token" {
type = string
description = "The API Key for flynnt"
sensitive = true
}

variable "flynnt_cluster" {
type = string
description = "The cluster name that will be used for nodes"
}

# Configure the Hetzner Cloud Provider
provider "hcloud" {
token = var.hcloud_token
}

data "hcloud_ssh_keys" "all_keys" {}

locals {
cluster_members = ["node-1"]
}

resource "hcloud_server" "node" {
for_each = toset(local.cluster_members)
name = each.key
image = "ubuntu-22.04"
server_type = "cx31"
location = "nbg1"

ssh_keys = data.hcloud_ssh_keys.all_keys.ssh_keys.*.name

public_net {
ipv4_enabled = true
ipv6_enabled = false
}

user_data = <<-EOF
#cloud-config
runcmd:
- curl -sL https://github.com/flynnt-io/flynnt-agent-install/releases/latest/download/flynnt.sh | API_KEY=${var.flynnt_token} bash -s - install -c ${var.flynnt_cluster} -n ${each.key}
EOF
}