# Agent mode

## :heavy\_plus\_sign: Add your cluster

Go to your clusters list, click on the « Add » button and select the « Agent » installation type.

<figure><img src="/files/RKxoQVUc7hB9cHELkmB6" alt=""><figcaption><p>Add cluster button.</p></figcaption></figure>

Fill the cluster details and click on « Add cluster ».

<figure><img src="/files/MXLrtCAdSri7O9aPefw9" alt=""><figcaption><p>Add cluster form for local agent installation.</p></figcaption></figure>

After your cluster has been added, you will receive some credentials needed for the installation of the agent on your cluster.

<figure><img src="/files/99YeQJ63W9PrXExc3LFb" alt=""><figcaption><p>Cluster credentials.</p></figcaption></figure>

If you close this window by mistake or want to install the agent later on, you can always get back your cluster credentials until you [complete the agent installation](#install-the-agent).

<figure><img src="/files/MBEUblHNtDaIJOWVK8AW" alt=""><figcaption><p>Click on the wrench icon to get your cluster credentials.</p></figcaption></figure>

## :tools: Install the agent

{% hint style="info" %}
The following content assumes that:

* you have [`kubectl`](https://kubernetes.io/docs/tasks/tools/#kubectl) and [`helm`](https://helm.sh/docs/intro/install/) binaries installed
* your current context is set to the correct cluster
* you have enough privileges on your cluster to create resources
  {% endhint %}

{% hint style="warning" %}
Replace `YOUR_CLUSTER_NAME`, `YOUR_CLUSTER_ACCESS_KEY` and `YOUR_CLUSTER_SECRET_KEY` with the values for your cluster.
{% endhint %}

```bash
# Check connection to your cluster
kubectl get nodes

# Add our Helm charts repository
helm repo add kubolabs https://download.kubolabs.io/charts

# Update local repositories
helm repo update

# Install KuboVisor local agent
helm install kubovisor-agent kubolabs/kubovisor --create-namespace \
  --namespace kubovisor \
  --set agent.permissions=read-only \
  --set cluster.name=YOUR_CLUSTER_NAME \
  --set cluster.accessKey=YOUR_CLUSTER_ACCESS_KEY \
  --set cluster.secretKey=YOUR_CLUSTER_SECRET_KEY
```

### Helm chart values

| Value                        | Default                         | Description                                                                                                                                                        |
| ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `agent.permissions`          | `read-only`                     | Define the [permission level](/getting-started/kubovisor/troubleshooting.md#what-are-permission-levels) to use.                                                    |
| `agent.schedule`             | `*/5 * * * *` (every 5 minutes) | Define the running periodicity.                                                                                                                                    |
| `agent.historyLimit`         | `1`                             | Define the history limit of agent jobs.                                                                                                                            |
| `cluster.name`               | `local`                         | <p>Define the cluster name.<br><em>You will most likely want to use the same name that you used when adding your cluster.</em></p>                                 |
| `cluster.accessKey`          | **Required**                    | Define the cluster access key.                                                                                                                                     |
| `cluster.secretKey`          | **Required**                    | Define the cluster secret key.                                                                                                                                     |
| `serviceAccount.create`      | `true`                          | Define if a ServiceAccount should be created.                                                                                                                      |
| `serviceAccount.name`        | `ksa-kubovisor`                 | <p>Set the ServiceAccount name to use.<br><em>If <code>serviceAccount.create</code> is set to <code>false</code>, this ServiceAccount must already exist.</em></p> |
| `serviceAccount.annotations` | `{}`                            | Define the ServiceAccount annotations.                                                                                                                             |
| `image.registry`             | `gcr.io/kubolabs-public`        | Define container image registry to use.                                                                                                                            |
| `image.name`                 | `kubovisor/agent`               | Define container image name to use.                                                                                                                                |
| `image.tag`                  | **Value of `Chart.appVersion`** | Define container image tag to use.                                                                                                                                 |
| `image.pullPolicy`           | `IfNotPresent`                  | Define container image pull policy to use.                                                                                                                         |
| `image.pullSecrets`          | `[]`                            | Define container image registry pull secret to use.                                                                                                                |
| `resources.limits.cpu`       | `500m`                          | Define container CPU limits.                                                                                                                                       |
| `resources.limits.memory`    | `512Mi`                         | Define container memory limits.                                                                                                                                    |
| `resources.requests.cpu`     | `100m`                          | Define container CPU requests.                                                                                                                                     |
| `resources.requests.memory`  | `320Mi`                         | Define container memory requests.                                                                                                                                  |
| `labels`                     | `{}`                            | Define custom labels to apply to resources.                                                                                                                        |
| `annotations`                | `{}`                            | Define custom annotations to apply to resources.                                                                                                                   |
| `nodeSelector`               | `{}`                            | Define custom node selectors.                                                                                                                                      |
| `tolerations`                | `[]`                            | Define custom tolerations.                                                                                                                                         |
| `affinity`                   | `{}`                            | Define custom affinities.                                                                                                                                          |

## :rocket: Get to know your cluster

When data is available, you’ll see colored indicators regarding your cluster's state, health and security. Go ahead, click on them to display the details!

Elements shown in **red** are issues that should be addressed **as soon as possible**.

While elements shown in **orange** are problems that **should still be addressed**, they don’t threaten your cluster nor your workloads.

If everything is **green**, congratulations! That means your cluster is in very good shape :sunglasses: **Try to keep it this way!**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kubolabs.io/getting-started/kubovisor/agent-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
