Introducing a new way to review your PRs.

Read the announcement

armadaproject / armada

A multi-cluster batch queuing system for high-throughput workloads on Kubernetes.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / armadactl-and-cli-workflows

Armadactl and CLI workflows

armadactl is the operator command surface for Armada. It connects an operator's selected Armada context to the API and supports the full day-to-day path from job submission and observation to queue, executor, and job control.

Command surface

The command surface groups actions by the object or operation that an operator needs to perform. Read commands expose queue state and scheduler reports. Write commands change jobs, queues, retry policies, or executor scheduling state. Resource reads can also produce structured YAML or JSON for people and scripts.

Resource management

Resource management covers queues and retry policies. A queue controls where jobs enter Armada and can carry ownership, labels, priority, cordon state, and retry-policy attachments. A retry policy describes how failed jobs may be retried.

The main resource actions are:

  • create: create a queue or retry policy. File-based resource creation supports validation without applying a change through --dry-run.
  • get: read one or more queues or retry policies. Queue lists can be narrowed by names or labels.
  • update: replace a queue or retry policy definition.
  • delete: remove a queue, retry policy, or executor record.

Queue updates are full replacements. An omitted queue setting can reset to its default, and an omitted retry-policy attachment can remove the queue's attachment. Operators should treat an update as a complete desired state rather than as a small patch.

Resource files use the Armada resource envelope. The supported API version is armadaproject.io/v1beta1, with Queue and RetryPolicy as the supported resource kinds. Retry-policy files are checked strictly so unknown or misspelled fields do not pass as a valid policy. Create and update commands for retry policies take a required YAML or JSON file. References: cmd/…/commands.go• L9-54, cmd/…/queue.go• L17-95, cmd/…/queue.go• L195-276, cmd/…/retrypolicy.go• L9-23, cmd/…/retrypolicy.go• L57-80, internal/…/retrypolicy.go• L46-81, pkg/…/resource.go• L9-19

Structured output

Structured output gives resource reads a stable document form for review and automation. get queue, get queues, get retry-policy, and get retry-policies accept -o or --output with yaml or json; the value is case-insensitive. Without the flag, the commands keep their usual YAML output.

Each document carries the Armada API version and resource kind. List results remain one document with a queues or retryPolicies collection, including when the collection is empty. Output from a resource read can be saved and used as input to resource creation, which supports a read, review, and apply workflow.

Machine-readable output stays on standard output. CLI logs go to standard error so status messages do not corrupt a YAML or JSON stream. References: cmd/…/output.go• L11-36, internal/…/output.go• L15-62, internal/…/queue.go• L82-139, internal/…/retrypolicy.go• L92-115, cmd/…/main.go• L10-18, cmd/…/README.md• L159-167

Job operations

Job operations act on a job, a job set, or a group selected by queue and worker location. A job set is the operator-facing group identifier used to submit related jobs and to follow or cancel them together.

OperationScopePurpose
submitJobs in a fileValidate and submit jobs to a queue and job set
cancel jobOne jobRequest cancellation by queue, job set, and job ID
cancel job-setOne job setRequest cancellation for the set
cancel queuesSelected queuesCancel matching active jobs by state, priority class, pool, or queue selector
reprioritize jobOne jobChange the job priority
reprioritize job-setOne job setChange the priority of jobs in the set
preempt jobOne jobRequest preemption with a reason

Queue-wide cancellation requires a narrowed selection by queue name or label. Queue-wide preemption follows the same selection rule. Queue cancellation also requires one or more active job states. Both operations can further limit the target by priority class and pool, and queue cancellation can limit it by active job state. Dry-run modes show the selected queue targets without applying the queue-wide action. References: cmd/…/submit.go• L11-42, cmd/…/cancel.go• L175-289, cmd/…/preempt.go• L153-243, cmd/…/reprioritize.go• L12-75

Scheduling control

Scheduling control changes whether Armada may place new work on a queue or executor. cordon pauses scheduling and uncordon resumes it. Queue actions accept names or label selectors. Executor actions require the executor name, and cordoning an executor also records a reason.

The same target model supports emergency work control:

  • cancel executor or cancel node stops matching active work at a worker scope.
  • preempt executor or preempt node requests preemption at a worker scope.
  • Executor and node actions can select queues and priority classes. Executor actions can also select pools.
  • If executor or node commands omit a queue filter, they apply across all queues. Omitted priority-class and pool filters also include all values in the supported scope.
  • delete executor removes an executor record from the scheduler database. It does not contact the executor itself.

These commands affect different boundaries. Queue cordoning changes admission to a queue. Executor or node actions target work already associated with worker capacity. Operators should select the boundary that matches the incident. References: cmd/…/cordon.go• L13-181, cmd/…/cancel.go• L69-172, cmd/…/preempt.go• L49-150, cmd/…/executor.go• L11-33, internal/…/cancel.go• L59-109, internal/…/preempt.go• L39-83, internal/…/cordon.go• L17-89

Observation and reports

Observation commands show the state and history needed to decide whether a control action is required. watch follows events for one queue and job set. It can print a readable state summary or raw event data, and it can stop when no jobs in the set remain active.

When a watched job fails, the CLI can print a kubectl logs hint for the failed pod. It uses the pod name from the event when available and falls back to the job-scoped pod name for older events. The command is built from kubectlCommandTemplate, which supports the cluster, namespace, command, and pod values, so operators can adapt the hint to their local Kubernetes access method.

Scheduler reports provide a second view of scheduling decisions. Operators can request a general report or a report for a queue or job. The dedicated queue-report and job-report commands are the current forms; the older selector flags on scheduling-report are deprecated.

The CLI also provides version for client build information and docs for local command documentation. These commands help confirm the binary in use and discover the installed command surface before an operation. References: cmd/…/watch.go• L11-56, internal/…/watch.go• L16-97, pkg/…/kubectl.go• L11-38, cmd/…/scheduling.go• L12-100, internal/…/scheduling.go• L11-83, cmd/…/version.go• L9-21, cmd/…/docs.go• L23-71

Client interactions

Each command first resolves connection settings, then delegates the requested operation to a client for the matching Armada API service. This keeps command parsing separate from API calls and gives all commands the same connection, authentication, retry, and transport behavior.

Configuration contexts

An Armada context is a named set of connection and authentication details. armadactl loads an optional executable-local defaults file and then merges the selected user configuration. The default user file is $HOME/.armadactl.yaml, while --config selects another file. The --context flag selects a context for one invocation, and config use-context, config get-contexts, and config current-context manage or inspect the saved choice.

The command can also use the direct --armadaUrl setting. Context settings take part in connection resolution, so a command that uses the wrong context can reach a valid Armada instance while acting on the wrong environment. References: cmd/…/config.go• L17-109, pkg/…/command_line.go• L25-57, pkg/…/command_line.go• L80-116, pkg/…/command_line.go• L119-209

API clients and transport

The client layer opens a gRPC connection for the selected Armada endpoint and creates the service client needed by the command. Submit and job control use the submit service. Event watching uses the event service. Scheduler reports use the scheduler reporting service. Queue, executor, and node actions use their matching service clients.

Connection setup applies the configured authentication method and uses TLS for non-local endpoints unless insecure transport is explicitly forced. The shared connection also supplies call readiness, compression, retry behavior, and optional keep-alive settings. The command closes the connection after the operation ends.

This relationship is the main boundary for troubleshooting:

flowchart LR
    A[armadactl command] --> B[Context and flags]
    B --> C[API connection details]
    C --> D{Armada API service}
    D --> E[Submit and job control]
    D --> F[Queue, executor, or node control]
    D --> G[Events]
    D --> H[Scheduler reports]
    E --> I[Operator output]
    F --> I
    G --> I
    H --> I

The command layer does not provide a separate permission model. The selected identity and the Armada API determine which reads and changes are allowed. References: cmd/…/params.go• L14-53, internal/…/app.go• L27-100, pkg/…/with_connection.go• L10-59, pkg/…/connection.go• L24-49, pkg/…/connection.go• L54-127

Authentication

The connection settings support several identity sources. They include basic credentials, Kubernetes-native identity, OpenID Connect flows, and an external command that returns authentication data. The first configured method in the connection resolver is used for API calls.

Authentication is attached to API requests rather than implemented by each command. This means a plugin invocation and a directly installed binary use the same identity rules when they read the same configuration. References: pkg/…/connection.go• L39-49, pkg/…/connection.go• L90-119

Plugin integration

armadactl can run as a normal executable or as a kubectl plugin managed by Krew. The plugin form keeps Armada operations beside other Kubernetes command-line tools while retaining the same Armada endpoint and context configuration.

Krew installation

The Krew manifest identifies the plugin as armadactl and maps supported operating-system and architecture pairs to signed Armada release archives. After installation, the command is invoked as kubectl armadactl <subcommand>.

The plugin wrapper does not change the command behavior. It starts the same armadactl binary, so operators still need a working Armada endpoint or a configuration file that points to one. References: plugins/armadactl.yml• L1-36, plugins/README.md• L3-14, plugins/README.md• L39-55

Binary installation

The release script selects the host operating system and architecture, downloads the latest release archive, and places the extracted binary in $HOME/bin. A release download or the script provides the direct armadactl form. The selected installation method changes only how the command is launched, not how it talks to Armada.

Operators should use armadactl --help or armadactl docs to check the command surface of the installed binary. This matters when a Krew manifest or local binary points to a different release than the source tree being read. References: scripts/get-armadactl.sh• L1-61, cmd/…/main.go• L10-17, cmd/…/root.go• L10-37

Operator workflows

The CLI supports a loop in which an operator selects the correct environment, creates or submits known work, observes Armada state, and applies a scoped control action when needed. The same loop supports routine administration and incident response.

Environment selection

Every API-backed command resolves its connection before it runs. A safe start is to inspect the current context and available contexts, then verify the endpoint and client version before a write operation.

sequenceDiagram
    participant O as Operator
    participant C as armadactl
    participant F as Config
    participant A as Armada API
    O->>C: config get-contexts
    C->>F: Load contexts
    F-->>C: Current and named contexts
    O->>C: version or read command
    C->>A: Connect with selected context
    A-->>C: Version or resource state
    C-->>O: Result

Use --context for a one-off environment choice. Use config use-context when the choice should persist in the selected configuration file. References: cmd/…/config.go• L30-109, pkg/…/command_line.go• L140-183, cmd/…/params.go• L14-24

Submission and completion

Submission starts with a YAML or JSON job file that names the target queue and job set. The CLI validates the file before sending it. A dry run stops after validation. A real submission sends the jobs to the submit API and reports accepted job IDs or per-job errors.

After submission, watch follows the job set's event stream. It rebuilds the current set state from events and can exit when all jobs are finished. This makes the workflow useful for both live progress and a bounded command in automation.

flowchart LR
    A[Job file] --> B[Validate]
    B --> C{Dry run?}
    C -->|Yes| D[Report validation result]
    C -->|No| E[Submit to queue and job set]
    E --> F[Receive job IDs and errors]
    F --> G[Watch job-set events]
    G --> H{All jobs inactive?}
    H -->|No| G
    H -->|Yes| I[Report final observed state]

The event stream is the confirmation surface for asynchronous actions. A successful cancellation or preemption request means the request reached the API; the resulting events show whether the jobs completed that state change. References: cmd/…/submit.go• L11-42, internal/…/submit.go• L15-59, pkg/…/submit.go• L34-63, internal/…/watch.go• L16-53, pkg/…/watch.go• L26-123

Queue administration

Queue administration combines resource changes with scheduling state. An operator can create a queue with its ownership and scheduling attributes, inspect it, attach retry policies through the queue definition, and update or remove it when it is no longer needed.

Before a destructive queue action, get queues can select by name or label. The same selection model is used by cordon, uncordon, queue cancellation, and queue preemption. --dry-run is available for the queue-wide write actions that can affect several queues. Queue deletion requires the queue to be empty. Resource reads can be emitted as YAML or JSON and then reused as resource input, which allows an operator to review the desired queue state before applying it. References: cmd/…/queue.go• L98-193, cmd/…/queue.go• L195-276, internal/…/queue.go• L122-153, cmd/…/cordon.go• L37-136, cmd/…/cancel.go• L175-289, cmd/…/preempt.go• L153-243

Incident control

Incident control begins with a narrow target. An operator can stop or reshape work at job, job-set, queue, executor, or node scope. Queue and worker controls accept filters that reduce the target to the affected capacity or workload class.

The normal control sequence is:

  1. Inspect queue state, job-set events, or scheduler reports.
  2. Choose the smallest target that addresses the issue.
  3. Use dry-run selection where the command supports it.
  4. Apply cancellation, preemption, reprioritisation, cordon, or uncordon.
  5. Watch the job set or read a report to confirm the observed result.

Cancellation and preemption are requests to Armada. They do not replace event or state checks. An executor cordon also needs a reason, while node actions need the owning executor so Armada can identify the worker boundary. When a worker-wide action has no queue filter, it covers all queues; add queue, priority-class, or pool filters when the incident has a smaller scope. References: cmd/…/cancel.go• L69-249, cmd/…/preempt.go• L49-210, cmd/…/cordon.go• L139-181, internal/…/cancel.go• L59-138, internal/…/preempt.go• L39-107

armadactl is the control and inspection surface for Armada API state. It works with, rather than replaces, monitoring and cluster-facing tools: metrics help find a problem, armadactl changes Armada state, and other operational tools can show worker-cluster effects.

For the wider view of service metrics, cluster resource signals, pod logs, and load tests, see Monitoring and load tools. For the parent view of how these tools fit into Armada operations, see Operational services and tools.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the command inventory aligned with registration in cmd/…/root.go, including new top-level actions and aliases.
  • Keep resource-file claims aligned with the accepted API version and resource kinds in pkg/…/resource.go.
  • Keep structured-output claims aligned across the output flag registration, document envelope, list field names, and resource-file readers. A change in one can break scripts or read-review-apply workflows.
  • Keep standard-output and standard-error guidance aligned. Logs must stay off machine-readable output streams.
  • Keep configuration guidance aligned with both context resolution and the saved-config commands. A change in either path can alter the environment a command reaches.
  • Keep the client interaction map aligned with the API service used by each client package and with any new authentication choice.
  • Keep workflow guidance aligned with selection guards and dry-run behavior. A change in queue filtering can change the blast radius of cancellation, preemption, and scheduling actions.
  • Keep worker-wide action guidance aligned with the default meaning of omitted queue, priority-class, and pool filters.
  • Keep plugin guidance aligned with release archive names, supported platforms, and the binary name in the Krew manifest.
  • Keep failed-job log guidance aligned with event pod names, the fallback job-scoped pod name, and the placeholders supported by kubectlCommandTemplate.

Important failure modes

TriggerConsequenceGuard
The current context points to the wrong Armada instanceA valid command reads or changes the wrong environmentInspect contexts and use --context for sensitive one-off actions
A selected context is missing from the loaded configurationConnection details cannot be resolved and the command stopsCheck config get-contexts and the file selected by --config
An unsupported --output value is usedThe command fails before it connects to ArmadaUse yaml or json and check the installed command help
Logs are merged into a machine-readable output streamDownstream parsers receive invalid YAML or JSONKeep standard output separate from standard error
A queue update omits an existing settingThe setting is replaced by its command default; retry-policy attachments can be clearedTreat updates as full replacements and provide the complete desired definition
A queue-wide target has no name or label narrowingThe command refuses to run rather than risk selecting every queueSelect by names or labels and use dry-run where available
A worker-wide cancellation or preemption omits its queue filterMatching work across all queues on the executor or node is targetedAdd queue, priority-class, and pool filters when the incident is scoped
Queue cancellation omits active job statesThe command refuses to run before it can request cancellationSelect one or more supported active states
Cancellation or preemption is accepted but not yet completeThe operator may assume work stopped before Armada emits the final stateWatch the job set or inspect a later report
A job-set event stream contains an event type the client does not knowThat event is skipped and the displayed state may be incompleteUse a compatible CLI version and compare with API or report output
A failed-job event has no pod name and the fallback name does not match the runThe printed kubectl logs hint targets the wrong pod or cannot retrieve logsUse a compatible CLI version and verify the pod name in the event or cluster
The endpoint requires authentication that the selected context does not provideThe API rejects calls even though the endpoint is reachableConfigure the identity method required by the Armada deployment
The Krew plugin archive or direct binary does not match the hostInstallation or execution fails before a command reaches ArmadaUse a release artifact for the host platform and verify the installed version

Key files

FileWhy to read it
cmd/…/root.goDefines the complete top-level command surface
cmd/…/commands.goGroups resource create, delete, update, and get commands
cmd/…/output.goAdds the shared structured-output flag to resource reads
internal/…/output.goDefines output formats and the resource document shape
cmd/…/params.goConnects command configuration to queue, retry-policy, executor, and node clients
internal/…/app.goShows the boundary between command parameters and operator actions
pkg/…/command_line.goDefines config-file loading, context selection, and connection-detail extraction
pkg/…/connection.goDefines shared transport and authentication behavior
pkg/…/with_connection.goMaps operations to Armada API service clients
cmd/…/submit.go and internal/…/submit.goExplain the job-file submission path and dry-run boundary
cmd/…/watch.go and internal/…/watch.goExplain live job-set observation, completion exit behavior, and failed-job log hints
pkg/…/kubectl.goDefines the Kubernetes log-command hint and its customizable command template
cmd/…/cancel.go and cmd/…/preempt.goDefine workload-control scopes, default filters, and safety guards
cmd/…/queue.go and internal/…/queue.goDefine queue resource changes, selection, and reusable resource output
cmd/…/retrypolicy.go and internal/…/retrypolicy.goDefine retry-policy file workflows and strict resource validation
cmd/…/cordon.goDefines queue and executor scheduling pause and resume actions
cmd/…/scheduling.go and internal/…/scheduling.goDefine scheduler, queue, and job report workflows
plugins/armadactl.ymlDefines the Krew plugin identity and release artifacts
scripts/get-armadactl.shShows the direct binary installation path