> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ArgoCD

> Connect Argo CD so agents can find out-of-sync and degraded apps, read events and logs, and sync an app through your Approvals

Connect Argo CD to let CloudThinker agents list your applications, explain why one is out of sync or degraded, read its Kubernetes events and pod logs, and sync it through your approvals. The connection signs in with one Argo CD **API token** and works with self-hosted Argo CD and the Akuity Platform.

## Prerequisites

* An Argo CD server reachable from CloudThinker over HTTPS. A `localhost` or cluster-internal address won't work.
* Admin access to Argo CD, so you can create a local account and generate a token for it.
* The [Argo CD CLI](https://argo-cd.readthedocs.io/en/stable/cli_installation/) on your machine to generate the token.
* Self-hosted only: `kubectl` access to the `argocd` namespace, to edit the `argocd-cm` and `argocd-rbac-cm` ConfigMaps.

If your server is on a private network, see [Reaching private services](https://docs.cloudthinker.io/guide/connections/overview.md#reaching-private-services).

## Setup

Create a dedicated `cloudthinker` account instead of using `admin`. Its token then carries only the RBAC permissions you grant it, and you can revoke it without touching anyone else.

> [tab] Self-hosted Argo CD
>
> **1. Create a local account with API key access**
>
> Add a `cloudthinker` account that can only use API keys, not the web login:
>
> ```bash theme={null}
> kubectl -n argocd patch configmap argocd-cm --type merge \
>   -p '{"data":{"accounts.cloudthinker":"apiKey"}}'
> ```
>
> **2. Generate a token**
>
> Sign in as an admin, then generate a token for the new account:
>
> ```bash theme={null}
> argocd login argocd.example.com --username admin
> argocd account generate-token --account cloudthinker --expires-in 90d
> ```
>
> Copy the token. Add `--insecure` to both commands only if the server uses a self-signed certificate. Without `--expires-in`, the token never expires, so set a lifetime and generate a new one before it lapses.
>
> **Success state:** the second command prints a long token string.
>
> **3. Grant the account read access**
>
> Run `kubectl -n argocd edit configmap argocd-rbac-cm` and add these lines to the existing `policy.csv`:
>
> ```csv theme={null}
> p, role:cloudthinker, applications, get, */*, allow
> p, role:cloudthinker, logs, get, */*, allow
> g, cloudthinker, role:cloudthinker
> ```
>
> Edit the ConfigMap rather than applying a new one. `kubectl apply` with a fresh `argocd-rbac-cm` replaces your whole policy and can lock other users out. To let agents change things, add the lines in [Required permissions](#required-permissions).
>
> **4. Add the connection in CloudThinker**
>
> Open **More → Workspace settings → Connections**, stay on the **Builtin Connections** tab, and select **ArgoCD**. Fill in:
>
> * **ARGOCD\_BASE\_URL**: your server address, such as `https://argocd.example.com`
> * **ARGOCD\_API\_TOKEN**: the token you copied
> * **NODE\_TLS\_REJECT\_UNAUTHORIZED** (TLS verification): **Verify TLS (default)**, or **Skip TLS verification** for a self-signed certificate
> * **READ\_ONLY**: change it to **Read-only**. The form defaults to **Full access**.
>
> Click **Connect**.
>
> **Success state:** the dialog closes and the connection shows **Connected**. That status doesn't prove the token or RBAC works, so run the verify prompt below.

> [tab] Akuity Platform
>
> **1. Create a system account**
>
> In the [Akuity Portal](https://akuity.cloud), open your Argo CD instance, go to **Settings → System Accounts**, and add an account named `cloudthinker` with the **apiKey** capability.
>
> **2. Generate a token**
>
> Sign in to the instance as an admin and generate a token for the new account:
>
> ```bash theme={null}
> argocd login <instance-id>.cd.akuity.cloud --grpc-web --username admin
> argocd account generate-token --account cloudthinker --grpc-web --expires-in 90d
> ```
>
> Copy the token.
>
> **3. Grant the account read access**
>
> Add these lines to the instance's RBAC policy in the Akuity Portal:
>
> ```csv theme={null}
> p, role:cloudthinker, applications, get, */*, allow
> p, role:cloudthinker, logs, get, */*, allow
> g, cloudthinker, role:cloudthinker
> ```
>
> **4. Add the connection in CloudThinker**
>
> Open **More → Workspace settings → Connections**, stay on the **Builtin Connections** tab, and select **ArgoCD**. Fill in:
>
> * **ARGOCD\_BASE\_URL**: `https://<instance-id>.cd.akuity.cloud`
> * **ARGOCD\_API\_TOKEN**: the token you copied
> * **NODE\_TLS\_REJECT\_UNAUTHORIZED** (TLS verification): **Verify TLS (default)**
> * **READ\_ONLY**: change it to **Read-only**. The form defaults to **Full access**.
>
> Click **Connect**.
>
> **Success state:** the dialog closes and the connection shows **Connected**. Run the verify prompt below to confirm the token and RBAC work.

## Connection details

| Field | Description | Default |
| - | - | - |
| **ARGOCD\_BASE\_URL** | Argo CD server address, HTTPS | none |
| **ARGOCD\_API\_TOKEN** | Token for the account CloudThinker uses | none |
| **NODE\_TLS\_REJECT\_UNAUTHORIZED** | TLS verification. **Verify TLS (default)** checks the server certificate. **Skip TLS verification** accepts self-signed certificates; use it only for local or dev servers | Verify TLS |
| **READ\_ONLY** | **Read-only** turns off the sync, create, update, delete, and resource action tools. **Full access** keeps them on | Full access |

> [!WARNING]
>
> **READ\_ONLY** defaults to **Full access**. Switch it to **Read-only** unless you want agents to propose syncs and changes. RBAC still blocks anything the account isn't granted.

## Required permissions

The read lines from setup cover every read: `applications, get` covers application status, resource trees, managed resources, and events, and `logs, get` lets agents read pod logs. Add a line for each change you want agents to propose:

| Capability | Policy line |
| - | - |
| Sync | `p, role:cloudthinker, applications, sync, */*, allow` |
| Change applications | `p, role:cloudthinker, applications, create, */*, allow` `p, role:cloudthinker, applications, update, */*, allow` `p, role:cloudthinker, applications, delete, */*, allow` |
| Resource actions | `p, role:cloudthinker, applications, action/*, */*, allow` |

## Agent capabilities

| Capability | What agents can do | Approval |
| - | - | - |
| **Discovery** | List applications with sync status, health, repo, path, and namespace, plus resource trees and recent events for the unhealthy or out-of-sync ones | No |
| **Application detail** | Read one app's spec, managed resources, and the live versus desired diff | No |
| **Events and logs** | Read Kubernetes events for an app or resource, and pod logs from its workloads | No |
| **Sync** | Trigger a sync of one application | Yes, and off in Read-only |
| **Change applications** | Create, update, or delete an application | Yes, and off in Read-only |
| **Resource actions** | Run an action such as a restart on a managed resource | Yes, and off in Read-only |

Every change goes through [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md), and a rejected request isn't retried. To let agents sync, set **READ\_ONLY** to **Full access** and add the `applications, sync` permission. Leave either one out and agents can only read.

### Verify the connection

```text theme={null}
List my Argo CD applications with their sync status and health, and call out any that are OutOfSync or Degraded
```

Expect a table of application names with a sync status such as **Synced** or **OutOfSync** and a health status such as **Healthy** or **Degraded**, plus counts at the end.

### Example prompts

```text theme={null}
Why is the checkout app Degraded? Check its resource tree, recent events, and pod logs
Which resources in payments-api differ from Git, and what changed?
Sync the payments-api app and tell me when it's Healthy
```

Name the application. Agents use real names from the application list and won't guess one. The sync prompt needs **Full access** and the `applications, sync` permission.

## Troubleshooting

> [accordion] Connect fails with fetch failed
>
> CloudThinker can't reach **ARGOCD\_BASE\_URL**, or the server's certificate was rejected. Check that the address is public HTTPS, not `localhost` or a cluster-internal name. For a self-signed certificate, set **NODE\_TLS\_REJECT\_UNAUTHORIZED** to **Skip TLS verification**.

> [accordion] Requests return 401
>
> The token is missing, expired, or was generated for a different account. Run `argocd account generate-token --account cloudthinker --expires-in 90d` again, edit the connection, and paste the new token.

> [accordion] Permission denied (code 7)
>
> The account's RBAC role doesn't allow that action. Check the `policy.csv` lines in [Required permissions](#required-permissions): logs need `logs, get` and syncs need `applications, sync`.

> [accordion] The application list is empty
>
> The role grants no access to those projects. The `*/*` pattern in the policy covers every project; if you narrowed it, add the projects agents should see.

> [accordion] Sync, create, update, or delete is unavailable
>
> **READ\_ONLY** is set to **Read-only**. Edit the connection and switch to **Full access** if you want agents to propose those changes.

> [accordion] Generating a token fails
>
> The account doesn't have the `apiKey` capability. Run `argocd account get --account cloudthinker` to check, then repeat the first setup step.

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **Dedicated account**: give CloudThinker its own `cloudthinker` account with API key access only, never the `admin` token.
- **Keep TLS verification on in production**: skip it only for a local or dev server with a self-signed certificate.

## Related

> [card] [Kubernetes connection](https://docs.cloudthinker.io/guide/connections/kubernetes.md)
>
> Let agents read the clusters Argo CD deploys to.

> [card] [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md)
>
> Control which syncs and changes wait for a person.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.