liveBook · Manning

Nomad network block

As explained in Road to Kubernetes

A Nomad network block is a group-level configuration block that declares network values, including ports, available to tasks in the group.

A Nomad network block is a group-level configuration block that names ports and maps them to internal container ports. Every task in the group can use those named values. section 9.2.5

Map two application ports

Define named ports in the group, then reference each name from the matching task: Python uses "http-py" for container port 8080, while Node.js uses "http-js" for port 3000. The network block supplies the values; task configuration connects containers to them. section 9.2.5

Listing 9.10 Nomad job with network port mapping
job "web" {
  group "apps" {
    ...
    network {
      port "http-py" {
        to = 8080
      }
      port "http-js" {
        to = 3000
      }
    }

  }
}

Inspect the compact Nomad job fragment showing named ports and their internal container destinations. section 9.2.5

How Road to Kubernetes covers it

How deep it goes
Explains named ports and container destinations, then stops short of public exposure, which requires a service definition.
Examples
Uses Python and Node.js containers mapped to internal ports 8080 and 3000 through named ports.
What it assumes
Assumes familiarity with Nomad groups and tasks while showing the network and task configuration needed from the deployment example.
What you can do after
Apply it via a Nomad job definition by declaring named group ports and assigning those names to tasks.
How it connects
Connects Nomad jobs with groups, tasks, containers, port mapping, and task-level services.

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.