# K9s 🐶 Integration

Gonzo integrates seamlessly with [k9s](https://github.com/derailed/k9s) (via the k9s plugin framework) to provide real-time log analysis with visual charts, AI-powered pattern detection, and severity tracking — all in the same familiar terminal UI you already use for cluster management. Instead of just scrolling through text, you get instant insights into error spikes, word frequencies, and anomalies.

### Plugin Configuration

Add this to your `$XDG_CONFIG_HOME/k9s/plugins.yaml` file:

```yaml
plugins:
  gonzo:
    shortCut: Ctrl-L
    description: "Gonzo log analysis"
    scopes:
      - po
    command: sh
    background: false
    args:
      - -c
      - "kubectl logs -f --tail=0 $NAME -n $NAMESPACE --context $CONTEXT | gonzo"
```

> **Note for macOS users:** Although not required, defining `XDG_CONFIG_HOME=~/.config` is recommended to maintain consistency with Linux configuration practices.

### Usage

1. Launch k9s and navigate to pods (`:pods` or `:po`)
2. Select a pod
3. Press `Ctrl-L`
4. Gonzo opens with live log streaming and analysis

### Available k9s Variables

The following environment variables are available in k9s plugins:

* `$NAME` - Pod name
* `$NAMESPACE` - Pod namespace
* `$CONTEXT` - Current cluster context
* `$CLUSTER` - Cluster name

### Verify Plugin Location

Check where k9s expects your plugins file:

```bash
k9s info
```

Look for the `Plugins:` line in the output.
