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

# Clone a Cluster

> Duplicate cluster configurations using the Ankra CLI.

<Note>
  Clone stack configurations from existing clusters or remote repositories. Perfect for replicating production setups to staging or dev environments.
</Note>

***

## Prerequisites

* [Ankra CLI](/integrations/ankra-cli) installed and configured
* A cluster configuration file (YAML)

***

## Clone from a Local File

Copy stacks from an existing cluster configuration:

```bash theme={null}
ankra cluster clone existing-cluster.yaml new-cluster.yaml
```

***

## Clone from GitHub

Pull configurations directly from a repository:

```bash theme={null}
ankra cluster clone https://github.com/user/repo/raw/main/cluster.yaml my-cluster.yaml
```

***

## Clone Options

| Flag             | Description                                     |
| ---------------- | ----------------------------------------------- |
| `--clean`        | Replace all stacks in target (clean copy)       |
| `--force`        | Override conflicts during merge                 |
| `--copy-missing` | Copy missing files even from skipped stacks     |
| `--stack`        | Clone only specific stacks by name (repeatable) |

**Examples:**

```bash theme={null}
# Clean copy - replace all stacks in target
ankra cluster clone source.yaml target.yaml --clean

# Force merge - override conflicts
ankra cluster clone source.yaml target.yaml --force

# Clone only specific stacks
ankra cluster clone source.yaml target.yaml --stack "monitoring" --stack "networking"

# Complete replacement with all files
ankra cluster clone source.yaml target.yaml --clean --force --copy-missing
```

***

## Example Workflow

<Steps>
  <Step title="Clone from GitHub">
    ```bash theme={null}
    ankra cluster clone https://github.com/ankraio/ankra-gitops-examples/raw/main/clusters/monitoring-stack/cluster.yaml ./my-cluster.yaml
    ```
  </Step>

  <Step title="Apply the Configuration">
    ```bash theme={null}
    ankra cluster apply -f my-cluster.yaml
    ```
  </Step>

  <Step title="Customize Values">
    Edit the YAML file or use the UI to adjust values for your environment (resource limits, domains, replicas).
  </Step>
</Steps>

***

## Clone via UI

You can clone stacks directly in the Ankra UI:

**Clone a single stack:**

1. Navigate to **Stacks** in your cluster
2. Click the menu on any stack card
3. Select **Clone to Cluster**
4. Choose a target cluster and click **Clone Stack**

**Clone multiple stacks at once:**

1. Navigate to **Stacks** in your cluster
2. Click the **Clone Stacks** button next to the search bar (or click a stack card's avatar to start selecting)
3. Select the stacks you want to clone - a floating action bar shows the count
4. Click **Clone to Cluster**, choose a target cluster, and confirm
5. All selected stacks are cloned as drafts to the target cluster

<Tip>
  For a full guide on multi-stack cloning, see [Clone Stacks Between Clusters](/guides/clone-stack#clone-multiple-stacks-at-once).
</Tip>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Ankra CLI Reference" icon="terminal" href="/integrations/ankra-cli">
    Full CLI command reference.
  </Card>

  <Card title="GitOps Examples" icon="github" href="https://github.com/ankraio/ankra-gitops-examples">
    Example cluster configurations to clone.
  </Card>
</CardGroup>
