Skip to content

Instantly share code, notes, and snippets.

View angrycub's full-sized avatar

Charlie Voiselle angrycub

View GitHub Profile

Nomad Variables

Motivation

Many workloads running in Nomad need a means for acquiring a secret or sensitive configuration information. HashiCorp Vault provides industry leading secrets management and Nomad has an integration that enables Vault to be a backing store for this type of information.

However, we kept hearing from the community that deploying, managing, and integrating with Vault was a lot of effort for smaller use-cases, early proof-of-concept work, and home labs. Nomad users wanted something easier to use out of the box for these types of projects. To meet these needs, we created Nomad Variables.

Nomad Variables enables you to provide secrets and configuration to your job:

@angrycub
angrycub / NomadVarExamples.md
Last active September 8, 2022 15:12
Nomad `var` Shenanigans

Nomad Variable CLI Shenanigans

First steps

Create a variable as key-value pairs.

nomad var put my/first/var user=me password=passW0rd thoughts=awesome 
@angrycub
angrycub / repro.sh
Last active January 17, 2022 12:42
Spin up a dev agent with ACLs enabled for simple test cases.
#!/bin/bash
NOMAD_VERSION="1.0.4"
wait() {
if [[ "$1" != "" ]]
then
message="⌛️ $1..."
else
message="⌛️ Press any key to continue..."
@angrycub
angrycub / repro-11144.sh
Created September 7, 2021 15:22
Reproducer for RPCUpgradeMode PR
#!/bin/bash
nomad_bin=${HOME}/github/hashicorp/nomad/pkg/darwin_amd64/nomad
#nomad_bin=/usr/local/bin/nomad
show_file () {
echo ""
echo "+================================================"
echo "| 📄 ${1}"
echo "+------------------------------------------------"
@angrycub
angrycub / WindowsBootstrap.ps1
Created August 26, 2021 16:05
Windows Bootstrap Script for Nomad
# WindowsBootstrap
# ----------------
# By default, this script will install Consul and Nomad both in client+server mode to create
# a single node Windows cluster. This script also installs Windows Containers. Would be good
# to have Java and QEMU in here too as optional dependencies for task drivers.
## Don't forget to add a password for the services.
$CONSUL_VERSION = 1.10.1
$NOMAD_VERSION = 1.0.3
@angrycub
angrycub / consul-connect-p1.md
Last active January 17, 2022 12:42
Consul Connect - Consul ACL Token Handling Part 1

Consul Connect / ACL Enformcement Flow

Nomad starts the JobEndpoint

In the beginning of time, the Nomad server makes a JobEndpoint using the NewJobEndpoints function.

Job is submitted

A job is submitted to the API (either directly or via the CLI).

The API sends a JobRegisterRequest to Register(). The Register() call is forwarded to the leader where execution continues.

@angrycub
angrycub / _README.md
Created April 26, 2021 16:39
Single Node Nomad Configuration

Single Node Nomad Configuration

This is a complex and unsupported configuration

Nomad is designed to be a highly-available, quorum-based cluster scheduler. Nomad deployments need to have three or more server nodes and one or more client nodes.

That said, Nomad does provide a dev mode which enables you to run Nomad with a single agent process. However, Nomad dev agents do behave slightly different than non-dev agents. To create a more authentic feeling experience, you might want to run Nomad with a configuration

@angrycub
angrycub / eventstream.py
Created April 19, 2021 15:13
Minimal Python Client for Nomad Event Stream
import json
import requests
import sys
URL_BASE = "http://127.0.0.1:4646"
URL_API_PATH = "/v1/event/stream"
URL_QUERY_STRING = ""
#URL.QUERY_STRING = "?topic=Node:*"
url = URL_BASE + URL_API_PATH + URL_QUERY_STRING
@angrycub
angrycub / basic-nginx.ctmpl
Created April 14, 2021 17:32
Basic NGINX template for an example
server {
listen {{ env "PORT" }};
server_name {{ env "DOMAIN" }};
location / {
proxy_pass http://{{ env "UPSTREAM" }};
}
}
@angrycub
angrycub / unfederate.md
Created November 25, 2020 14:25
Manually Unfederating a Nomad Cluster using a Network Partition
title date draft tags menu
Manually Unfederating a Nomad Cluster using a Network Partition
2017-12-07 12:49:20 -0500
false
nomad
main
parent
Nomad