Nomad is designed to be flexible and resilient when upgrading from one Nomad version to the next. Upgrades should cause neither a Nomad nor a service outage. However, there are some restrictions to be aware of before upgrading:
Nomad strives to be backward compatible for at least 1 point release, so Nomad v1.6.x hosts work with v1.5.x hosts. Upgrading 2 point releases (for example, from v1.4.0 to v1.6.0) may work but is untested and unsupported.
Nomad does not support downgrading at this time. Downgrading clients requires draining allocations and removing the data directory. Downgrading servers safely requires re-provisioning the cluster.
New features are unlikely to work correctly until all nodes have been upgraded.
Check the version upgrade details page for important changes and backward incompatibilities.
When upgrading a Nomad Client, if it takes longer than the
heartbeat_grace(10s by default) period to restart, all allocations on that node may be rescheduled.
Nomad supports upgrading in place or by rolling in new servers:
In Place: The Nomad binary can be updated on existing hosts. Running allocations will continue running uninterrupted.
Rolling: New hosts containing the new Nomad version may be added followed by the removal of old hosts. The old nodes must be drained to migrate running allocations to the new nodes.
This guide describes both approaches.
Once you have checked the upgrade details for the new version, the upgrade process is as simple as updating the binary on each host and restarting the Nomad service.
At a high level we complete the following steps to upgrade Nomad:
- Add the new version
- Check cluster health
- Remove the old version
- Check cluster health
- Upgrade clients
While it is possible to upgrade Nomad client nodes before servers, this guide recommends upgrading servers first as many new client features will not work until servers are upgraded.
In a federated cluster, new features are not guaranteed to work until all agents in a region and the server nodes in the authoritative region are upgraded.
Whether you are replacing Nomad in place on existing systems or bringing up new servers you should make changes incrementally, verifying cluster health at each step of the upgrade.
On a single server, install the new version of Nomad. You can do this by joining a new server to the cluster or by replacing or upgrading the binary locally and restarting the Nomad service.
Note that if you have
you should ensure you're using the expected signal for your upgrade process. For
example, if you have
leave_on_terminate set and you intend on updating a
server in-place, you should
SIGINT and not
SIGTERM when shutting down the
server before restarting it.
Monitor the Nomad logs on the remaining servers to check that the new server has joined the cluster correctly.
nomad agent-info on the new servers and check that the
is of a similar value to the other servers. This step ensures that changes have
been replicated to the new server.
ubuntu@nomad-server-10-1-1-4:~$ nomad agent-info
bootstrap = false
known_regions = 1
leader = false
server = true
applied_index = 53460
commit_index = 53460
fsm_pending = 0
last_contact = 54.512216ms
last_log_index = 53460
last_log_term = 1
last_snapshot_index = 49511
last_snapshot_term = 1
num_peers = 2
Continue with the upgrades across the servers making sure to do a single Nomad
server at a time. You can check state of the servers with
nomad server members, and the state of the client nodes with
nomad node status.
If you are doing an in place upgrade on existing servers this step is not necessary as the version was changed in place.
If you are doing an upgrade by adding new servers and removing old servers from the fleet you need to ensure that the server has left the fleet safely.
- Stop the service on the existing host
- On another server issue a
nomad server membersand check the status, if the server is now in a left state you are safe to continue.
- If the server is not in a left state, issue a
nomad server force-leave <server id>to remove the server from the cluster.
Monitor the logs of the other hosts in the Nomad cluster over this period.
Use the same actions in step #2 above to confirm cluster health.
Following the successful upgrade of the servers you can now update your
clients using a similar process as the servers. You may either upgrade clients
in-place or start new nodes on the new version. See the Workload Migration
Guide for instructions on how to migrate running
allocations from the old nodes to the new nodes with the
nomad node drain command.
You are now running the latest Nomad version. You can verify all
Clients joined by running
nomad node status and checking all the clients
are in a
Before upgrading servers to Nomad Enterprise versions 1.6.0 and later,
you should validate your enterprise license with the
nomad license inspect command
using the binary that you are upgrading to.
See the licensing FAQ
for more information.
After that, the process of upgrading to a Nomad Enterprise version is identical to upgrading between versions of open source Nomad. The same guidance above should be followed and as always, prior to starting the upgrade please check the specific version details page as some version differences may require specific steps.
This section provides details on upgrading to Raft Protocol 3. Raft protocol version 3 requires Nomad running 0.8.0 or newer on all servers in order to work. Raft protocol version 2 will be removed in Nomad 1.4.0.
To see the version of the Raft protocol in use on each server, use the
nomad operator raft list-peers command.
Note that the format of
peers.json used for outage recovery is
different when running with the latest Raft protocol. See Manual
for a description of the required format.
When using Raft protocol version 3, servers are identified by their
node-id instead of their IP address when Nomad makes changes to its
internal Raft quorum configuration. This means that once a cluster has
been upgraded with servers all running Raft protocol version 3, it
will no longer allow servers running any older Raft protocol versions
to be added.
For production raft clusters with 3 or more members, the easiest way
to upgrade servers is to have each server leave the cluster, upgrade
raft_protocol version in the
server block (if upgrading to
a version lower than v1.3.0), and then add it back. Make sure the new
server joins successfully and that the cluster is stable before
rolling the upgrade forward to the next server. It's also possible to
stand up a new set of servers, and then slowly stand down each of the
older servers in a similar fashion.
For in-place raft protocol upgrades, perform the following for each server, leaving the leader until last to reduce the chance of leader elections that will slow down the process:
- Stop the server.
nomad server force-leave $server_name.
- If the upgrade is for a Nomad version lower than v1.3.0, update the
raft_protocolin the server's configuration file to
- Restart the server.
nomad operator raft list-peersto verify that the
RaftProtocolfor the server is now
- On the server, run
nomad agent-infoand check that the
last_log_indexis of a similar value to the other servers. This step ensures that raft is healthy and changes are replicating to the new server.
If you are running a single Nomad server, restarting it in-place will
result in that server not being able to elect itself as a leader. To
avoid this, create a new
peers.json file before
restarting the server with the new configuration. If you have
installed you can run the following script on the server's host to
write the correct
NOMAD_DATA_DIR=$(nomad agent-info -json | jq -r '.config.DataDir')
NOMAD_ADDR=$(nomad agent-info -json | jq -r '.stats.nomad.leader_addr')
cat <<EOF > "$NOMAD_DATA_DIR/server/raft/peers.json"
After running this script, if the upgrade is for a Nomad version lower
than v1.3.0, update the
raft_protocol in the server's
3 and restart the server.