Nomad 소개하기

Nomad Guidebook
이민석's avatar
Jul 02, 2024
Nomad 소개하기

이 문서는 Nomad 학습을 위해서 작성되었습니다.
Nomad에 대한 기본적인 소개부터 Deploying, Securing, Interacting 부터 Nomad Job과 상호작용/확장하는 것부터 Nomad 환경변수를 다루는 것을 포함하고 있습니다.

Nomad란?

Nomad는 Container Orchestrator 툴 중 하나로 아래와 같은 특징을 가지고 있습니다.

  1. Much simpler alternative to kubernetes

  2. Nomad can deploy, manage, and scale containers for your environment

  3. You can use Nomad to deploy containers on-prem, at the edge, and on any cloud platform. Multi-region and multi-datacenter support.

  4. Nomad can scale to thousands of nodes in a single cluster

  5. Supports non-containerized as well, such as VMs, binaries, and more…

  6. Tight integration into the HashiCorp ecosystem.

Nomad는 기본적으로 2가지 역할로 나누어서 작업을 진행합니다.

  1. Develoepr : Nomad Job 작성

  2. Operator : Nomad Policies 작성

이 작업들은 AWS WEST, AZURE WEST, ON-PREM 까지 폭 넓게 배포될 수 있습니다.

Nomad Components

대표적인 Nomad Components는 Node와 Agent로 구분됩니다.

Target

Definition

Node

A Physical or virtual machine in the cluster.
A node is a machine running the Nomad Agent.

Agent

Long-running daemon running on every member of the Nomad cluster.
Agent can run in either client or server mode.
This is eseentially the binary that is downloaded from HashiCorp

Node Agent Component는 2가지 모드로 구분됩니다.

Target

Definition

Server Mode

An agent running on a server that holds the global state of the cluster and participates in scheduling decisions.

Client Mode

An agent that fingerprints the host to determine the capabilites, resources, and available drivers.
Responsible for running workloads such as containers.

추가적으로 아래의 Nomad Components들도 존재합니다.

Target

Definition

Job

Definition of how a workload should be scheduled.
The job specification (spec) is composed of one or more task groups, and each task defines a series of resource configurations and constraints.

A job is submitted to Nomad and represents a desire state.
For example, run 3 instances of my application using this Docker image and spread them across thress nodes to ensure high-availability.

Job Specification
(jobspec)

An HCL configuration file on disk which how a workload should be scheduled.
It contains multiple stanzas that define configurations such as jobs, groups, tasks, services, and resources for the application.

Driver

Pluggable components that execute a task and provide resource isolation.
Example drivers include: docker, java, podman, and raw-exec
Drive must be installed/available before tasks can be executed. For example, if you submit a job to schedule Docker containers, Docker must be available on the Nomad clients to use…

Task

A command, service, application, or “set of work” to be executed by Nomad.

Tasks are executed by their driver.

Examples include:

  • Run these containers

  • Execute these commands

  • Run this java application from a .jar file

Task Group

A collection of individual task that should be co-located on the same node.
Any task within the defined group will be placed on the same Nomad client.

This is especailly useful for applications that require low latency or have high throughput to another application in the task group

Evaluation

A calculation performed by the Nomad servers to determine what action(s) need to take place to execute a job.
Nomad performs evaulations whenever jobs are submitted or client state changes to determine if what changes need to be made to ensure the desired state.

Allocation

The mapping of tasks in a job to clients is done using allocations

An allocation is used to declare that a set of tasks in a job should be run on a particular node.

Allocations can fail if there are not enough resources to execute the task, a node is down, etc.

전체적으로 Nomad Component Scheduling Flow를 보면 다음과 같습니다.

  1. Job

    1. Submitted by users

    2. Represents desired state

    3. Trigger an evaluation when submitted

  2. Evaluation

    1. Compared current state to desire state

    2. Evaluates the state and reconciles it

  3. Allocation

    1. Map the tasks in the job to a client

    2. Determines set of tasks that should run on a client

  4. Client

    1. Runs the set of tasks defined in the job spec.

    2. This is where the containers are scheduled.

Share article
RSSPowered by inblog