> ## 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.

# Create and change a stack

> Create a Stack on a cluster, add Helm add-ons and manifests to its draft, set the order they deploy in, review the changes and deploy them.

A [Stack](https://docs.ankra.ai/concepts/stacks.md) groups the add-ons, manifests and applications that serve one concern on a cluster, such as ingress, observability or a database. Every change to a Stack starts as a **draft**: you add and edit resources, review what the draft changes, and only then deploy it. This guide creates a Stack, adds a Helm add-on and a manifest, makes the manifest deploy after the add-on, deploys the Stack and changes it later.

You end up with a Stack deployed on your cluster, and know the draft, review and deploy loop every later change follows. It takes about 10 minutes.

## Before you start

* **A cluster connected to Ankra** and online. See [Import a cluster](https://docs.ankra.ai/guides/import-cluster.md).
* **A role that may create and deploy Stacks on that cluster.** Otherwise starting the draft says "Your role does not allow creating stacks on this cluster.", and deploying says "Your role does not allow deploying this stack."
* **A Helm registry with the chart you want.** Ankra's public catalogue is there for every organisation; for your own charts, [connect a Helm registry](https://docs.ankra.ai/guides/registries.md) first.
* **For the CLI steps**, the `ankra` CLI signed in to your organisation.

## Create a Stack and deploy it

**1. Open the cluster's Stacks**

Open **Infrastructure → Clusters → \<your cluster>**, then **Stacks** under **Technical details** in the cluster's menu (`/next/clusters/<cluster-id>/stacks`).

The page lists the cluster's Stacks under **Stack inventory**, with **Clone stacks** and **Create a stack** at the top.

**2. Start the draft**

Select **Create a stack**. Under **Start from what you already know**, keep **Compose a stack** (add Helm add-ons and manifests yourself). The other two starts are:

* **Use a stack profile** - start from a versioned [stack profile](https://docs.ankra.ai/concepts/stack-profiles.md) and answer its inputs for this cluster.
* **Bring a Git definition** - for a Stack already declared in the cluster's connected [GitOps](https://docs.ankra.ai/concepts/gitops.md) repository. There is nothing to import: Ankra adds every Stack declared there on its next sync, and you open it from **Stacks**.

Under **Name the stack**, enter a **Stack name** (it is also the Stack's name in Git, and must not already be in use on the cluster) and, optionally, a **Description**. Select **Start the draft**.

The stack editor opens on the new draft. It says **No resources yet** and "Add a Helm add-on or a manifest to start composing the stack."

**3. Add a Helm add-on**

Select **Add → Helm add-on**. In **Find a chart**, search by chart name and pick the chart; the list covers every registry connected to your organisation.

The dialog becomes **Configure** and the chart's name. Fill in:

* **Pinned chart version** - an exact release. Ankra checks downgrades before it deploys.
* **Add-on name** - lowercase letters, digits and hyphens, unique in the Stack.
* **Namespace** - created by the add-on's release if it does not exist.
* **Values** (optional) - starts from the release defaults. Only what you keep here is stored with the Stack.

Select **Add to draft**. The add-on appears in the editor's **Graph**, and the status line reads **All changes saved**.

**4. Add a manifest**

Select **Add → Manifest**. Enter a **Resource name** (lowercase letters, digits and hyphens) and the YAML in **Manifest source**. The manifest needs `apiVersion`, `kind` and `metadata.name`. Select **Add to draft**.

The manifest appears beside the add-on.

**5. Set the order**

Select the manifest to open it in the inspector, then open its **Parents** tab. Under **Depends on**, tick the add-on: "These resources must succeed before" the manifest deploys. A choice that would loop back shows **Would create a cycle** and cannot be ticked.

The **Graph** draws the manifest after the add-on, and the **Table** view lists the add-on under **Depends on**. Resources with no parents deploy first, then each one after everything it depends on.

**6. Review the changes**

Select **Review changes**. The editor switches to **Changes**, the **Draft change log**: each resource the draft installs, creates, changes or removes, with what changes.

For a new Stack the confirmation reads **Create and deploy this stack?**: "The stack is committed to Git and its members deploy in dependency order."

**7. Deploy**

Select **Create and deploy stack** (on a Stack that is already deployed, the button is **Deploy reviewed changes**).

The editor reads "Deployment accepted. Follow the operation for its outcome." Open **Deployments** in the editor, or the cluster's **Operations**, to follow it. When the cluster has a connected GitOps repository and the Git commit is still pending, it reads "Changes accepted. Git sync is pending; check the stack before deploying again."

## Change a Stack later

Open the Stack from **Stacks** and select **Start a draft**. Everything you do from there lands in the draft, which is shared: anyone else with access can edit the same draft at the same time, and the status line shows whether your input is saved (**Saving to the shared draft…**, **All changes saved**).

* **Change an add-on's values or version**: select it and edit its **Values** tab, or its chart version in **Properties**. The **Diff** tab shows which values the Stack changes from the chart defaults.
* **Change how an add-on deploys**: its **Deployment settings** tab holds the timeout, rollback, retry and sync settings described in [Add-on settings](https://docs.ankra.ai/concepts/addon-settings.md).
* **Edit a manifest**: its **Source** tab holds the YAML.
* **Remove a resource**: a deployed resource is staged for removal (**Removal staged**) and uninstalled when you deploy; a resource that exists only in the draft is removed from it.
* **Add an application**: **Add → Application** adds one of your organisation's [applications](https://docs.ankra.ai/concepts/applications.md).

Then select **Review changes** and **Deploy reviewed changes**. Only the changed members are applied. A draft that removes resources asks **Deploy these changes, including removals?** instead, and removed members are uninstalled from the cluster. Removing a manifest deletes every object it declares, a PersistentVolumeClaim or a Namespace included, unless another live manifest or application on the cluster declares the same object. Read [Protect persistent data](https://docs.ankra.ai/guides/protect-persistent-data.md) before you remove a manifest that owns a volume.

The **More** menu holds the rest: **History and rollback** ([Undo a change](https://docs.ankra.ai/guides/stack-history-and-restore.md)), **Clone to another cluster** ([Clone Stacks](https://docs.ankra.ai/guides/clone-stack.md)), **Copy or move resources** to another Stack, **Backups and restore**, **Stack settings**, **Rename stack**, **Edit with Ankra** (Ankra AI stages changes in the draft for your review) and **Discard draft**.

> [!WARNING]
>
> **Discard draft** drops every change in the draft for everyone working in it. On a Stack that exists only as a draft, discarding removes the Stack; nothing was deployed.

## With the CLI

The CLI stages a Stack from an ImportCluster file as a draft, shows it and deploys it. Write the Stack into a file, for example `my-cluster.yaml`:

```yaml theme={null}
apiVersion: v1
kind: ImportCluster
metadata:
  name: my-cluster
spec:
  stacks:
  - name: logging
    manifests:
    - name: logging-namespace
      from_file: manifests/logging-namespace.yaml
    addons:
    - name: fluent-bit
      chart_name: fluent-bit
      chart_version: 0.49.1
      registry_name: fluent
      registry_url: https://fluent.github.io/helm-charts
      namespace: logging
      parents:
      - name: logging-namespace
        kind: manifest
```

`parents` sets the order, as the **Parents** tab does. Paths in `from_file` are relative to the file. Then:

```bash theme={null}
ankra cluster select my-cluster

# Stage every Stack in the file as a draft, deploying nothing
ankra cluster draft -f my-cluster.yaml

# Read what the draft would deploy
ankra cluster stacks show-draft logging

# Deploy it
ankra cluster stacks deploy-draft logging
```

`ankra cluster draft` refuses a Stack that already has a draft, and stages nothing when the platform refuses any Stack in the file. The draft it stages is the same draft the stack editor opens, so you can review or edit it there before deploying. To change one add-on's settings without a draft, use `ankra cluster addons settings set`.

## Verify

Open **Stacks** on the cluster: your Stack is listed, and opening it shows the add-on and the manifest with the manifest after the add-on in the **Graph**. From the CLI:

```bash theme={null}
ankra cluster stacks list
ankra cluster stacks history logging
```

## What can go wrong

| What you see | What to do |
| - | - |
| "This name cannot be used on this cluster." | The cluster already uses the name, or it is not a valid name. Pick another, or open the existing Stack from **Stacks**. |
| "No charts are indexed yet. Connect a Helm registry to add its charts." in **Find a chart** | [Connect a Helm registry](https://docs.ankra.ai/guides/registries.md) and wait until it is read. |
| "This stack already has an add-on with that name." | Change **Add-on name**. |
| "This chart release is no longer available from its registry." | Pick another **Pinned chart version**. |
| "These dependencies would create a cycle or reference a missing resource." | Untick the parent that closes the loop in **Parents**. |
| "Dependency cycle detected. Resolve it before deployment." | Same: a resource depends, directly or through others, on itself. |
| "This deploy would move add-ons to older chart versions. Check the versions below and confirm them to deploy." | Check the versions listed; confirm only a downgrade you mean. |
| "Ankra AI is working in this draft right now. Finish or release that conversation first." | An **Edit with Ankra** conversation holds the draft. Finish it, then edit. |
| "Deploy or discard the open draft before renaming this stack." | A Stack is renamed outside a draft: deploy or discard the draft first. |
| The deployment fails | Open **Deployments** or the cluster's **Operations** for the failing step, then see [Operations](https://docs.ankra.ai/platform/operations.md). |

## Next steps

* [Add-on settings](https://docs.ankra.ai/concepts/addon-settings.md) - how an add-on is retried, rolled back and kept in sync.
* [Undo a change](https://docs.ankra.ai/guides/stack-history-and-restore.md) - read a Stack's history and restore an earlier version.
* [Clone Stacks](https://docs.ankra.ai/guides/clone-stack.md) - copy a Stack to another cluster.
* [Stacks](https://docs.ankra.ai/concepts/stacks.md) - how Stacks, drafts and dependencies work.


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