Provision the infrastructure
We will use terraform to create some devices in Equinix.
Configure
Create a new local directory and change into it:
mkdir lm-equinix
cd lm-equinixGenerate an API key for both Equinix and Tailscale.
Create a new SSH key pair:
ssh-keygen -t ed25519 -f lm-key -N ""
Connect your local machine to Tailscale:
For Linux users:
sudo tailscale up --accept-routes
For other OS users:
sudo tailscale up
Install the Equinix CLI tool.
Find an Equinix metro with sufficient capacity.
metal capacity get
Make note of the
FACILITY
andPLAN
which has anormal
availabity level. In my case I will choose:| am6 | c3.small.x86 | normal |
Write the following to a
main.tf
file:Contents
cat << EOF >main.tf
module "create_devices" {
source = "weaveworks-liquidmetal/liquidmetal/equinix"
version = "0.0.3"
metal_auth_token = "my equinix auth token"
org_id = "my org id"
project_name = "my-lm-project"
public_key = "my ssh public key"
metro = "your chosen metro"
server_type = "your chosen server type"
}
module "provision_hosts" {
source = "weaveworks-liquidmetal/liquidmetal/equinix//modules/provision"
version = "0.0.3"
ts_auth_key = "my tailscale auth key"
private_key_path = "/path/to/my/private/key"
vlan_id = module.create_devices.vlan_id
network_hub_address = module.create_devices.network_hub_ip
microvm_host_addresses = module.create_devices.microvm_host_ips
baremetal_host_addresses = module.create_devices.bare_metal_host_ips
}
output "network_hub_ip" {
value = module.create_devices.network_hub_ip
description = "The address of the device created to act as a networking configuration hub"
}
output "microvm_host_ips" {
value = module.create_devices.microvm_host_ips
description = "The addresses of the devices provisioned as flintlock microvm hosts"
}
EOFEdit these fields in your
main.tf
:metal_auth_token
: your API token for Equinix Metalorg_id
: Your Equinix org id.project_name
: The name of the project to create.public_key
: The contents of the.pub
file you created earlier.metro
: The metro of the facility you chose from your capacity check earlier. In my case I chose facilityam6
, so my metro will beam
.server_type
: The plan available in your chosen metro. In my case this isc3.small.x86
.ts_auth_key
: Your Tailscale auth key.private_key_path
: The full path to the private key you generated earlier.
Apply
Once your variables are configured, apply the plan:
terraform init
terraform plan
terraform apply
This make take a few minutes.
Once the apply
is complete, take a note of the following outputs:
network_hub_ip
microvm_host_ips
Approve the subnet routes
Once your network-hub
host is provisioned, navigate to your Tailscale dash, and
locate your network-hub
machine which should have come online in your network. Select
the machine.
On the machine page, click Review under the 'Subnets' section, and toggle your range to 'enabled'.
This bit is easy to overlook or forget, so I am highlighting here for extra clarity!
Test
To verify the flintlockd
services are ready to accept requests, you can use either fl
or
hammertime
to perform simple queries against the microvm_host_ips
returned
by the terraform:
hammertime list -a <address>:9090
fl microvm get --host <address>:9090