Skip to content

CLI Reference

This section provides an overview of the different k8sgpt CLI commands.



Run a scan with the default analyzers

k8sgpt generate
k8sgpt auth add
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"