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.
| Operation | Scope | Purpose |
|---|---|---|
submit | Jobs in a file | Validate and submit jobs to a queue and job set |
cancel job | One job | Request cancellation by queue, job set, and job ID |
cancel job-set | One job set | Request cancellation for the set |
cancel queues | Selected queues | Cancel matching active jobs by state, priority class, pool, or queue selector |
reprioritize job | One job | Change the job priority |
reprioritize job-set | One job set | Change the priority of jobs in the set |
preempt job | One job | Request 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 executororcancel nodestops matching active work at a worker scope.preempt executororpreempt noderequests 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 executorremoves 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:
- Inspect queue state, job-set events, or scheduler reports.
- Choose the smallest target that addresses the issue.
- Use dry-run selection where the command supports it.
- Apply cancellation, preemption, reprioritisation, cordon, or uncordon.
- 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
Related operational tools
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
| Trigger | Consequence | Guard |
|---|---|---|
| The current context points to the wrong Armada instance | A valid command reads or changes the wrong environment | Inspect contexts and use --context for sensitive one-off actions |
| A selected context is missing from the loaded configuration | Connection details cannot be resolved and the command stops | Check config get-contexts and the file selected by --config |
An unsupported --output value is used | The command fails before it connects to Armada | Use yaml or json and check the installed command help |
| Logs are merged into a machine-readable output stream | Downstream parsers receive invalid YAML or JSON | Keep standard output separate from standard error |
| A queue update omits an existing setting | The setting is replaced by its command default; retry-policy attachments can be cleared | Treat updates as full replacements and provide the complete desired definition |
| A queue-wide target has no name or label narrowing | The command refuses to run rather than risk selecting every queue | Select by names or labels and use dry-run where available |
| A worker-wide cancellation or preemption omits its queue filter | Matching work across all queues on the executor or node is targeted | Add queue, priority-class, and pool filters when the incident is scoped |
| Queue cancellation omits active job states | The command refuses to run before it can request cancellation | Select one or more supported active states |
| Cancellation or preemption is accepted but not yet complete | The operator may assume work stopped before Armada emits the final state | Watch the job set or inspect a later report |
| A job-set event stream contains an event type the client does not know | That event is skipped and the displayed state may be incomplete | Use 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 run | The printed kubectl logs hint targets the wrong pod or cannot retrieve logs | Use a compatible CLI version and verify the pod name in the event or cluster |
| The endpoint requires authentication that the selected context does not provide | The API rejects calls even though the endpoint is reachable | Configure the identity method required by the Armada deployment |
| The Krew plugin archive or direct binary does not match the host | Installation or execution fails before a command reaches Armada | Use a release artifact for the host platform and verify the installed version |
Key files
| File | Why to read it |
|---|---|
| cmd/…/root.go | Defines the complete top-level command surface |
| cmd/…/commands.go | Groups resource create, delete, update, and get commands |
| cmd/…/output.go | Adds the shared structured-output flag to resource reads |
| internal/…/output.go | Defines output formats and the resource document shape |
| cmd/…/params.go | Connects command configuration to queue, retry-policy, executor, and node clients |
| internal/…/app.go | Shows the boundary between command parameters and operator actions |
| pkg/…/command_line.go | Defines config-file loading, context selection, and connection-detail extraction |
| pkg/…/connection.go | Defines shared transport and authentication behavior |
| pkg/…/with_connection.go | Maps operations to Armada API service clients |
| cmd/…/submit.go and internal/…/submit.go | Explain the job-file submission path and dry-run boundary |
| cmd/…/watch.go and internal/…/watch.go | Explain live job-set observation, completion exit behavior, and failed-job log hints |
| pkg/…/kubectl.go | Defines the Kubernetes log-command hint and its customizable command template |
| cmd/…/cancel.go and cmd/…/preempt.go | Define workload-control scopes, default filters, and safety guards |
| cmd/…/queue.go and internal/…/queue.go | Define queue resource changes, selection, and reusable resource output |
| cmd/…/retrypolicy.go and internal/…/retrypolicy.go | Define retry-policy file workflows and strict resource validation |
| cmd/…/cordon.go | Defines queue and executor scheduling pause and resume actions |
| cmd/…/scheduling.go and internal/…/scheduling.go | Define scheduler, queue, and job report workflows |
| plugins/armadactl.yml | Defines the Krew plugin identity and release artifacts |
| scripts/get-armadactl.sh | Shows the direct binary installation path |