CLI Reference
This section provides an overview of the different k8sgpt
CLI commands.
Prerequisites
- You need to be connected to a Kubernetes cluster, K8sGPT will access it through your kubeconfig.
- Signed-up to OpenAI ChatGPT
- Have the K8sGPT CLI installed
Commands
Run a scan with the default analyzers
k8sgpt generate
k8sgpt auth new
k8sgpt analyze --explain
Filter on resource
k8sgpt analyze --explain --filter=Service
Filter by namespace
k8sgpt analyze --explain --filter=Pod --namespace=default
Output to JSON
k8sgpt analyze --explain --filter=Service --output=json
Anonymize during explain
k8sgpt analyze --explain --filter=Service --output=json --anonymize
Additional commands
List configured backends
k8sgpt auth list
Remove configured backends
k8sgpt auth remove --backend $MY_BACKEND
List integrations
k8sgpt integrations list
Activate integrations
k8sgpt integrations activate [integration(s)]
Use integration
k8sgpt analyze --filter=[integration(s)]
Deactivate integrations
k8sgpt integrations deactivate [integration(s)]
Serve mode
k8sgpt serve
Analysis with serve mode
curl -X GET "http://localhost:8080/analyze?namespace=k8sgpt&explain=false"