# Administrator CLI

The NVIDIA Run:ai Administrator (`runai-adm`) is a lightweight tool designed to support infrastructure administrators by simplifying two key tasks:

* [Collecting logs](https://run-ai-docs.nvidia.com/self-hosted/2.20/infrastructure-setup/procedures/logs-collection) for troubleshooting and sharing with NVIDIA Run:ai support.
* Configuring [node roles](https://run-ai-docs.nvidia.com/self-hosted/2.20/infrastructure-setup/advanced-setup/node-roles) in the cluster for optimal performance and reliability.

This section outlines the installation and usage of the NVIDIA Run:ai Administrator CLI to help you get started quickly.

## Prerequisites

Before installing the CLI, review the following:

* **Operating system**: The CLI is supported on Mac and Linux.
* **Kubectl**: The Kubernetes command-line interface must be installed and configured to access your cluster. Follow the [official guide](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
* **Cluster administrative permissions**: The CLI requires a Kubernetes profile with administrative privileges.

## Installation

To install the NVIDIA Run:ai Administrator CLI, ensure that the CLI version matches the version of your NVIDIA Run:ai cluster. You can either install the latest version or a specific version from the [list](https://runai.jfrog.io/ui/native/cli/runai-admin-cli/).

### Installing the Latest Version

Use the following commands to download and install the latest version of the CLI:

<details>

<summary><strong>Mac</strong></summary>

```bash
wget --content-disposition https://app.run.ai/v1/k8s/admin-cli/darwin  
chmod +x runai-adm  
sudo mv runai-adm /usr/local/bin/runai-adm
```

</details>

<details>

<summary><strong>Linux</strong></summary>

```bash
wget --content-disposition https://app.run.ai/v1/k8s/admin-cli/linux  
chmod +x runai-adm  
sudo mv runai-adm /usr/local/bin/runai-adm
```

</details>

### Installing a Specific Version

To install a specific version of the Administrator CLI that matches your NVIDIA Run:ai cluster version, append the version number to the download URL. Refer to the list of available versions linked above for the correct version number.

<details>

<summary><strong>Mac</strong></summary>

```bash
wget --content-disposition https://app.run.ai/v1/k8s/admin-cli/<version>/darwin # Replace <version> with the desired version in the format vX.X.X (e.g., v2.19.5) 
chmod +x runai-adm  
sudo mv runai-adm /usr/local/bin/runai-adm
```

</details>

<details>

<summary><strong>Linux</strong></summary>

```bash
wget --content-disposition https://app.run.ai/v1/k8s/admin-cli/<version>/linux # Replace <version> with the desired version in the format vX.X.X (e.g., v2.19.5)
chmod +x runai-adm  
sudo mv runai-adm /usr/local/bin/runai-adm
```

</details>

### Verifying Installation

Verify your installation completed successfully by running the following command:

```sh
runai-adm version  
```

## Reference

### Node Roles

To set or remove node rules using the `runai-adm` tool, run the following:

```sh
runai-adm set node-role [--runai-system-worker | --gpu-worker | --cpu-worker] <node-name>
```

```sh
runai-adm remove node-role [--runai-system-worker | --gpu-worker | --cpu-worker] <node-name>
```

{% hint style="info" %}
**Note**

Use the `--all` flag to set or remove a role to all nodes.
{% endhint %}

### Collect Logs

To collect logs using the `runai-adm` tool:

1. Run the following command:

   ```sh
   runai-adm collect-logs
   ```
2. Locate the generated compressed log file.
