# Nomad CLI Cheatsheet (Detailed) # General Syntax: nomad [subcommand] [options] [args] # --- Common Global Options --- # -address= Nomad server address (env: NOMAD_ADDR) # -namespace= Target namespace (env: NOMAD_NAMESPACE, default: "default") # -region= Target region (env: NOMAD_REGION) # -token= ACL token for request (env: NOMAD_TOKEN) # -ca-cert= Path to CA cert file for TLS # -client-cert= Path to client cert file for TLS # -client-key= Path to client key file for TLS # -tls-skip-verify Disable TLS host verification (INSECURE) # -json Output in JSON format # -t | -template= Format output using Go template # -verbose | -v Verbose output # -h | -help Help for any command/subcommand # --- Job Management --- nomad job run # Run a new job or update an existing one nomad job run -detach # Run and don't wait for deployment to complete nomad job run -check-index # Run only if ModifyIndex matches (optimistic concurrency) nomad job run -var="key=value" # Pass variables to the job nomad job run -var-file="vars.tfvars" # Pass variables from a file nomad job plan # Dry-run, show changes without applying nomad job plan -diff # Show a detailed diff of changes nomad job status # Status of a job and its allocations nomad job status -verbose # Detailed status including events nomad job status # Status of all jobs in the namespace nomad job inspect # Show job definition as submitted (effective spec) nomad job stop # Stop a job (sends SIGINT, then SIGKILL) nomad job stop -purge # Stop and purge job (remove from listings) nomad job stop -detach # Stop and don't wait nomad job stop -no-shutdown-delay # Stop without shutdown delay (Nomad 1.4+) nomad job logs # Logs for all allocations of a job (stdout) nomad job logs -f # Follow/tail logs nomad job logs -stderr # Show only stderr nomad job logs -task # Logs for a specific task group within the job nomad job dispatch # Dispatch a parameterized or batch job nomad job dispatch -meta "key=value" # Dispatch with meta parameters nomad job dispatch -payload # Dispatch with payload from file nomad job revert # Revert job to a previous version nomad job history # Show job version history nomad job scale # Scale a task group (Nomad 1.3+) nomad job scale -status # Get current scale status nomad job validate # Validate job file syntax locally nomad job fmt # Format job files to HCL2 canonical format nomad job allocs # List allocations for a specific job nomad job deployments # List deployments for a specific job # --- Allocation Management --- nomad alloc status # Status of a specific allocation nomad alloc status # Status of all allocations (can be filtered by job/node) nomad alloc inspect # Inspect an allocation, shows details and events nomad alloc logs # Logs for all tasks in an allocation nomad alloc logs -f # Follow logs for an allocation nomad alloc logs # Logs for a specific task in an allocation nomad alloc fs [PATH] # List files or cat file content in an alloc's sandbox nomad alloc fs ls /alloc/logs/ # List files in logs directory nomad alloc fs cat /alloc/data/my_file.txt # Cat a file nomad alloc fs -G stat /alloc/data/my_file.txt # Stat a file (like `ls -l`) nomad alloc exec [-i -t] [ARGS...] # Execute command in allocation's default task nomad alloc exec -i -t -task /bin/sh # Interactive shell in specific task nomad alloc restart # Restart all tasks in an allocation nomad alloc signal [-s SIGKILL] # Send signal to a task in an alloc (default SIGTERM) nomad alloc stop # Stop an allocation (useful for system/sysbatch jobs) # --- Node / Client Management --- nomad node status # Status of all client nodes nomad node status # Status of a specific node nomad node status -verbose # Detailed status including resources and events nomad node drain -enable # Drain a node (prevent new allocs, migrate existing) nomad node drain -enable -deadline=5m # Drain with a deadline nomad node drain -enable -ignore-system # Drain, don't migrate system jobs nomad node drain -disable # Undrain a node, make it eligible again nomad node eligibility -enable # Enable scheduling eligibility for a node nomad node eligibility -disable # Disable scheduling eligibility for a node nomad node allocs # List allocations running on a specific node # --- Server / Cluster Management --- nomad server members # List server members, status, protocol version nomad operator raft list-peers # Show Raft peers, leader, last index nomad operator raft remove-peer -address # Remove a dead server (USE WITH CAUTION) nomad operator raft autopilot get-config # View Autopilot configuration nomad operator raft autopilot set-config [OPTS] # Configure Autopilot (e.g., -cleanup-dead-servers) nomad operator raft autopilot state # View Autopilot health state nomad operator scheduler get-config # View current scheduler configuration nomad operator scheduler set-config [OPTS] # Modify scheduler config (e.g., -memory-oversubscription-enabled) nomad system gc # Force server-side garbage collection (jobs, nodes, evals) # --- Deployments (Managing Job Updates) --- nomad deployment list # List active deployments nomad deployment status # Status of a specific deployment nomad deployment promote # Promote a canary deployment or unblock a paused one nomad deployment promote -all # Promote all canaries at once nomad deployment fail # Mark a deployment as failed, triggers rollback nomad deployment pause # Pause an in-progress deployment nomad deployment resume # Resume a paused deployment nomad deployment unblock # Unblock a deployment that failed due to unhealthy allocs # --- Variables (Nomad Enterprise or OSS with compatible plugins) --- nomad var list [PREFIX_PATH] # List variables, optionally filtered by prefix nomad var get # Get a variable's value nomad var get -version= # Get a specific version of a variable nomad var put = # Set/update a variable nomad var put @ # Set/update a variable from file content nomad var delete # Delete a variable # --- ACL Management --- nomad acl bootstrap # Bootstrap ACL system (first time setup) nomad acl policy list # List ACL policies nomad acl policy inspect # Inspect an ACL policy nomad acl policy apply # Create/update an ACL policy nomad acl policy delete # Delete an ACL policy nomad acl role list # List ACL roles nomad acl role inspect # Inspect an ACL role nomad acl role create -name= -policy= # Create an ACL role nomad acl role delete # Delete an ACL role nomad acl token list # List ACL tokens (requires management token) nomad acl token self # Display current token's properties nomad acl token create -name= -role= # Create an ACL token nomad acl token delete # Delete an ACL token # --- Volume Management (CSI) --- nomad volume create # Create a new volume nomad volume list # List all volumes nomad volume status # Status of a specific volume nomad volume inspect # Inspect a volume's details nomad volume delete # Delete a volume (must be detached) nomad volume detach # Detach volume from a node (for maintenance) # --- Namespace Management --- nomad namespace list # List all namespaces nomad namespace inspect # Inspect a namespace's details nomad namespace apply # Create or update a namespace nomad namespace delete # Delete a namespace (must be empty) # --- Other Useful Commands --- nomad ui [-address ] # Open Nomad Web UI in browser (default: localhost:4646) nomad version # Show Nomad CLI and Server version (if connected) nomad agent-info # Display information about the local Nomad agent (if running) # --- Tips & Aliases (example for .bashrc/.zshrc) --- # alias n='nomad' # alias njr='nomad job run' # alias njs='nomad job status' # alias nji='nomad job inspect' # alias njl='nomad job logs -f' # alias nas='nomad alloc status' # alias nal='nomad alloc logs -f' # alias nae='nomad alloc exec -i -t' # alias nns='nomad node status' # alias nd='nomad deployment'