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.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kubeguard_cli-0.1.7.tar.gz | 33.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kubeguard_cli-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.4 kB
Release files / kubeguard_cli-0.1.7.tar.gz
| Download URL | kubeguard_cli-0.1.7.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b5c3e9c305a1153ecda072a2bd507759c154364af60e726c342d596454e9fa7
|
|
BLAKE2b-256 checksum How to use checksums |
b72f2368b9033fca1c9f35ddbe8e0dfa63157e6d0b0c2cfff4b9921fd99e2aa0
|
| 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.7-py3-none-any.whl
| Download URL | kubeguard_cli-0.1.7-py3-none-any.whl |
|---|---|
| Size | 47.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d3aaf0cc031c9781188129d1ec3e5f0bb644f37aca727767ce715ba8ed1025a
|
|
BLAKE2b-256 checksum How to use checksums |
35ad6333964d751add13409d7c7ce74bd983a89e3c980881aaf35149788fc2dd
|
| 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.1.7
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.