Skip to main content

KubeGuard CLI

Command-line interface for installing, inspecting, and operating KubeGuard AI.


Requirements

Tool Minimum Purpose
Python 3.9+ Runtime
kubectl Any Kubernetes cluster access
Helm v3+ Chart installation
KubeGuard repo — Helm chart at helm/kubeguard/
kube-prometheus-stack — Prometheus + Alertmanager backing

Installation

From the KubeGuard repository root:

cd cli
pip install .

Verify:

kubeguard --help

Development install (with test dependencies):

pip install -e ".[dev]"

Commands

Command Description
kubeguard version Show CLI and app version
kubeguard install Install KubeGuard into a Kubernetes cluster
kubeguard status Show current installation and runtime status
kubeguard pods Display pod risk scores
kubeguard alerts Display active KubeGuard alerts
kubeguard uninstall Remove the KubeGuard Helm release

Global Options

These options apply to every command:

Option Default Description
--context TEXT current-context Kubernetes context
--namespace TEXT kubeguard KubeGuard namespace

Example:

kubeguard --context kind-kubeguard status

Examples

Install KubeGuard

# Default install
kubeguard install

# Custom monitoring interval and namespaces
kubeguard install --interval 60 --namespaces demo,kubeguard-test

# Specify a non-default namespace
kubeguard install --namespace my-kubeguard

# Point to chart explicitly
kubeguard install --chart-path /path/to/helm/kubeguard

Check Status

kubeguard status

# JSON output
kubeguard status --json

View Pod Risk Scores

# All pods
kubeguard pods

# Filter by namespace
kubeguard pods --namespace demo

# Filter by risk level
kubeguard pods --risk high

# Combined
kubeguard pods --namespace kubeguard-test --risk high

# JSON output
kubeguard pods --json

View Active Alerts

kubeguard alerts

# JSON output
kubeguard alerts --json

# Custom Alertmanager service name
kubeguard alerts --alertmanager-svc my-alertmanager --alertmanager-ns monitoring

Uninstall

# Interactive confirmation
kubeguard uninstall

# Skip confirmation
kubeguard uninstall --yes

Multi-Context Usage

# Use a specific context for every command
kubeguard --context kind-kubeguard-fresh status
kubeguard --context kind-kubeguard pods
kubeguard --context kind-kubeguard alerts

The --context flag only affects the duration of the command. Your default context is never permanently changed.


Configuration Options (install)

Option Helm Value Default
--interval N monitoring.intervalSeconds 30
--namespaces TEXT monitoring.namespaces demo,kubeguard-test

API Access

The CLI does not require a public endpoint. All API access uses transient kubectl port-forward tunnels:

  • kubeguard status → svc/kubeguard:8000 (/health)
  • kubeguard pods → svc/kubeguard:8000 (/metrics)
  • kubeguard alerts → svc/kube-prometheus-stack-alertmanager:9093 (/api/v2/alerts)

Tunnels are opened for the duration of the command and then closed.


Troubleshooting

kubectl or helm not found

Error: kubectl is not installed or not on PATH.

Install kubectl: https://kubernetes.io/docs/tasks/tools/
Install Helm: https://helm.sh/docs/intro/install/

Cluster unreachable

Error: Kubernetes cluster is unreachable.

Check: kubectl cluster-info --context <your-context>

KubeGuard not installed

KubeGuard is not installed in namespace 'kubeguard'.
Run kubeguard install to install.

Port-forward timeout

The pod may still be initializing. Wait 30 seconds and retry. Check:

kubectl get pods -n kubeguard
kubectl logs -n kubeguard deployment/kubeguard --tail=20

Alertmanager not found

If using a custom Prometheus stack name:

kubeguard alerts \
  --alertmanager-svc my-alertmanager-svc \
  --alertmanager-ns monitoring

Running Tests

cd cli
pip install -e ".[dev]"
pytest kubeguard_cli/tests/ -v

All tests mock subprocess calls — no Kubernetes cluster is required.

Metadata

Release files for kubeguard-cli 0.1.6

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.1.6
File Size Uploaded
kubeguard_cli-0.1.6.tar.gz 23.4 kB Details

Built distribution (wheel)

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

Total release size: 55.4 kB

Release files / kubeguard_cli-0.1.6.tar.gz

Download URL kubeguard_cli-0.1.6.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
662f09b788e45b2fce608c3ff4922c6b1844ad802535424eba696edb1d5c36b6
BLAKE2b-256 checksum
How to use checksums
6b58b0730dba5c904077c4a720adbd71418857809a86d5b22c2efe2af39bed1a
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.1.6-py3-none-any.whl

Download URL kubeguard_cli-0.1.6-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4477760b9e94a721468dd13ee320e0b55ddcd4c52e1ac285aafabc633939de28
BLAKE2b-256 checksum
How to use checksums
3427bc29bcb9753e150f33be92700cbc5e0f103357c0db19d16f32e566663b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

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