This is unreleased documentation for SUSE® Rancher Manager v2.16 (Unreleased).

SUSE Rancher Prime CLI

SUSE Rancher Prime CLI is an experimental feature released separately from Rancher. Please be aware that commands, flags and output can change between releases. It is available for Rancher v2.14 and later. For information on the legacy SUSE Rancher Prime CLI, refer to the documentation and legacy CLI migration section.

The SUSE Rancher Prime CLI provides a structured, self-describing command-line interface for managing SUSE Rancher Prime resources and powering interactive terminal coding agent sessions.

Built supporting AI-native workflows, it features structured JSON/YAML output for easy programmatic parsing and explicit plan/apply safety controls to preview and confirm infrastructure changes before execution. This page serves as a reference overview for the SUSE Rancher Prime CLI including installation instructions, command reference, and usage examples. Refer to the CLI Releases and Developer documentation for contribution guidelines, architecture and further design details.

Installation

Installation scripts are available to download binaries, verify cryptographic checksums, validate build provenance, and set up the Rancher CLI and its credential helper (rancher-credential-vault) into a rootless directory without requiring administrator privileges.

Run the installation script directly from your terminal:

Install Paths
  • Linux and macOS: Installs binaries to ~/.local/share/rancher-cli/versions/<tag> and manages symlinks in ~/.local/bin (or custom directory).

  • Windows: Installs binaries to %LOCALAPPDATA%\rancher-cli\versions\<tag> and manages an NTFS junction (directory link) at %LOCALAPPDATA%\rancher-cli\bin (or the directory specified by -BinDir) pointing to the active version. The installer never modifies your PATH automatically, but it prints the PATH line to add.

Ensure your target destination binary path is included in your system’s PATH.

  • Linux / macOS

  • Windows

curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/rancher/rancher-cli/main/install.sh | sh
irm https://raw.githubusercontent.com/rancher/rancher-cli/main/install.ps1 | iex

Installation Security

The installation scripts enforce multiple layers of verification and safety controls to ensure operational integrity:

  • Cryptographic Integrity: Downloaded binaries are always verified against official SHA256SUMS hashes before execution.

  • Build Provenance & Attestations: When an authenticated GitHub CLI (gh) is detected on your system, the installer verifies signed GitHub Build Attestations against the official repository workflow (rancher/rancher-cli/.github/workflows/release.yaml). Note the minimum version of gh needed is v2.68.0. You can enforce build verification as mandatory by passing --verify-attestation (or -VerifyAttestation on Windows).

  • Atomic Version Swapping: Binaries for rancher and rancher-credential-vault are unpacked into versioned subdirectories. The active version is switched atomically using symlinks (Linux/macOS) or NTFS junctions (Windows). Upgrades, rollbacks, and installs ensure both binaries update simultaneously and in turn prevent version mismatch states.

  • Truncation Protection: The installation script logic is encapsulated inside a wrapper function invoked on the script’s final line. If a network interruption truncates the download mid-stream, the script will raise a syntax error or fail to execute entirely rather than running partial commands.

  • Audit Receipt: Successful installations write an audit receipt to install-receipt.json (located at ~/.config/rancher-cli/ on Linux/macOS or %APPDATA%\rancher-cli\ on Windows), tracking installed assets and metadata.

Installation Options

Below are the options for customizing the Rancher CLI installation. You can pass flags into the installer pipe (…​ | sh -s — <flags>) or as PowerShell parameters (iex "& { $(…​) } <parameters>"). No GitHub token is needed. When a GH_TOKEN or GITHUB_TOKEN is set, or gh is logged in, the installer uses that token, which raises the GitHub API rate limit for --pre lookups.

Installation Options
Flag (POSIX) Parameter (PowerShell) Description

--version <tag>

-Version <tag>

Installs a specific version. (Env twin: RANCHER_CLI_VERSION)

--pre

-Pre

Selects the newest prerelease. Linux and macOS: --pre has a prerequisite of jq or python3 on PATH.

--bin-dir <dir>

-BinDir <dir>

Overrides the install directory. (Env twin: RANCHER_CLI_INSTALL_BIN_DIR)

--verify-attestation

-VerifyAttestation

Makes build provenance verification mandatory.

--dry-run

-DryRun

Prints the installation plan without modifying disk.

-q

-Quiet

Suppresses progress notes.

Manual Installation and Verification

Follow the steps outlined below for manual installation and verification of the SUSE Rancher Prime CLI depending on your operating system.

Linux and macOS

  1. Download the latest release for your operating system and architecture: rancher-<os>-<arch>, rancher-credential-vault-<os>-<arch> (both with .exe on Windows) and SHA256SUMS.

  2. Check each binary against its line in SHA256SUMS. On Linux:

    grep '  rancher-linux-amd64$' SHA256SUMS | sha256sum -c -
    grep '  rancher-credential-vault-linux-amd64$' SHA256SUMS | sha256sum -c -

    On macOS use shasum -a 256 -c - in place of sha256sum -c -. Each command prints <name>: OK.

  3. Optional: verify the build provenance with the GitHub CLI (2.68.0 or newer; it needs gh auth login), for each of the two binaries:

    gh attestation verify rancher-linux-amd64 --repo rancher/rancher-cli \
      --cert-identity https://github.com/rancher/rancher-cli/.github/workflows/release.yaml@refs/tags/<tag> \
      --source-ref refs/tags/<tag>

    Use the tag you downloaded if you are verifying a different release (for example v0.1.0-beta.1).

    The attestations cover the binaries, their software bill of materials (SBOM) files, rancher-schema.json, install.sh and install.ps1. SHA256SUMS has no attestation and does not list the SBOMs or the Sigstore bundles. It protects only against a damaged download.

    Each binary also has an SPDX 2.3 SBOM, <binary>.spdx.json (for example rancher-linux-amd64.spdx.json), which Syft writes from the Go modules built into the binary. Its digest is in the build provenance and in its own attestation. To verify that the release workflow (release.yaml) attested an SBOM for a binary:

    gh attestation verify rancher-linux-amd64 --repo rancher/rancher-cli \
      --cert-identity https://github.com/rancher/rancher-cli/.github/workflows/release.yaml@refs/tags/<tag> \
      --source-ref refs/tags/<tag> \
      --predicate-type https://spdx.dev/Document/v2.3

    To verify without a GitHub login, also download the Sigstore bundle files. Each holds one attestation and its signature: provenance.sigstore.json for the build provenance and <binary>.sbom.sigstore.json for the SBOM of each binary. With cosign (flags as of cosign v3.1.4):

    cosign verify-blob-attestation \
      --bundle rancher-linux-amd64.sbom.sigstore.json \
      --type https://spdx.dev/Document/v2.3 \
      --certificate-identity https://github.com/rancher/rancher-cli/.github/workflows/release.yaml@refs/tags/<tag> \
      --certificate-oidc-issuer https://token.actions.githubusercontent.com \
      rancher-linux-amd64

    For the build provenance use --bundle provenance.sigstore.json and --type https://slsa.dev/provenance/v1. That bundle names every file the provenance covers; the last argument can be any of them. Give the whole URL as the type. The short names spdx and spdxjson stand for a type without a version, and the type of these SBOM attestations has one (v2.3).

  4. Rename the two downloads to rancher and rancher-credential-vault, make both binaries executable (chmod +x on Linux and macOS) and put them in one directory on PATH. Both names matter: the CLI runs a credential helper as rancher-credential-<name>, and kubectl runs a kubeconfig’s exec plugin as rancher.

Windows

  1. Download the windows assets from the latest release: the CLI binary and rancher-credential-vault.

  2. Rename them to rancher.exe and rancher-credential-vault.exe. Both names matter and need to be changed: kubectl runs the kubeconfig’s exec plugin as the command rancher unless rancher kubeconfig --exec-command sets another, and the CLI runs a credential helper as rancher-credential-<name>. On Windows, a program started by name is found only on PATH and only with an extension listed in PATHEXT (.exe).

  3. Verify both binaries against SHA256SUMS (PowerShell). rancher-credential-vault.exe matters as much as rancher.exe, it is the process that stores your Rancher credentials and holds your Vault token, never install them unverified:

    Get-FileHash rancher.exe -Algorithm SHA256
    Get-FileHash rancher-credential-vault.exe -Algorithm SHA256

    Compare each output against its matching line in SHA256SUMS.

  4. Optionally verify build provenance for both:

    gh attestation verify rancher.exe --repo rancher/rancher-cli --cert-identity https://github.com/rancher/rancher-cli/.github/workflows/release.yaml@refs/tags/<tag> --source-ref refs/tags/<tag>

    Run the above with the tag you downloaded (for example v0.1.0-beta.1), then run the same command using rancher-credential-vault.exe instead of rancher.exe to verify. The SBOMs, Sigstore bundles, and the commands that verify them are the same as in Linux and macOS however replace rancher with rancher.exe and rancher-credential-vault with rancher-credential-vault.exe.

  5. Only after both binaries verify should you place them in a directory on PATH.

Notepad on Windows 11

On Windows 11, the Store version of Notepad opens `config edit’s temp file as a new tab in an already-running Notepad window rather than a new window; close the tab, not the window, to return control to the CLI.

Managing the Installation

Options for managing the Rancher CLI installation:

  • Updating the Version: Re-run the installation command. The installer resolves to the latest release and performs an atomic binary swap.

  • Rollback the Version: Re-run the installation script specifying the targeted version: --version <tag> (or -Version <tag>).

  • Uninstall (Linux or macOS): Remove the rancher and rancher-credential-vault symlinks from your bin directory, then remove ~/.local/share/rancher-cli and ~/.config/rancher-cli/install-receipt.json.

  • Uninstall (Windows): Remove %LOCALAPPDATA%\rancher-cli, %APPDATA%\rancher-cli\install-receipt.json, and remove the binary directory from your PATH.

Platforms and Credential Stores

The SUSE Rancher Prime CLI is distributed as a static binary running across macOS, Linux (including musl/distroless distros), and Windows.

Platform Config Directory (Default) Primary Credential Store (Default) File Fallback

macOS

~/.config/rancher

Keychain

0600 file

Linux

~/.config/rancher

Secret Service (D-Bus; fallback when headless)

0600 file

Windows

%APPDATA%\rancher

Credential Manager

Owner-only-ACL file

Config directory resolution follows this precedence: --config flag (-c) > RANCHER_CLI_CONFIG_DIR > $XDG_CONFIG_HOME/rancher (or default).

Store Declaration and Isolation

The credential backend belongs to the configuration directory, not the process:

  • Directory Declaration: The first login records the chosen store in config.yaml (credentialStore: keychain|file|auto|exec:<name>). From that point, all processes operating on that directory use that declared store.

  • Environment Override Rule: RANCHER_CLI_CREDENTIAL_STORE sets the store for an un-declared directory (e.g., CI runs). If set on a directory that already declared a different store, the CLI exits with a VALIDATION error to prevent cross-backend token leakage.

  • Auto-Probing: On fresh directories defaulting to auto, the first login probes the OS keychain and pins the backend. In headless environments or CI where native keychains are unavailable, it automatically pins to the file store. On headless/CI setups, set RANCHER_CLI_CREDENTIAL_STORE=file explicitly prior to initial login.

Changing Credential Stores

To migrate an existing directory to a different backend:

rancher auth login <name> --credential-store keychain|file|auto|exec:<name>
  • A store migration succeeds only after the target entry’s credential is safely written to the new backend.

  • Migration is refused if other server entries still hold credentials in the old backend. Log out those entries first (rancher auth logout <entry>) before changing stores.

  • Migration into a custom exec:<name> credential helper requires that the directory holds no other server entries.

Credential Helpers

The Rancher CLI can delegate token storage to external program credential helpers so tokens reside in enterprise secret infrastructure (e.g., HashiCorp Vault, OpenBao, 1Password, or pass).

Configuration

To configure a helper, set the credentialStore in config.yaml:

credentialStore: exec:vault

Or pass RANCHER_CLI_CREDENTIAL_STORE=exec:vault on an undeclared config directory. The name following exec: must match ^[a-z0-9][a-z0-9-]*$. The CLI invokes the binary named rancher-credential-<name> found on your system PATH.

There is no fallback. If the helper binary is missing or fails, execution halts with the helper’s error message. Set RANCHER_CLI_TOKEN in CI/automation environments to bypass credential store lookup.

HashiCorp Vault and OpenBao Helper

The CLI ships with rancher-credential-vault, an official helper for HashiCorp Vault and OpenBao.

Environment configuration parameters:

Environment Variable Default Purpose

VAULT_ADDR

(Required)

Vault or OpenBao API address URL.

VAULT_TOKEN

~/.vault-token

Vault authentication token.

RANCHER_VAULT_MOUNT

secret

KV v2 secrets engine mount path.

RANCHER_VAULT_PATH

cli.rancher.io

Path prefix under the mount where credentials are stored.

Credentials are stored as KV v2 secrets at <mount>/data/<path>/sha256hex(serverURL + "\n" + name) where the following required vault policy paths must be set:

The policy paths change with RANCHER_VAULT_MOUNT and RANCHER_VAULT_PATH when either is set.

path "secret/data/cli.rancher.io/*"     { capabilities = ["create", "update", "read"] }
path "secret/metadata/cli.rancher.io/*" { capabilities = ["delete"] }

Protocol Specification (Version 1)

Custom helpers implement a JSON protocol over standard input/output. The CLI invokes rancher-credential-<name> <verb> with verbs get, store, or erase.

  • Invocation: One JSON request body on stdin; expects one JSON response on stdout.

  • Errors: Exit non-zero on failure with a clear error message on stderr.

  • Timeout: The CLI enforces a 30-second timeout per call.

Table 1. Protocol JSON Schemas
Verb Request Fields Response Format / Behavior

get

protocolVersion: 1, serverURL, name

{"protocolVersion":1,"token":"…​","expiresAt":"…​"} If no token exists, return exit status 0 with {"protocolVersion":1}. An optional RFC 3339 expiresAt field indicates short-lived credentials; the CLI caches them in memory only.

store

protocolVersion: 1, serverURL, name, token

Exit 0 with empty JSON or {"protocolVersion":1}. Read-only helpers return {"protocolVersion":1,"unsupported":true}.

erase

protocolVersion: 1, serverURL, name

Exit 0. Idempotent deletion. Optional {"protocolVersion":1,"erased":true|false} allows the CLI to track exact deletion status.

Command Output and Execution Controls

All command outputs use enveloped JSON, YAML, or tabular formatting (-o table|json|yaml, plus -o name to output resource IDs only). Tabular formatting is the default for interactive shell sessions.

Mutating commands require explicit flags to write changes, there are no implicit writes:

  • Pass --apply to execute state-changing or mutating operations.

  • Pass --yes (alongside --apply) to execute destructive operations.

To inspect the full command surface, including available flags, API contracts, and stability levels without checking external documentation, execute the following command:

rancher schema

Safety Model

Every command that changes the server runs these steps, in order:

--dry-run runs the server-side dry-run and needs the same RBAC verb as the write; read-only credentials get an RBAC error. That means the write would be denied, not that --dry-run is broken.

  1. --dry-run previews the change (the action, the fields the command sets or changes, and warnings) and changes nothing. The preview succeeds only if the server-side dry-run succeeds.

  2. --apply executes. A command that changes the server, run with neither --dry-run nor --apply, is refused with CONFIRMATION_REQUIRED, and the refusal names the exact flags required.

  3. --yes is required together with --apply (never alone) when the change is destructive: every delete and revoke, writes to sensitive kinds, and creating secrets that are shown only once (create token, create kubeconfig).

  4. --allow-deprecated is required for a write whose stability is deprecated.

  5. Updates and deletes carry a resourceVersion precondition taken from their own dry-run preview: if the resource changes between that preview and the apply, the change fails (exit 5) instead of overwriting it. A --dry-run run on its own is a preview only; the later --apply run takes a new dry-run preview and sets its precondition from the resource as it is at that time. Creating an object has no precondition (there is no existing object to check).

    A delete also waits until the object is gone, for up to 5 minutes by default (--timeout). --wait=false returns once the server accepts the request and prints deletion started.

Most commands carry a contract (public | internal) and a stability (stable/beta/deprecated), shown in the schema manifest. For more detail on all the steps and gates in full refer to the architecture and read-only mode documentation.

Output

Nearly every command prints one JSON document per run under -o json, versioned by apiVersion, that agents can depend on (note the exceptions):

{
  "apiVersion": "cli.rancher.io/v1",
  "kind": "LoginResult",
  "data": { "server": "prod", "url": "https://rancher.example.com" },
  "warnings": []
}

Format options:

  • -o table (default)

  • -o wide

  • -o json

  • -o yaml

  • -o name

  • -o template=<go-template>

For more information refer to the full format semantics.

Exit Codes

  • Errors have the same shape as a success: under -o json/-o yaml they are the same document, with the error object under data, and any warnings go in the document’s own warnings array. Use -o json to get the document, errors included:

    { "apiVersion": "cli.rancher.io/v1", "kind": "Error",
      "data": { "error": { "code": "NOT_LOGGED_IN", "message": "...",
                "hint": "rancher auth login 'prod'", "retryable": false } } }

    Every other format, including the default, prints a short text message on stderr instead:

    error (NOT_LOGGED_IN): ...
      hint: rancher auth login 'prod'
  • Exit codes (act on the code without parsing output):

    • 0 ok

    • 2 usage/validation

    • 3 auth

    • 4 not-found

    • 5 conflict/precondition

    • 6 RBAC

    • 8 lock-timeout

    • 9 Prime required

    • 10 TLS trust

    • 11 capability unsupported

    • 14 credential store unavailable

    • 130 interrupted

    • 1 generic; reference for every code with its meaning.

      Ctrl-C or a termination signal ends the command with INTERRUPTED, exit 130 for either; a second signal forces a command that did not stop on the first to exit with 128 plus that signal’s own number (130 Ctrl-C, 143 SIGTERM).

  • Discovery: rancher schema -o json is the overview - commands, kinds, and exit codes as a compact table of contents; rancher schema --all -o json is the complete manifest, and the single source for contract and stability. rancher schema <command|kind|group> shows only that command, kind or group.

rancher kubeconfig

rancher kubeconfig --cluster <id-or-name> emits a bare kubeconfig YAML document to stdout. Its user entry runs rancher auth get-token as a kubectl exec-credential plugin, so no long-lived token is ever written to disk, only the CLI’s own short-lived cache. It replaces the legacy kubectl passthrough’s purpose; the Rancher CLI itself does not wrap kubectl.

PATH note

The exec stanza runs rancher by name, so the rancher binary must be on PATH for kubectl to authenticate.

Example command merging into your default kubeconfig (the command only writes to stdout, it never touches ~/.kube/config):

KUBECONFIG=~/.kube/config:<(rancher kubeconfig --cluster X) kubectl config view --flatten > merged && mv merged ~/.kube/config

If a rancher binary does not exist on the target machine, then the rancher kubeconfig exec mode is not the only option. The command rancher create kubeconfig [--clusters …​] --apply --yes creates a server-side, embedded, revocable kubeconfig that is the same as the Dashboard’s Download KubeConfig option, which does not need a local rancher binary to authenticate. The output goes to stdout, with a shown-once notice on where its server-assigned name is.

--wait on named get

rancher get <kind> <name> --wait [--for state=<value>|condition=<Type>[=<Status>]] [--timeout <duration>] replaces the legacy standalone wait command. Unlike kubectl wait, it fails fast on a Rancher-reported provisioning error instead of going through the full timeout.

For anything --wait doesn’t cover well (arbitrary JSONPath conditions, non-Rancher resources), use kubectl wait via rancher kubeconfig. --for state=<value> matches status.state (the Rancher idiom); for kinds that carry no status.state (core kinds like Pod), it falls back to status.phase instead, compared case-insensitively.

Shell Completion

The Rancher CLI generates shell completion scripts for bash, zsh, fish, and PowerShell (pwsh).

Setup and Configuration

Load completions for your preferred shell:

  • Bash

  • Zsh

  • Fish

  • PowerShell

# Load into the current session:
source <(rancher completion bash)

# Persist to shell profile:
echo 'source <(rancher completion bash)' >> ~/.bashrc
# Load into the current session:
source <(rancher completion zsh)

# Persist to shell profile:
echo 'source <(rancher completion zsh)' >> ~/.zshrc
# Persist directly to fish completions directory:
rancher completion fish > ~/.config/fish/completions/rancher.fish
# Load into the current session:
rancher completion pwsh | Out-String | Invoke-Expression

# Persist to PowerShell profile (requires an ExecutionPolicy allowing local scripts, e.g., RemoteSigned):
Add-Content -Path $PROFILE -Value 'rancher completion pwsh | Out-String | Invoke-Expression'

Static vs. Live Completion Modes

The CLI supports two completion modes:

  • Static Completion (Default): Offline-only mode. It completes all command, group, and flag names, resource kind aliases (po → po, pod, pods), and configured server entries from your local config file. It never issues network requests, never prompts, and degrades silently without throwing errors if the configuration file is missing or invalid.

  • Live Completion (Opt-In): Queries the Rancher API dynamically to complete live resource targets such as cluster names, project names, namespaces, pods, deployments, nodes, users, and role templates.

To enable live resource-name completion:

rancher config set-completion --network=true

To configure the per <TAB> HTTP network budget limit (defaults to 500ms):

rancher config set-completion --timeout=1s
Shell Compatibility and Tooltip Descriptions
  • Minimum Requirements: Bash 3.2 (with bash-completion), Zsh 5.0 (with compinit), Fish 3.0, or Windows PowerShell 5.1 / PowerShell 7.

  • Resource Descriptions: Zsh, Fish, and PowerShell display resource descriptions (such as user full names or display names) beside candidate IDs during completion. Bash 4+ lists descriptions on the second <TAB> press, while Bash 3 lists values only.

Troubleshooting

When live completion encounters a failure such as an expired session token or network timeout, it degrades silently to offer no candidates rather than interrupting shell output with error messages.

To trace and debug completion behavior, set RANCHER_CLI_COMPLETION_DEBUG=1 and invoke the internal completion entry point directly:

  • Linux / macOS

  • Windows (PowerShell)

RANCHER_CLI_COMPLETION_DEBUG=1 rancher --rancher-completion-proto=2 get cluster --rancher-completion-cur= --generate-shell-completion
$env:RANCHER_CLI_COMPLETION_DEBUG = "1"
rancher --rancher-completion-proto=2 get cluster --rancher-completion-cur= --generate-shell-completion

CLI Quickstart

Once installed an example workflow is authenticating your session, verifying connectivity, and inspecting available resources:

  1. Log in to Rancher Manager using a Rancher API key (formatted as <access-key>:<secret-key>):

    # Interactive prompt for API key input:
    rancher auth login prod --url https://rancher.example.com
    
    # Non-interactive / pipeline pass:
    echo "<access-key>:<secret-key>" | rancher auth login prod --url https://rancher.example.com --token-stdin
  2. Verify credentials and connection status:

    rancher auth status
  3. Inspect available clusters:

    rancher get clusters
  4. Preview and apply state changes:

    # Compute a server-side preview of the change:
    rancher create project web --cluster c-m-abc123 --dry-run
    
    # Execute the mutation:
    rancher create project web --cluster c-m-abc123 --apply
  5. Discover available commands and inspect the schema for a specific command:

    rancher schema                        # Display top-level command TOC
    rancher schema delete project          # Show contract and flags for a specific command
    rancher schema pod                     # Inspect supported verbs and routing for a resource kind
    rancher schema --search kubeconfig    # Find relevant commands by substring
    rancher schema --all -o json          # Output complete programmatic manifest (for agents)

Agent Skill Integration

The Rancher CLI includes a built-in skill specification based on the open Agent Skills standard. This teaches AI coding agents (such as Claude Code, Codex, or GitHub Copilot CLI) how to navigate authentication, command discovery, the dry-run/apply safety loop, structured error handling, and resource wait conditions automatically.

To install the agent skill into your local AI environment:

rancher skill install

Alternatively, point your coding agent’s custom instructions or prompt files directly to the bundled skills/rancher/SKILL.md file within the repository.

Commands

The following commands are available in SUSE Rancher Prime CLI as of release v0.1.0-beta.2. For the live catalog, which also lists the generated get <kind>, patch <kind> and delete <kind> commands, run rancher schema; rancher schema <command> shows one command in detail. Refer to the CLI reference for further architectural details.

Authentication

Command Purpose

auth login [<name>] [--url <url>]

Log in with a token (interactive prompt or --token-stdin, secrets never on the command line); --url adds the entry first when <name> is new, and refuses when <name> is already registered at a different URL. Omitting <name> with --url derives it from the URL’s hostname, with the same refuse-on-collision rule. Verifies a pasted/piped token against the server before storing it, with one SelfSubjectReview that also names the token’s owner, which the login records (--no-verify skips this and records no owner; not available with the provider sign-in flow, which is already authenticated). Never switches the current server - only a fresh add can bootstrap it when unset. --credential-store changes where the directory keeps its credentials, after the new credential is stored: a change takes only this entry’s credential, and refuses before the sign-in while another entry still has one in the store being left.

auth logout [<name>]

Clear the stored login token for the current server, <name>, or every server with --all; keeps server config; deletes the exec-credential cache entries its login made, then revokes on the server the tokens the CLI created and recorded (reporting them as revoked or notRevoked if cleanup fails); records the logout on the entry.

auth status

Connectivity and credential preflight (calls the cluster’s Kubernetes API); an unfinished credential store change and what it has left.

auth get-token

exec-credential plugin (invoked by kubeconfigs, not by hand); with --user-id it hands kubectl only tokens Rancher reports as that user’s.

auth list-tokens

List cached exec-credential entries (name, server, cluster, token, expiry); the TOKEN column names the token the entry holds.

auth delete-token [<name>]

Clear cached exec-credential token(s), then revoke on the server the cluster tokens the CLI created and recorded; idempotent (no match = success).

Servers and Configuration

The server pointer is the config’s only session state, cluster and project scope are explicit flags per invocation. use-server is the migrating target for the legacy server switch command.

Command Purpose

config list-servers

List configured servers.

config use-server [name]

Switch the current server.

config add-server <name> --url <url>

Add a server entry (establishes trust); bootstraps the current server if unset - never an upsert (a different URL/CA under an existing name is a conflict); a credential still stored under a name no entry had is removed first, with a warning.

config update-server <name>

Change a server’s URL or CA without the credential purge delete-server forces. A URL change clears the stored token and exec-credential cache without contacting the old address; any tokens left on the old server are reported under notRevoked (with reason otherServer on the moved entry, meaning they are never retired by its future logins, or manual if another entry still points to the old server and will retire them on its next login). A CA-only change keeps existing credentials.

config delete-server <name>

Remove a server and its stored credentials, after revoking on the server the tokens the CLI created and recorded. Reports each token as revoked or notRevoked, including recovery instructions for any token left on the removed entry.

config path

Print the resolved config file path (whether or not the file exists yet).

config status

Print config diagnostics: file path, current server, effective credential store and its source, completion settings; token reuse and every entry whose CLI-created tokens are still live, with the commands that revoke them; every entry whose exec-credential cache writes are paused while a change of its credential finishes, with the reason; an unfinished credential store change and what it has left; first stop when tab completion shows no candidates.

config edit

Edit the config in $VISUAL/$EDITOR on a validated temp copy - never in place; a change to credentialStore is refused (a login with --credential-store changes it).

config set-completion

Persist live-completion preferences: enable/disable network completion and set the per-TAB HTTP budget (max 2s).

config set-token-reuse

Control whether the kubectl exec plugin (auth get-token) reuses a single login credential per server instead of creating separate per-cluster tokens. When enabled (on), the first cache miss triggers one login and saves an unscoped server entry named exec-login-<host> (where <host> is the Rancher server hostname) for subsequent cluster requests. When disabled (off, default), the plugin reverts to per-cluster logins and lists any leftover exec-login-<host> entries (dormant plugin-created logins that are no longer used) along with the commands to remove them.

Create

Command Purpose

create project [id]

Create a project with an id you give, or with an id Rancher generates when you pass --display-name and no id; optionally with a resource quota and default container resource limits; Rancher gives the creator the project’s creator default roles - dry-run/apply.

create namespace <name>

Create a namespace, optionally inside a project from birth - dry-run/apply.

create secret <name>

Create a secret: bare namespaced, or project-scoped into the project’s backing namespace - dry-run/apply.

create resource -f <file|→

Create/apply a resource from a YAML manifest (file or stdin); dry-run/apply.

create token

Create a server-side derived token (backed by the Rancher ext.cattle.io Token resource), shown once - sensitive; dry-run/apply --yes.

create kubeconfig

Create a server-side, embedded, revocable kubeconfig (backed by the Rancher ext.cattle.io Kubeconfig resource) to stdout, shown once - sensitive; dry-run/apply --yes.

create oidc-client <name>

(Rancher Prime Feature): Create an OIDC client for Rancher’s embedded OIDC provider; waits for provisioning, prints the initial client secret once with live discovery endpoints - sensitive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

create user <username> --password-stdin [--global-role <id>]

Create a local user (Rancher management.cattle.io/v3 User resource), store its password secret in the cattle-local-user-passwords namespace, and create a GlobalRoleBinding for each role marked as a default for new users (newUserDefault: true) or specified via --global-role. The password is never passed on the command line and cannot contain newlines - sensitive; dry-run/apply --yes. Requires a server that supports local user passwords.

create password-change-request <user> --password-stdin [--current-password-stdin]

Change a local user’s password via a synchronous ext.cattle.io PasswordChangeRequest resource. The password is never passed on the command line and cannot contain newlines - sensitive. With --current-password-stdin, stdin holds two lines: line 1 is the current password (currentPassword) and line 2 is the new password (required when changing your own password without admin privileges to change any user’s password). Exits 2 if the current password is rejected, or 6 if you lack permission to change another user’s password; dry-run/apply --yes. Requires a server that supports local user passwords.

create cluster <name>

Create a provisioning cluster: imported, custom, or node-driver with one machine pool; the settings the Rancher UI form fills in are left unset unless a full manifest sets them - dry-run/apply.

create machine-config <kind> <name>

Create a standalone machine config for create cluster --machine-config - dry-run/apply.

Projects and Access

Command Purpose

project add-namespace <ns>

Add a namespace to a project - dry-run/apply.

project remove-namespace <ns>

Remove a namespace from its project and remove its project label - dry-run/apply.

grant <subject>

Grant a role at project, cluster, or global scope - dry-run/apply --yes.

revoke <subject>

Revoke role binding(s) at a scope; omitting --role revokes every role there - destructive; dry-run/apply --yes.

OIDC Client

See also create oidc-client in Create, which creates the client itself.

Command Purpose

oidc-client add-secret <client>

(Rancher Prime Feature): Add a new client secret; waits for the controller, shown once - sensitive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

oidc-client rotate-secret <client> [secret-name]

(Rancher Prime Feature): Regenerate a client secret (name required with more than one secret); shown once - sensitive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

oidc-client remove-secret <client> <secret-name>

(Rancher Prime Feature): Remove a client secret - destructive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

Cluster Scaling and Autoscaling

See also create cluster in Create and delete provisioning-cluster for lifecycle; get provisioning-cluster for reads.

Refer to the Prime documentation for details on cluster autoscaling and machine pool management.

Command Purpose

cluster scale <cluster> --pool <name> --nodes <n>

Change the number of nodes in a machine pool; refuses when the machine pool has autoscaling turned on and autoscaling is not paused, or when the cluster has no machine pools - destructive; dry-run/apply --yes.

cluster set-autoscaling <cluster> --pool <name> --min <n> --max <m>

(Rancher Prime Feature): Turn on autoscaling for a machine pool - destructive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

cluster clear-autoscaling <cluster> --pool <name>

(Rancher Prime feature): Turn off autoscaling for a machine pool; succeeds and changes nothing when the machine pool has no autoscaling - destructive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

cluster pause-autoscaling <cluster>

(Rancher Prime feature): Pause the cluster autoscaler cluster-wide - destructive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

cluster resume-autoscaling <cluster>

(Rancher Prime feature): Resume the cluster autoscaler cluster-wide - destructive; dry-run/apply --yes. A Rancher Prime feature; the connected server decides whether it is available.

cluster upgrade <cluster> --k8s-version <version>

Upgrade the Kubernetes version of a provisioned or imported RKE2 or K3s cluster with the version checks of the Rancher UI, and wait until Rancher reports the upgrade done; the preview names the newest etcd snapshot, because the upgrade cannot be reversed with this command - destructive; dry-run/apply --yes.

cluster save-etcd-snapshot <cluster>

Take an etcd snapshot of a provisioned RKE2 or K3s cluster as the Rancher UI does, wait until Rancher reports it taken and list the cluster’s snapshots; the command refuses while another operation is in progress on the cluster and while the cluster is not ready - destructive; dry-run/apply --yes.

Nodes

Command Purpose

node drain <node> --cluster <cluster>

Ask Rancher to drain a node: Rancher cordons it and evicts its pods through the Eviction API; the preview lists the pods and what the drain does to each; waits until Rancher reports the drain done or failed (--wait=false returns once the server accepts the request) - destructive; dry-run/apply --yes.

node stop-drain <node> --cluster <cluster>

Ask Rancher to stop a running drain of a node; the node stays cordoned and evicted pods are not put back; waits until Rancher reports the drain stopped - dry-run/apply.

Read and Inspect

Command Purpose

get cloud-credential [name]

List cloud credentials or show one - secret values never shown.

get kubernetes-versions

List available Kubernetes versions (RKE2/K3s), merged with the server’s default and supported-range settings.

inspect cluster <name-or-id>

Composite cluster read: identity, connectivity, provisioning, machine pools, members, machines, registration commands (node command and import command; gated behind --registration).

inspect pod <name>

Composite pod read: describe and recent logs.

inspect deployment <name>

Composite deployment read.

inspect project <name-or-id> [--cluster]

Composite project read: project, namespaces, members, resource quota, usage.

inspect user <id|username|displayName|principal>

Composite user read: id and names, groups, and role bindings at global, cluster and project level - bindings that exist only, never permissions.

charts --cluster <c> [--repo <name>] [--all-versions] [--include-deprecated]

List the charts of a cluster’s ClusterRepos from the Helm repository index Rancher serves for each: one line per chart with its newest version that is not a prerelease, or every version in the order Rancher serves them with --all-versions; deprecated versions are left out unless --include-deprecated; disabled ClusterRepos are skipped, and one whose index cannot be read is named in a warning.

images

Active-pod container images, grouped by image or owning workload, Fleet-wide.

usage

Resource usage composite (grouped by --by, filtered by scope flags).

Apps

Command Purpose

app install <release> --cluster <c> --namespace <ns> --repo <name> --chart <name> [--version <v>] [--values <file>]

Ask Rancher to install a chart from a ClusterRepo as a Helm release; Rancher fetches the chart and runs Helm in its own pod, and the CLI runs no helm. Because Helm actions are executed asynchronously by Rancher, the --dry-run preview is assembled from current server state (previewSource: serverReads) rather than a server-side dry-run mutation and carries no resourceVersion precondition. Values come only from files or stdin and show as paths, never values, except the values the CLI adds and the registry host (for a chart that declares a registry path), which show the value sent; --system-default-registry and --no-system-default-registry set or leave out the registry values. Returns once Rancher accepts the request, with the operation to follow, or with --wait when Helm’s run finishes; dry-run/apply.

app upgrade <release> --cluster <c> --namespace <ns> [--version <v>] [--values <file>] [--reset-values]

Ask Rancher to upgrade, downgrade, or change the values of an installed Helm release shown as an App, through the upgrade action of its ClusterRepo; Rancher runs Helm in its own pod, and there is no rollback. Like app install, the --dry-run preview is built from current server reads (previewSource: serverReads) and carries no resourceVersion precondition. It lists the path of every value added, removed, or changed, never the value (except the values the CLI adds and the registry host), and counts the release’s values it sends unchanged; the release’s values are read from the release Secret, which needs permission to get Secrets in the release’s namespace, and --reset-values sends only your files. The chart is the release’s chart; a request that changes nothing is refused. --wait returns when Helm’s run finishes, with the revision and status - destructive; dry-run/apply --yes.

app uninstall <release> --cluster <c> --namespace <ns> [--keep-history]

Ask Rancher to uninstall a Helm release shown as an App, which removes the release’s resources; the preview comes from server reads, with no resourceVersion precondition; --wait waits for Helm’s run to finish - destructive; dry-run/apply --yes.

Access

Command Purpose

access can <verb> [<resource>[/<name>]]

Ask the cluster’s authorizer whether you (or --as a subject) can perform a verb on a resource; exit 0 allowed, 12 denied, 13 unknown.

access list

List the rules you (or --as a subject) hold in a namespace as the authorizer reports them; exit 13 when any namespace is incomplete.

access who-can <verb> [<resource>[/<name>]]

List the subjects the cluster’s bindings name that the authorizer allows to perform a verb on a resource, one SubjectAccessReview each; denied rows with --show-denied; exit 13 when a row has a request issue or is unknown because the authorizer returned an evaluation error.

access explain <verb> [<resource>[/<name>]]

Explain the authorizer’s decision for one subject, verb, and resource in one namespace: the binding and role the server’s reason names, the rules covering the request, and the Rancher chain behind the binding (ClusterRoleTemplateBinding or ProjectRoleTemplateBinding, GlobalRoleBinding and GlobalRole, RoleTemplate inheritance); on deny, the bindings naming the subject or its groups; exit 0 allowed, 12 denied, 13 unknown, never changed by a partial chain.

access clusters

List the clusters Rancher lets you (or --as a user) into, as its proxy answers per cluster, beside the management bindings that grant it; exit 13 when any cluster is unknown.

access projects [--cluster]

List the projects you (or --as a user) can see into, grouped by cluster: the authorizer’s answer to getting each namespace of the project, summarized per project (all, partial, none, unknown), beside the ProjectRoleTemplateBindings that make the subject a member and the cluster or global bindings that reach it without membership; exit 13 when any cluster, project or namespace is unknown.

Logs and Support

Command Purpose

logs <target>

Verified-location logs of Rancher components for server/agent/fleet-agent/kube-api-auth/webhook/api-extension.

support-bundle

Pack what Rancher’s Kubernetes API can reach (logs, cluster/node state, events, settings/features/schema) into one tar.gz for support.

Kubectl Integration

Command Purpose

token

Legacy exec-credential shim for Rancher-generated kubeconfigs; (Deprecated; new kubeconfigs use auth get-token).

kubeconfig

Emit a LOCAL exec-credential kubeconfig for a cluster (no embedded secret), with the direct endpoint contexts when the cluster has the Authorized Cluster Endpoint; the exec entry records its config directory and, with --user-id, the owner its login records, and --exec-command names the binary kubectl runs - see create kubeconfig for the server-created, embedded alternative.

Telemetry

Command Purpose

telemetry status

Show whether local usage recording is enabled and what determined it (the RANCHER_CLI_TELEMETRY environment variable, the telemetry key in config.yaml, or the default), along with counts of recorded and dropped events, the telemetry schema contract version, and the anonymous random identifier generated for this config directory.

telemetry on

Set the telemetry key to true; creates the config directory when it is missing and deletes nothing.

telemetry off

Set the telemetry key to false, then delete the recorded events, the server facts, the config directory id and the upload state; creates the config directory when it is missing.

telemetry reset

Delete the recorded events, the server facts, the config directory id and the upload state; keeps the telemetry key.

telemetry show

List the recorded events, oldest first; the HOUR column is the hour in UTC, the only time an event stores; -o json carries every stored field of each event.

Discovery and Tooling

Command Purpose

schema [command|kind|group]

Schema manifest: bare = grouped table of contents; <command>/<kind>/<group> = one card; filter flags search all commands.

completion <bash|zsh|fish|pwsh>

Print a shell completion script; -o is ignored, output is always the raw script.

skill install

Install the rancher-cli agent skill into coding-agent harnesses (a target that already holds the same files is left untouched and reported unchanged).

skill uninstall

Remove the agent skills that rancher-cli installed (a skill directory that rancher-cli did not install is never removed: the command stops with an error and changes no target); a skills directory it leaves empty is removed too.

skill status

Report, for each harness, the installed skill version and whether its files are unchanged; exits 7 when a selected target is not in the expected state (another version, changed files, content rancher-cli did not install, or missing under --require-installed).

Limitations

What the app install command does not do. The Rancher UI does more in one install:

  • Upgrade. app install refuses a release name that already has an App (CONFLICT). To change a release, use rancher app upgrade.

  • A chart that names another chart to install first (rancher-monitoring is an example). The UI installs the dependency chart in the same request, in the same namespace, with the main chart’s global values. app install refuses such a chart; install it from the Rancher UI.

  • The namespace. The CLI refuses a namespace that does not exist, before it sends anything; the UI creates the namespace when it does not exist.

  • Pull secrets. For a repo with defaultImagePullSecrets, the UI offers a pull secret and sets global.imagePullSecrets to the one chosen; for a SUSE Application Collection repository it can create the secret from the repository’s credentials. The CLI creates none.