Starting a Node
If we've performed our pre-flight checks and they've passed, then starting a Nex node is as easy as pointing the nex node
command at the checked configuration file.
Superuser Permissions
The nex
node process makes a number of secure kernel calls in order to set up CNI networks and start the firecracker
binary. While it might be possible to manually craft a user with just the right set of permissions such that sudo
is unnecessary, when you're in your development loop, sudo
is probably the easiest way to go.
Node Up
The command to bring up a new node process is node up
. There are a lot of options that you can specify here, as well as options available in the configuration file. All of those details can be found in the reference section.
This might seem a bit spammy, but the vast majority of this is full of useful information. The first thing you see is that the node established a connection to NATS on 127.0.0.1:4222
. This is the control plane connection, e.g. the connection through which Nex remote management commands are issued. This should not be confused with the NATS connection that individual workloads use, as that should absolutely be a different connection for security reasons.
Encrypted Environment Variables
The next two lines of the node output log also give important details:
First, you see an Xkey, which is the target public key that should be used when encrypting data bound for this particular node. This is used to encrypt the environment variables that are supplied with workload deployment requests. Don't worry, though, the nex
CLI takes care of this for you.
Filling the Virtual Machine Pool
Next up in the node's output log is a line like this one:
This indicates that we've actually started a Firecracker virtual machine and, for information and debugging purposes, we output the gateway IP address, the tap device name, the internal NATS host, internal nats port, and ultimately the ID of the virtual machine.
The Nex node process keeps a pool of "warm" virtual machines, the size of which is configurable in the node configuration file. When you issue a work deployment request, the next available warm VM is taken from the pool and the work is dispatched to it.
Readiness Indicator
Probably the single most important piece of log output is the indication of a successful handshake. Each time we attempt to add a virtual machine to the pool, the agent running inside tries to make contact with the host node process. If this exchange is successful, you'll see the following message:
If you don't, and instead see an error indicating a timeout or failure to perform the handshake, the node will terminate. If a node can't properly dispense virtual machines, then there's no reason for it to continue running.
Interrogating Nodes
With this node still running, open another terminal and issue the following nex
command:
This will show you the summary information of all discovered nodes. Any given NATS infrastructure can run as many Nex nodes in as many locations and clusters as desired.
Now let's move on to deploying our echo service.
Last updated