Skip to main content

k8s-aiops (preview)

Disclaimer: This is a community-maintained open-source project and is not affiliated with, endorsed by, or sponsored by the Cloud Native Computing Foundation, the Kubernetes project, or k3s/Rancher. "Kubernetes" and "k3s" are trademarks of their respective owners. Source code is publicly auditable at github.com/AIops-tools/K8s-AIops under the MIT license.

Governed Kubernetes operations for AI agents — 51 MCP tools, every one wrapped with the bundled @governed_tool harness: a local unified audit log under ~/.k8s-aiops/, policy engine, token/runaway budget guard, undo-token recording, and graduated-autonomy risk tiers. Coverage spans pods, deployments, statefulsets, daemonsets, replicasets, jobs/cronjobs, services, ingresses, endpoints, configmaps, secrets (names/keys only), PVCs/PVs/storageclasses, nodes, namespaces, events, rollouts (status/history/undo/pause/resume/set-image), pod/node describe, pod/node top, and a cluster health summary.

Standalone: the governance harness is bundled in the package (k8s_aiops.governance) — k8s-aiops has no external skill-family dependency. Preview: common cluster operations, not yet exhaustive.

What works

Any cluster a kubeconfig can reach: standard Kubernetes, k3s, EKS, GKE, AKS, kind, minikube. Authentication (client certs, tokens, EKS/GKE/AKS exec plugins) is delegated entirely to the kubeconfig.

Quick Start

uv tool install k8s-aiops

# Friendly onboarding wizard — registers your kube contexts as named targets:
k8s-aiops init

# Or skip it — uses your current kube-context out of the box:
k8s-aiops doctor
k8s-aiops pod list
k8s-aiops deployment list -n default

To define named targets (multiple clusters/contexts), create ~/.k8s-aiops/config.yaml:

targets:
  - name: prod          # used as -t prod
    context: prod-eks   # a context in your kubeconfig (omit for current-context)
    namespace: default  # optional default namespace
    # kubeconfig: /path/to/alt/kubeconfig   # optional explicit path
  - name: lab
    context: k3s-lab

No secrets live in this file — credentials come from the kubeconfig.

MCP

{
  "command": "k8s-aiops",
  "args": ["mcp"],
  "env": { "K8S_AIOPS_CONFIG": "~/.k8s-aiops/config.yaml" }
}

Audit & Safety

  • Every tool call is logged to ~/.k8s-aiops/audit.db (local SQLite; relocate with K8S_AIOPS_HOME).
  • Reversible writes record an inverse undo descriptor (scale_deployment → scale-back to previous; cordon_nodeuncordon_node).
  • delete_deployment is risk_level=high; CLI destructive commands require double confirmation and support --dry-run.
  • All API text passes through sanitize() (prompt-injection defense).

See skills/k8s-aiops/SKILL.md and SECURITY.md for details.

Companion Skills

If you want… Use
Kubernetes pods / deployments / nodes k8s-aiops (this)
Hypervisor VM lifecycle a hypervisor ops skill
Backup & restore a backup ops skill

Contributing & feature requests

This is a preview — coverage is intentionally focused. Missing a device, action, or feature you need? Open an issue or pull request at github.com/AIops-tools/K8s-AIops — feature requests, contributions, and comments are all welcome.

License

MIT — github.com/AIops-tools/K8s-AIops

Download files

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

Source Distribution

k8s_aiops-0.2.1.tar.gz (90.9 kB view details)

Uploaded Source

Built Distribution

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

k8s_aiops-0.2.1-py3-none-any.whl (91.1 kB view details)

Uploaded Python 3

File details

Details for the file k8s_aiops-0.2.1.tar.gz.

File metadata

  • Download URL: k8s_aiops-0.2.1.tar.gz
  • Upload date:
  • Size: 90.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for k8s_aiops-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3ad6e812fb96d5dbe80e9fce4f811aa93e6c95781e859ec3d95959438310875b
MD5 3e56b1dfc1ef083982a3f13dfe352f71
BLAKE2b-256 afafb90658a6c752334957fd9004e5ca120cc3850c934e0c9802453b48b1e58a

See more details on using hashes here.

File details

Details for the file k8s_aiops-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: k8s_aiops-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 91.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for k8s_aiops-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ecae5560ff9a6181613916ac35348d06a4c228f4ca059d2ab607b34d6f228da
MD5 3e1d23fdbc7ebb0bf181b5cf3f3e1531
BLAKE2b-256 0fa1baf81c2726583780a0a61b5d1a95f1171a8d12b2d35b85713415c093d48a

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