Skip to content

Commit

Permalink
Merge pull request #37 from AnaisUrlichs/cli-docs-updates
Browse files Browse the repository at this point in the history
fix: mirror project README example of cli usage
  • Loading branch information
AnaisUrlichs committed May 18, 2023
2 parents bd37c0b + c292d16 commit 7d1b904
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 50 deletions.
3 changes: 1 addition & 2 deletions docs/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ You can view the different command options through

```bash
k8sgpt --help

Kubernetes debugging powered by AI

Usage:
Expand All @@ -35,7 +34,7 @@ Available Commands:
filters Manage filters for analyzing Kubernetes resources
generate Generate Key for your chosen backend (opens browser)
help Help about any command
integration Intergrate another tool into K8sGPT
integration Integrate another tool into K8sGPT
serve Runs k8sgpt as a server
version Print the version number of k8sgpt

Expand Down
22 changes: 22 additions & 0 deletions docs/reference/cli/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,25 @@ This command will analyze your cluster Vulnerabilities through K8sGPT. Depnding
- Error: critical Vulnerability found ID: CVE-2023-27536 (learn more at: https://avd.aquasec.com/nvd/cve-2023-27536)
- Error: critical Vulnerability found ID: CVE-2019-8457 (learn more at: https://avd.aquasec.com/nvd/cve-2019-8457)
```

## Adding and removing default filters

_Remove default filters_

```
k8sgpt filters add [filter(s)]
```

- Simple filter : `k8sgpt filters add Service`
- Multiple filters : `k8sgpt filters add Ingress,Pod`


_Remove default filters_

```
k8sgpt filters remove [filter(s)]
```

- Simple filter : `k8sgpt filters remove Service`
- Multiple filters : `k8sgpt filters remove Ingress,Pod`

94 changes: 46 additions & 48 deletions docs/reference/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,92 +3,90 @@
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](https://openai.com/)
* Have the [K8sGPT CLI installed](../../getting-started/installation.md)

## Commands

### Generate
_Run a scan with the default analyzers_

Command:
```bash
```
k8sgpt generate
k8sgpt auth new
k8sgpt analyze --explain
```

This command will provide you with a URL to OpenAI to generate an access token.
### Auth
_Filter on resource_

Command:
```bash
k8sgpt auth
```
k8sgpt analyze --explain --filter=Service
```

This command authenticates you with your chosen backend. Provide the access token generated through the `generate` command here.
_Filter by namespace_
```
k8sgpt analyze --explain --filter=Pod --namespace=default
```

### Analyze
_Output to JSON_

Command:
```bash
k8sgpt analyze
```
k8sgpt analyze --explain --filter=Service --output=json
```

This command will find problems within your Kubernetes cluster.

### Completion
_Anonymize during explain_

Command:
```bash
k8sgpt completion
```
k8sgpt analyze --explain --filter=Service --output=json --anonymize
```

Generate the autocompletion script for the specified shell.
## Additional commands

### Help
_List configured backends_

Command:
```bash
k8sgpt help
```
k8sgpt auth list
```

Provides you with the different command options in the CLI.
### Version
_Remove configured backends_

Command:
```bash
k8sgpt version
```
k8sgpt auth remove --backend $MY_BACKEND
```

Prints the K8sGPT version you are using.
_List integrations_

## Flags
```
k8sgpt integrations list
```

### --config
_Activate integrations_

Define the path to your k8sgpt configuration file:
```bash
--config string
```
k8sgpt integrations activate [integration(s)]
```

The default is located at `$HOME/.k8sgpt.yaml`
_Use integration_

### --help
```
k8sgpt analyze --filter=[integration(s)]
```

Access more information on the different commands:
```bash
-h, --help
_Deactivate integrations_

```
k8sgpt integrations deactivate [integration(s)]
```

### --kubeconfig
_Serve mode_

Provide the Path to your KubeConfig:
```bash
--kubeconfig string
```
k8sgpt serve
```

### --kubecontext
_Analysis with serve mode_

You can be connected to multiple Kubernetes context. To specify the Kubernetes context, use the following flag:
```bash
--kubecontext string
```
curl -X GET "http://localhost:8080/analyze?namespace=k8sgpt&explain=false"
```

0 comments on commit 7d1b904

Please sign in to comment.