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

# Attach your Kubernetes cluster

> Connect a Kubernetes cluster you run by installing the Akua cluster agent

If you already run a Kubernetes cluster, attach it to Akua instead of creating a [hosted cluster](https://docs.akua.dev/clusters/create.md). You install the Akua cluster agent with one Helm command and choose how much of the cluster it can manage. Akua then installs Packages onto the cluster. You keep operating the control plane, the nodes, and Kubernetes upgrades.

Akua

Sends what to install
no inbound access needed

one outbound connection

Your cluster, run by you

Akua cluster agent
only the access you chose

Your Installs

## Prerequisites

* A Kubernetes cluster you can reach with `kubectl` and `helm`.
* Permission to grant the access you choose: cluster-wide access, or access to the namespaces you list. The namespaces must already exist.

## Attach the cluster

**1. Start a new cluster**

In the [Clusters dashboard](https://akua.dev/clusters), click **New cluster**. Set **Cluster type** to **Your existing Kubernetes cluster**.

**2. Name the cluster and choose its access**

Enter a **Cluster name** (lowercase letters, numbers, and hyphens). Under **Access**, choose **All namespaces** or **Selected namespaces**, and list the namespaces separated by commas. Click **Continue**, then **Create cluster**.

**3. Run the connect command**

Click **Connect cluster** and then **Create command**. Run the Helm command with `kubectl` configured for your cluster. The command is single-use and shown once; creating a new one invalidates the previous command.

It installs the agent and its updater into the `akua-system` namespace.

**4. Wait for the connection**

The Cluster moves from `awaiting_agent` to `configuring` and then `ready` once the agent connects and Akua has placed what it needs. Akua places a tunnel connector and a private ingress gateway there for [public URLs](https://docs.akua.dev/networking.md).

## What the agent can do

The agent keeps one outbound connection to Akua, so your cluster needs no inbound access from Akua. It applies workloads as a ServiceAccount (`akua-apply`) that holds only the access you chose:

* **All namespaces:** `cluster-admin`.
* **Selected namespaces:** the `admin` role in each namespace you listed.

When a new agent release needs more permissions than you granted, Akua doesn't apply it. The Cluster shows a `needs-customer-upgrade` condition with the missing permissions and an **Upgrade command** to run. If the agent stops connecting, the Cluster shows `agent-offline`; workloads keep running, and nothing new rolls out until it reconnects. Run **Create command** again to repair the agent.

## What stays with you

Akua doesn't run the control plane or nodes of an attached cluster. You handle Kubernetes upgrades, scaling, and the [storage](https://docs.akua.dev/storage.md) your cluster provides. [Add servers](https://docs.akua.dev/clusters/add-workers.md) applies to hosted Clusters only.

## From the CLI or API

```bash
akua clusters create --input attached-cluster.json --json
akua clusters issue-connector-install CLUSTER_ID --input access.json --json
```

Both calls take the same `access` object in the request `body`. For example, `attached-cluster.json` holds `{"body": {"kind": "attached", "name": "shop", "access": {"kind": "cluster"}}}`. To limit the agent to namespaces, use `{"kind": "namespaces", "namespaces": ["a", "b"]}` as the `access` value.

> [card] [Clusters API reference](https://docs.akua.dev/api-reference/clusters/list-clusters.md)
>
> Endpoints, parameters, and response shapes.

> [card] [Authentication](https://docs.akua.dev/apis/authentication.md)
>
> Mint API tokens for programmatic access.

## Related topics

> [card] [Create a hosted cluster](https://docs.akua.dev/clusters/create.md)
>
> Let Akua run the control plane.

> [card] [Clusters overview](https://docs.akua.dev/clusters.md)
>
> Hosted and attached Clusters, and their states.

> [card] [Storage](https://docs.akua.dev/storage.md)
>
> How Installs get persistent volumes.

> [card] [Installs](https://docs.akua.dev/installs.md)
>
> Run a Package on the Cluster.
