Skip to main content

KubeGuard CLI — Intelligent Kubernetes Workload Observatory & Risk Engine

PyPI version Python Versions License: MIT

KubeGuard AI is an AI-powered Kubernetes workload health monitoring, predictive risk calculation, and automated disaster recovery platform.

The kubeguard-cli package (kubeguard) is the official operator command-line tool for installing, inspecting, diagnosing, managing model lifecycles, and orchestrating backup & disaster recovery operations across Kubernetes clusters and multi-cluster fleets.


What is KubeGuard AI?

Traditional Kubernetes monitoring tools are strictly reactive—firing alerts only after a pod crashes (CrashLoopBackOff), exhausts memory (OOMKilled), or saturates node CPU.

KubeGuard AI bridges the gap between observability and reliability engineering:

  • Predictive Risk Scoring (0–100): Continuously observes memory trend slopes, CPU degradation patterns, and restart velocity to forecast workload failures before they impact availability.
  • Incident Correlation Engine: Groups fragmented Prometheus alert storms, metric anomalies, and ML signals into unified, contextualized incident timelines.
  • Closed-Loop Auto-Healing: Executes policy-bounded remediation actions (RESTART_POD, ROLLOUT_RESTART, POD_EVICT) with strict rate limiting, cooldown protection, and Pod Disruption Budget (PDB) enforcement.
  • Enterprise ML Model Governance: Provides candidate model validation, shadow canary isolation, cryptographic checksum verification, and instant rollback.
  • Automated Backup & Disaster Recovery (Phase 35): Delivers transactional database backup creation, online WAL snapshotting, SHA-256 package verification, retention pruning, and off-site synchronization.

Architecture Overview

KubeGuard operates as a non-invasive, security-hardened service inside your Kubernetes cluster. All CLI interactions connect through authenticated endpoints or transient kubectl tunnels—requiring zero public ingress exposure.

 ┌─────────────────────────────────────────────────────────────────────────────┐
 │                         KUBERNETES CLUSTER / FLEET                          │
 │                                                                             │
 │  ┌───────────────────────┐          ┌────────────────────────────────────┐  │
 │  │ Prometheus Monitoring │─────────▶│    KubeGuard Prediction Service    │  │
 │  │  - CPU & Memory Slopes│          │  - Ingestion & Feature Engineering │  │
 │  │  - Alertmanager Feeds │          │  - AI/ML Risk Engine (0-100 Score) │  │
 │  └───────────────────────┘          │  - Incident Correlation Engine     │  │
 │                                     │  - Model Registry & Canary Engine  │  │
 │  ┌───────────────────────┐          │  - Multi-Action Auto-Healing       │  │
 │  │  Cluster Workloads    │◀─────────│  - Disaster Recovery Engine        │  │
 │  │  - Pods & Deployments │ (Actions)└────────────────────────────────────┘  │
 │  │  - Namespaces & PDBs  │                            │                     │
 │  └───────────────────────┘                            ▼                     │
 │                                             ┌──────────────────┐            │
 │                                             │ Persistent Store │            │
 │                                             │ - SQLite / PG    │            │
 │                                             │ - Model Artifacts│            │
 │                                             └──────────────────┘            │
 └───────────────────────────────────────────────────────▲─────────────────────┘
                                                         │
                                               Transient Tunnel
                                            (or In-Cluster Network)
                                                         │
                                           ┌───────────────────────────┐
                                           │       KubeGuard CLI       │
                                           │   (pip: kubeguard-cli)    │
                                           │                           │
                                           │  - kubeguard status       │
                                           │  - kubeguard pods         │
                                           │  - kubeguard incidents    │
                                           │  - kubeguard model        │
                                           │  - kubeguard backup       │
                                           │  - kubeguard fleet        │
                                           └───────────────────────────┘

Core Architecture Pillars

  1. Prediction & Ingestion Pipeline: Scans cluster metrics at regular intervals, evaluates trend slopes over time windows, and calculates multidimensional risk scores.
  2. Persistence & Disaster Recovery: Stores telemetry observations, incident records, model metadata, and governance audits in an ACID-compliant database with online WAL snapshot capabilities.
  3. Model Governance & Registry: Tracks model versions, ensures reproducibility, validates SHA-256 artifacts, and supports atomic rollbacks.
  4. Transient Tunneling Mechanism: The CLI communicates directly with cluster services via encrypted, transient kubectl port-forward sessions, ensuring no external endpoints are exposed.

Requirements

Requirement Supported Versions Purpose
Python 3.9, 3.10, 3.11, 3.12, 3.13 CLI runtime
kubectl 1.24+ Cluster communication & secure port-forwarding
Helm 3.8+ Kubernetes deployment management (optional)
Prometheus Any (v2+) Cluster telemetry source (kube-prometheus-stack)

Installation

Install kubeguard-cli from PyPI using pip:

pip install kubeguard-cli

Verify the installation:

kubeguard --help
kubeguard version

Global Options

The following flags can be passed to all kubeguard commands:

Option Environment Variable Default Description
--context TEXT KUBEGUARD_CONTEXT Current context Target Kubernetes cluster context
--namespace TEXT, -n KUBEGUARD_NAMESPACE kubeguard Namespace where KubeGuard is deployed
--token TEXT KUBEGUARD_API_TOKEN None API authentication token (if enabled)

Example:

kubeguard --context kind-kubeguard --namespace kubeguard status

Command Reference & Usage Examples

1. Installation & Cluster Status

# Display overall health, pod count, active model, and deployment state
kubeguard status

# Output status in machine-readable JSON format
kubeguard status --json

# Install KubeGuard using the public OCI Helm chart (no source clone required)
kubeguard install --namespaces "default,production" --interval 30

# Install using a local chart checkout during development
kubeguard install --chart-path ./helm/kubeguard

# Dry-run validation of pre-flight checks and chart rendering without deployment
kubeguard install --dry-run

2. Diagnostics & Service Health

# Run comprehensive pre-flight and runtime diagnostics
kubeguard diagnostics
kubeguard diagnostics --json

# Check endpoint connectivity and worker process responsiveness
kubeguard health

3. Workload Risk Scoring & Telemetry

# Inspect all monitored pods and operational risk scores (0–100)
kubeguard pods

# Filter workloads by namespace or risk threshold
kubeguard pods --namespace production --risk high
kubeguard pods --json

4. Active Alerts & Correlated Incidents

# View active Prometheus and Alertmanager alerts affecting monitored pods
kubeguard alerts

# List correlated multi-signal incidents
kubeguard incidents list

# Inspect detailed incident context, signals, and root cause timeline
kubeguard incidents detail --incident-id INC-20261010-001

5. ML Model Registry & Rollback

# View active model version, SHA-256 checksum, and training metadata
kubeguard model status

# List version history and candidate validation records
kubeguard model list

# Instantly trigger an emergency rollback to a known-stable model version
kubeguard model rollback --target-version 55

6. Auto-Healing & Remediation Controls

# View auto-healing engine configuration, dry-run state, and safety bounds
kubeguard healing status

# Review audit trail of executed remediation attempts and cool-down timers
kubeguard healing history

7. Database Backup & Disaster Recovery (Phase 35)

# 1. Create a verified, atomic backup package (database + model artifacts)
kubeguard backup create --output-dir /data/backups --db-path /data/kubeguard.db

# Create backup with retention policy and off-site sync
kubeguard backup create \
  --output-dir /data/backups \
  --retention-count 7 \
  --external-sync-command "aws s3 cp {archive_path} s3://my-backup-bucket/kubeguard/"

# 2. Verify SHA-256 package integrity and manifest checksums
kubeguard backup verify --archive /data/backups/kubeguard-backup-1791798652.zip
# Or using positional argument:
kubeguard backup verify /data/backups/kubeguard-backup-1791798652.zip

# 3. Restore database and model state (requires explicit confirmation flag)
kubeguard backup restore \
  --archive /data/backups/kubeguard-backup-1791798652.zip \
  --db-path /data/kubeguard.db \
  --force

8. Multi-Cluster Fleet Governance

# List all registered edge clusters in the fleet
kubeguard fleet list

# Inspect fleet heartbeats, sync states, and aggregated incidents
kubeguard fleet status

9. Clean Uninstallation

# Remove KubeGuard Helm release and associated runtime resources
kubeguard uninstall --yes

Security & Safety Guardrails

  • Zero Ingress Exposure: Uses standard, temporary kubectl port-forwarding rather than requiring public LoadBalancers or NodePorts.
  • Disaster Recovery Isolation: Restore operations validate package signatures and reconstruct staging databases before touching destination targets.
  • Credential Protection: Shell arguments, tokens, and authorization headers are sanitized and redacted from all command logs.
  • Destructive Action Confirmation: High-impact commands such as restore and uninstall strictly enforce --force or explicit operator confirmation flags.

Author & Attribution

Author: Saravanakumar G


License

This project is licensed under the MIT License — Copyright (c) 2026 Saravanakumar G.

Metadata

Release files for kubeguard-cli 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kubeguard-cli 0.2.1
File Size Uploaded Provenance
kubeguard_cli-0.2.1.tar.gz 57.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kubeguard-cli 0.2.1
File Interpreter ABI Platform
kubeguard_cli-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 129.5 kB

Release files / kubeguard_cli-0.2.1.tar.gz

Download URL kubeguard_cli-0.2.1.tar.gz
Size 57.6 kB
Tags Source
SHA-256 checksum
How to use checksums
97041d2fc8336b10c39f374235ec8fed0e79f71493c4fc55e93c9a6344f20494
BLAKE2b-256 checksum
How to use checksums
6bd01dd7c632e4d69ad3456e5121cf1ddf4f7726d6c567063f38f40e2c73fce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / kubeguard_cli-0.2.1-py3-none-any.whl

Download URL kubeguard_cli-0.2.1-py3-none-any.whl
Size 72.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
828de29f6af63f2ebbeebdf52374474779c027545949d5e350fe8107ff1c83cc
BLAKE2b-256 checksum
How to use checksums
6065ab6483d44565b9ec52ede04fa711c846908d738f337a0180488a41f004a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for kubeguard-cli 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page