Skip to main content
rule

ankra-cli — Cursor rule: Ankra CLI commands in your editor

A Cursor rule that tells the agent how to drive the Ankra CLI: clusters, stacks, Helm releases and tokens.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/ankra-cli.mdc
Open on GitHub

What ankra-cli does

Ankra is a Kubernetes cluster management platform, and its CLI ankra handles organisations, clusters, add-ons, stacks, Helm releases, credentials and tokens from the terminal. The rule spells out those commands so the agent in Cursor stops guessing at flags and nesting levels.

Sections cover authentication, cluster lifecycle, stacks, manifests, the cluster agent, Helm, charts and tokens. Global flags get their own table: --base-url, --token, --config. Config defaults to ~/.ankra.yaml; the token is better passed through ANKRA_API_TOKEN, which matters most in CI.

The rule advises running ankra cluster info before anything destructive and ankra cluster reconcile after config changes. Unresponsive cluster commands point at ankra cluster agent status. Credentials never belong in source control, so check your scripts before the first push.

What it helps with

  • log in and switch the active organisation
  • provision or destroy a Kubernetes cluster
  • list installed add-ons and update their settings
  • clone a working stack instead of building one from scratch
  • issue and revoke an API token for CI

Example prompts for the agent

  • show me how to log in to ankra and pick an organisation
  • create a Hetzner cluster and check the agent status
  • list the Helm releases in the active cluster

How to install ankra-cli

Manually: put the files in place

.cursor/rules/ankra-cli.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about ankra-cli

How do I install ankra-cli in Cursor?

Create .cursor/rules/ankra-cli.mdc in your project and paste the rule contents into it.

What does ankra-cli do?

It documents the Ankra platform CLI commands for organisations, clusters, stacks, Helm releases and tokens, so the Cursor agent works from them instead of guessing.

What do I need before using the Ankra CLI?

A platform account and a token, passed via --token or the ANKRA_API_TOKEN variable. Config lives at ~/.ankra.yaml by default.

Source text

ankra-cli.mdc · CC0-1.0
---
description: "Ankra CLI rules and best practices for managing Kubernetes clusters via the Ankra platform"
globs: **/*.sh, **/*.yaml, **/*.yml, Makefile, **/Makefile, **/*.md
alwaysApply: false
---
# Ankra CLI Best Practices

Ankra is a Kubernetes cluster management platform. Its CLI (`ankra`) lets you manage organisations, clusters, add-ons, stacks, Helm releases, credentials, and tokens from the terminal.

## Authentication & Configuration

- Authenticate first: `ankra login`
- Default config lives at `~/.ankra.yaml`; override with `--config <path>`
- Override the API base URL with `--base-url` or `ANKRA_BASE_URL`
- Supply an API token via `--token` or `ANKRA_API_TOKEN` (prefer env var in CI)
- Logout cleanly: `ankra logout`

```yaml
# ~/.ankra.yaml example
base_url: https://api.ankra.io
token: ${ANKRA_API_TOKEN}
```

## Organisation Management

```bash
ankra org list                          # List accessible organisations
ankra org switch <org-name>             # Switch active organisation
ankra org create <name>                 # Create a new organisation
ankra org invite <email>                # Invite a user to the current org
ankra org members                       # List members of the current org
```

## Cluster Lifecycle

```bash
ankra cluster list                      # List all clusters in the org
ankra cluster select <name>             # Set the active cluster context
ankra cluster info                      # Show details about the active cluster
ankra cluster provision                 # Provision a new cluster
ankra cluster deprovision               # Deprovision (destroy) the active cluster
ankra cluster reconcile                 # Reconcile cluster to desired state
ankra delete cluster <name>             # Delete a named cluster
```

- Always run `ankra cluster info` before destructive operations
- Use `ankra cluster reconcile` after config changes before assuming state is correct

## Add-ons

```bash
ankra cluster addons list               # List installed add-ons
ankra cluster addons available          # List available (installable) add-ons
ankra cluster addons settings <addon>   # Show current settings for an add-on
ankra cluster addons update <addon>     # Update add-on configuration
ankra cluster addons uninstall <addon>  # Uninstall an add-on
```

## Stacks (Application Stacks)

```bash
ankra cluster stacks list               # List stacks in the cluster
ankra cluster stacks create <name>      # Create a new stack
ankra cluster stacks delete <name>      # Delete a stack
ankra cluster stacks rename <old> <new> # Rename a stack
ankra cluster stacks clone <src> <dst>  # Clone a stack
ankra cluster stacks history <name>     # View stack change history
```

- Prefer `clone` over `create` when replicating an existing working stack
- Check `history` before rolling back to understand what changed

## Manifests & Operations

```bash
ankra cluster manifests list            # List deployed manifests
ankra cluster operations list           # List in-progress or recent operations
ankra cluster operations cancel <id>    # Cancel a running operation
```

## Cluster Agent

```bash
ankra cluster agent status              # Check agent health
ankra cluster agent token               # Retrieve agent bootstrap token
ankra cluster agent upgrade             # Upgrade the in-cluster agent
```

- Run `agent status` if cluster commands seem unresponsive
- Rotate the agent token periodically for security

## Helm

```bash
ankra cluster helm releases             # List Helm releases in the cluster
ankra cluster helm uninstall <release>  # Uninstall a Helm release
ankra helm registries                   # List configured Helm registries
ankra helm credentials                  # List Helm registry credentials
```

## Hetzner Cloud Clusters

```bash
ankra cluster hetzner create            # Create a Hetzner-backed cluster
ankra cluster hetzner scale             # Scale the cluster node count
ankra cluster hetzner upgrade           # Upgrade Kubernetes version
ankra cluster hetzner workers           # Manage worker node groups
ankra cluster hetzner node-group        # Node group management
```

## Charts

```bash
ankra charts list                       # List available charts
ankra charts search <term>              # Search charts
ankra charts info <chart>               # Detailed chart information
```

## Credentials

```bash
ankra credentials list                              # List stored credentials
ankra credentials get <name>                        # Retrieve a credential
ankra credentials validate <name>                   # Validate a credential
ankra credentials delete <name>                     # Delete a credential
ankra credentials hetzner --name <n> --token <t>   # Store Hetzner API token
ankra credentials ovh ...                           # Store OVH credentials
ankra credentials upcloud ...                       # Store UpCloud credentials
```

- Never commit credentials to source control; use `ANKRA_API_TOKEN` env var
- Validate credentials immediately after creation: `ankra credentials validate <name>`

## Tokens (API Tokens)

```bash
ankra tokens list                       # List API tokens
ankra tokens create --name <name>       # Create a new API token
ankra tokens revoke <id>                # Revoke a token (keeps record)
ankra tokens delete <id>                # Permanently delete a token
```

## AI Troubleshooting

```bash
ankra chat                              # Start AI-powered troubleshooting session
```

Use `ankra chat` when facing ambiguous errors — it provides contextual guidance.

## Global Flags

| Flag | Env Var | Description |
|------|---------|-------------|
| `--base-url <url>` | `ANKRA_BASE_URL` | Override API base URL |
| `--token <token>` | `ANKRA_API_TOKEN` | API authentication token |
| `--config <path>` | — | Path to config file (default `~/.ankra.yaml`) |

## Scripting & Automation Tips

- Export `ANKRA_API_TOKEN` in CI pipelines; never hard-code tokens
- Use `--token` for one-off scripts where env var injection is not possible
- Chain `ankra cluster select` before cluster-scoped commands in scripts
- Pipe output through `jq` for structured processing where JSON output is available
- Use `ankra cluster operations list` in CI to poll for async operation completion
- Add `set -euo pipefail` to shell scripts using the Ankra CLI

## Common Workflows

### Provision and configure a new Hetzner cluster

```bash
ankra login
ankra org switch my-org
ankra cluster hetzner create
ankra cluster select my-new-cluster
ankra cluster agent status
ankra cluster addons available
ankra cluster addons update some-addon
ankra cluster reconcile
```

### Deploy a stack from a chart

```bash
ankra cluster select my-cluster
ankra charts search my-app
ankra charts info my-app
ankra cluster stacks create my-stack
ankra cluster manifests list
```

### Rotate credentials safely

```bash
ankra tokens create --name ci-token-new
# Update CI secret with new token
ankra tokens revoke <old-token-id>
ankra credentials validate my-cloud-cred
```

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for DevOps and infrastructure →

From the same set68

cypress-defect-tracking-cursorrules-prompt-file A Cursor rule that turns the agent into a QA engineer: writes Cypress tests tagged by team, category and case ID, and builds reports through qa-shadow-report. ★ 41,011repo stars cursorrules-cursor-ai-wordpress-draft-macos-prompt A Cursor rule that describes the PressThat project: a system tray app that connects to WordPress and creates draft posts. Useful if you work on that app in Cursor. ★ 41,011repo stars cursor-ai-react-typescript-shadcn-ui-cursorrules-p A Cursor rule that pushes the agent toward React and TypeScript code written the way shadcn/ui and Tailwind CSS projects expect. ★ 41,011repo stars code-style-consistency-cursorrules-prompt-file A Cursor rule that makes the agent study your codebase conventions first and write new code to match them. Useful in repos with an established style. ★ 41,011repo stars cloudflare-workers-hono-angular-saas-cursorrules-prompt-file A Cursor rule that pins the stack and conventions for SaaS on Cloudflare Workers: Hono API, Angular, Drizzle, Clerk, Stripe. ★ 41,011repo stars chrome-extension-dev-js-typescript-cursorrules-pro A Cursor rule that points the agent at one set of conventions for building Chrome extensions in JavaScript and TypeScript. ★ 41,011repo stars ascii-simulation-game-cursorrules-prompt-file A Cursor rule that frames an observer-only ASCII simulation: 10x10 grid, turn-based play, logs for nearly everything. Useful if you are building something in the spirit of Conway's Game of Life. ★ 41,011repo stars android-jetpack-compose-cursorrules-prompt-file A Cursor rule that steers the agent through Android development with Jetpack Compose: architecture, state, tests. ★ 41,011repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor