Skip to main content

CLI for KubeAstra — AI-powered Kubernetes troubleshooting

Project description

KubeAstra CLI

PyPI version Python 3.11+ License: Apache 2.0

AI-powered Kubernetes troubleshooting from your terminal. A thin HTTP + SSE client for the KubeAstra backend.

$ kubeastra investigate --pod api-gateway --ns production

$ kubeastra investigate
  thinking · The user wants a scoped investigation of api-gateway in production …
 kubectl  get_pods returned 1 result (48ms)
 kubectl  describe_pod api-gateway (162ms)
 logs     get_pod_logs — last 200 lines (89ms)
 events   correlated 3 recent events (54ms)
 analyze  investigate_pod complete (912ms)

─ answer ─
Root cause: OOMKilled. Container RSS 142Mi exceeded limit 128Mi.
Trigger: Memory leak introduced in v2.3.1 (deployed 47 min ago).

╭─ KubeAstra ─────────────────────────────────────────────────────────╮
│                                                                     │
│  Root cause                                                         │
│                                                                     │
│  The api-gateway container was OOMKilled 3 times in the last 30     │
│  minutes. Its resident memory (142Mi) exceeded the configured limit │
│  (128Mi) shortly after each restart. The pattern started at         │
│  14:23 UTC, coinciding with the v2.3.1 rollout at 14:22 UTC.        │
│                                                                     │
│  Recommended: Rollback to v2.3.0 · blast radius: 2 services         │
│                                                                     │
╰─ tool: investigate_pod · cost: $0.0021 · tokens: 640 ─────────────────╯

Install

pip / pipx (recommended for standalone use):

pipx install kubeastra

From the monorepo (for contributors):

git clone https://github.com/astraverse-io/KubeAstra.git
cd KubeAstra/cli
pip install -e .

Python 3.11 or newer is required.

Prerequisites

The CLI talks to a KubeAstra backend over HTTP + Server-Sent Events. Start one before running commands:

# Local backend via docker-compose (from the monorepo root):
cd ui && docker compose up -d --build
# Backend listens on http://localhost:8000 by default.

Or point the CLI at an existing Helm-deployed backend:

kubeastra config set backend-url https://kubeastra.mycompany.internal

Commands

kubeastra ask "..."

Natural-language investigation. Streams the ReAct loop step-by-step.

kubeastra ask "why is checkout-service crashlooping in production?"
kubeastra ask "what pods are in the payments namespace?"

kubeastra investigate

Scoped investigation shortcut — same underlying flow as ask, with a canned question.

kubeastra investigate --pod api-gateway --ns production
kubeastra investigate --deployment redis --ns default
kubeastra investigate --node k8s-worker-01

kubeastra connect

Pick a kubeconfig context. Without arguments, lists what's available.

kubeastra connect                            # list contexts
kubeastra connect --context prod-us-east-1   # connect to a specific context
kubeastra connect --context dev --kubeconfig ~/.kube/other-config

kubeastra config set / get

Persist backend URL, API token (if the backend enforces auth), and session id.

kubeastra config set backend-url https://kubeastra.example.com
kubeastra config set api-token ka_prod_abcdef1234567890
kubeastra config get                         # print all values (token masked)
kubeastra config get backend-url             # print a specific value
kubeastra config path                        # print the config file path

Config lives at ~/.config/kubeastra/config.toml on Linux/macOS ($XDG_CONFIG_HOME/kubeastra/config.toml when set) and %APPDATA%\kubeastra\config.toml on Windows.

kubeastra doctor

Health-check the CLI + backend + kubeconfig detection.

kubeastra doctor

kubeastra --version

Print the CLI version.

Exit codes

Code Meaning
0 Success
1 Generic CLI error (bad flags, unexpected exception)
2 Authentication failure — set an API token
3 Connection failure — backend unreachable
4 Backend returned a non-2xx status
5 Backend answered but the investigation itself errored

Design notes

  • The CLI is a client, not an engine. The ReAct loop, tool dispatch, and RAG live in the backend. This is by design — one implementation of the agent, three surfaces (web UI, MCP server, this CLI).
  • No offline mode. Air-gapped deployments should run the backend Helm chart on-cluster and point the CLI at the internal service.
  • No secrets in the config file beyond what you put there. The api_token field is intentionally the only persisted credential.
  • No telemetry. The CLI does not phone home. Only the backend URL you configure is contacted.

Related

License

Apache 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubeastra-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kubeastra-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file kubeastra-0.1.0.tar.gz.

File metadata

  • Download URL: kubeastra-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for kubeastra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0931696b79a9413d122b56198ec0057ab10a5f449eb49732e39e666979d0c332
MD5 9fcd3ad947846c373edc9e4193ff1943
BLAKE2b-256 506fc7a4a873cf18505d485550fc78f6cb4e604a01ad35c9bede0d003310b1e2

See more details on using hashes here.

File details

Details for the file kubeastra-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kubeastra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for kubeastra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 742d12dc2f19169c6499268a18e4dcfcd2c826380b3b06c61247055e1fe50228
MD5 cfac1ca1495179f25bcf7bd72bd5ac7b
BLAKE2b-256 266d4bf649ed02b727bd86a9441cdb1beb4468366331aab951cc313d4933f92a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page