Skip to content

Commit

Permalink
Merge pull request #44 from matthisholleville/feat/serve-mode
Browse files Browse the repository at this point in the history
feat: add serve-mode documentation
  • Loading branch information
AnaisUrlichs committed May 17, 2023
2 parents 9c632de + 3e9b75d commit 6905b08
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/reference/cli/serve-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# K8sGPT Serve mode

## Prerequisites

1. Have [grpcurl](https://github.com/fullstorydev/grpcurl) installed

## Run `k8sgpt` serve mode

```bash
$ k8sgpt serve
{"level":"info","ts":1684309627.113916,"caller":"server/server.go:83","msg":"binding metrics to 8081"}
{"level":"info","ts":1684309627.114198,"caller":"server/server.go:68","msg":"binding api to 8080"}
```

This command starts two servers:

1. The health server runs on port 8081 by default and serves metrics and health endpoints.
2. The API server runs on port 8080 (gRPC) by default and serves the analysis handler.

For more details about the gRPC implementation, refer to this [link](https://buf.build/k8sgpt-ai/k8sgpt/docs/main).

## Analyze your cluster with `grpcurl`

Make sure you are connected to a Kubernetes cluster:

```bash
kubectl get nodes
```

Next, run the following command:

```bash
grpcurl -plaintext localhost:8080 schema.v1.Server/Analyze
```

This command provides a list of issues in your Kubernetes cluster.

## Analyze with parameters

You can specify parameters using the following command:

```bash
grpcurl -plaintext -d '{"explain": false, "filters": ["Ingress"], "namespace": "k8sgpt"}' localhost:8080 schema.v1.Server/Analyze
```

In this example, the analyzer will only consider the `k8sgpt` namespace without AI explanation and only focus on the `Ingress` filter.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nav:
- CLI:
- Overview: reference/cli/index.md
- Integration and Filter: reference/cli/filters.md
- Serve mode: reference/cli/serve-mode.md
- Operator:
- Overview: reference/operator/overview.md
- Guidelines & Community:
Expand Down

0 comments on commit 6905b08

Please sign in to comment.