Skip to content

Commit

Permalink
Merge pull request #20 from AnaisUrlichs/integration
Browse files Browse the repository at this point in the history
adding documentation for the filters and integration
  • Loading branch information
AlexsJones committed Apr 28, 2023
2 parents 2240617 + f01c740 commit 232f9ec
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 61 deletions.
124 changes: 64 additions & 60 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,64 @@ Ensure that you have Homebrew installed:
- Homebrew for Linux
Homebrew for Linux also works on WSL

### Installation
### Homebrew

Install K8sGPT on your machine with the following commands:

```bash
brew tap k8sgpt-ai/k8sgpt
brew install k8sgpt
```
## Other Installation Options

<details>
<summary>RPM-based installation (RedHat/CentOS/Fedora)</summary>
### RPM-based installation (RedHat/CentOS/Fedora)

**32 bit:**
<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_386.rpm
sudo rpm -ivh k8sgpt_386.rpm
```
<!---x-release-please-end-->
**32 bit:**

**64 bit:**

<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_amd64.rpm
sudo rpm -ivh -i k8sgpt_amd64.rpm
```
<!---x-release-please-end-->
</details>
```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_386.rpm
sudo rpm -ivh k8sgpt_386.rpm
```

**64 bit:**

<details>
<summary>DEB-based installation (Ubuntu/Debian)</summary>
```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_amd64.rpm
sudo rpm -ivh -i k8sgpt_amd64.rpm
```

### DEB-based installation (Ubuntu/Debian)

**32 bit:**
<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_386.deb
sudo dpkg -i k8sgpt_386.deb
```
<!---x-release-please-end-->
**64 bit:**

<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_amd64.deb
sudo dpkg -i k8sgpt_amd64.deb
```
<!---x-release-please-end-->
</details>

<details>
```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.7/k8sgpt_386.deb
sudo dpkg -i k8sgpt_386.deb
```

**64 bit:**

<summary>APK-based installation (Alpine)</summary>
```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.7/k8sgpt_amd64.deb
sudo dpkg -i k8sgpt_amd64.deb
```

### APK-based installation (Alpine)

**32 bit:**
<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_386.apk
apk add k8sgpt_386.apk
```
<!---x-release-please-end-->
**64 bit:**
<!---x-release-please-start-version-->
```
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_amd64.apk
apk add k8sgpt_amd64.apk
```
<!---x-release-please-end-->x
</details>

<details>
<summary>Failing Installation on WSL or Linux (missing gcc)</summary>
```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.7/k8sgpt_386.apk
apk add k8sgpt_386.apk
```

**64 bit:**

```bash
curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.2.1/k8sgpt_amd64.apk
apk add k8sgpt_amd64.apk
```

### Failing Installation on WSL or Linux (missing gcc)
When installing Homebrew on WSL or Linux, you may encounter the following error:

```
Expand All @@ -92,11 +78,10 @@ brew install k8sgpt
```

If you install gcc as suggested, the problem will persist. Therefore, you need to install the build-essential package.
```
```bash
sudo apt-get update
sudo apt-get install build-essential
```
</details>

## Windows

Expand All @@ -111,11 +96,12 @@ Verify that K8sGPT is installed correctly:
```bash
k8sgpt version

k8sgpt version 0.1.3
k8sgpt version 0.2.7
```

### Common Issues
## Common Issues

### Windows WSL
Failing Installation on WSL or Linux (missing gcc)
When installing Homebrew on WSL or Linux, you may encounter the following error:

Expand All @@ -131,7 +117,25 @@ If you install gcc as suggested, the problem will persist. Therefore, you need t
sudo apt-get install build-essential
```

### Upgrading the brew installation
## Running K8sGPT through a container

If you are running K8sGPT through a container, the CLI will not be able to open the website for the OpenAI token.

You can find the latest container image for K8sGPT in the packages of the GitHub organisation: [Link](https://github.com/k8sgpt-ai/k8sgpt/pkgs/container/k8sgpt)

A volume can then be mounted to the image through e.g. [Docker Compose](https://docs.docker.com/storage/volumes/).
Below is an example:

```bash
version: '2'
services:
k8sgpt:
image: ghcr.io/k8sgpt-ai/k8sgpt:dev-202304011623
volumes:
- /home/$(whoami)/.k8sgpt.yaml:/home/root/.k8sgpt.yaml
```

## Upgrading the brew installation

To upgrade the K8sGPT brew installation run the following command:

Expand Down
79 changes: 79 additions & 0 deletions docs/reference/cli/filters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Using Integration and Filters in K8sGPT

K8sGPT offers integration with other tools. Once an integration is added to K8sGPT, it is possible to use its resources as additional filters.

* Filters are a way of selecting which resources you wish to be part of your default analysis.
* Integrations are a way to add in additional resources to the filter list.


The first integration that has been added is Trivy.
[Trivy](https://github.com/aquasecurity/trivy) is an open source, cloud native security scnaner, maintained by Aqua Security.

Use the following command to access all K8sGPT CLI options related to integrations:
```bash
k8sgpt integrations
```

## Activating a new integration

**Prerequisites**

* Connected to a running Kubernetes cluster, any cluster will work for demonstration purposes

To list all integrations run the following command:
```bash
k8sgpt integrations list
```

This will provide you with a list of available integrations.

Activate the Trivy integration:
```bash
k8sgpt integration activate trivy
```

This will install the Trivy Kubernetes Operator into the Kubernetes cluster and make it possible for K8sGPT to interact with the results of the Operator.

Once the Trivy Operator is installed inside the cluster, K8sGPT will have access to VulnerabilityReports:
```bash
k8sgpt filters list

Active:
> VulnerabilityReport (integration)
Unused:
> Pod
> Deployment
> Service
> StatefulSet
> ReplicaSet
> PersistentVolumeClaim
> Ingress
> CronJob
> Node
> NetworkPolicy
> HorizontalPodAutoScaler
> PodDisruptionBudget
```

## Using the new filters to analyse your cluster

Any of the filters listed in the previous section can be used as part of the `k8sgpt analyse` command.

To use the `VulnerabilityReport` filter from the Trivy integration, set it through the `--filter` flag:
```bash
k8sgpt analyse --filter VulnerabilityReport
```

This command will analyse your cluster Vulnerabilities through K8sGPT. Depnding on the VulnerabilityReports available in your cluster, the result of the report will look different:
```bash
❯ k8sgpt analyse --filter VulnerabilityReport

0 demo/nginx-deployment-7bcfc88bbf(Deployment/nginx-deployment)
- Error: critical Vulnerability found ID: CVE-2023-23914 (learn more at: https://avd.aquasec.com/nvd/cve-2023-23914)
- 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-2023-23914 (learn more at: https://avd.aquasec.com/nvd/cve-2023-23914)
- 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)
```


3 changes: 3 additions & 0 deletions docs/reference/operator/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## K8sGPT Operator

TBD
3 changes: 3 additions & 0 deletions docs/tutorials/content-collection/content-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
This section provides a collection of vidoes, blog posts and more on K8sGPT, posted on external sites.

## Blogs
Have a look at the K8sGPT blog on the [website.](https://k8sgpt.ai/blog/)

Additionally, here are several talks created by the community:
* [K8sGPT: Simplifying Kubernetes Diagnostics with Natural Language Processing](https://www.kubetools.io/kubernetes/k8sgpt-simplifying-kubernetes-diagnostics-with-natural-language-processing/) by Karan Singh
* [Kubernetes + ChatGPT = K8sGpt](https://medium.com/@vijulpatel865/kubernetes-chatgpt-k8sgpt-a9199363dd38) by Vijul Patel
* [ChatGPT for your Kubernetes Cluster — k8sgpt](https://medium.com/techbeatly/chatgpt-for-your-kubernetes-cluster-k8sgpt-649f2cad1bd5) by Renjith Ravindranathan
* [Using the Trivy K8sGPT plugin](https://medium.com/techbeatly/k8sgpt-integration-with-aquasec-trivy-22f53c6730bb)

## Videos

Expand Down
6 changes: 5 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ nav:
- Overview: tutorials/index.md
- Content Collection: tutorials/content-collection/content-collection.md
- Reference:
- CLI: reference/cli/index.md
- CLI:
- Overview: reference/cli/index.md
- Integration and Filter: reference/cli/filters.md
- Operator:
- Overview: reference/operator/index.md
- Contributing Guidelines: reference/contributing/guidelines.md
- Privacy: reference/privacy/index.md
- Explanation: explanation/index.md
Expand Down

0 comments on commit 232f9ec

Please sign in to comment.