# K2K Standalone Tool

The K2K Tool (`k2k-tool`) is an administration tool for managing K2K committed offsets.\
It provides a CLI and a web interface for managing K2K committed offsets.

The K2K is bundled in the same container as K2K, so it is available in any K2K deployment.

{% hint style="danger" %}
Warning: Setting offsets should only be used when the K2K application has been stopped.&#x20;

If the K2K application is running, the offset reset might not be applied as the application will continue to commit offsets, potentially overwriting the reset operation.
{% endhint %}

#### Pipeline Definition Files

The YAML definition used by `k2k-tool` is a **subset** of the full K2K YAML configuration format.&#x20;

This means the same configuration file used for running K2K can be used with `k2k-tool`. \
The tool will only read the fields it needs and ignore the rest.&#x20;

You can mount the same file used by K2K and expect it to work without modification.

The following configuration objects are required in the YAML configuration for `k2k-tool` to function:

* `name`
* `source.kafka`
* `target.kafka`
* `replication`&#x20;

### K2K CLI Commands

<table><thead><tr><th width="158.1666259765625">command</th><th>description</th></tr></thead><tbody><tr><td><code>server</code></td><td>Start the K2K-Tool web app. Starts an HTTP server that provides a web interface and API endpoints for managing K2K pipelines. </td></tr><tr><td><code>describe</code></td><td>Describes the current state of the consumer group(s) present in the K2K pipeline definition file(s).</td></tr><tr><td><code>set</code></td><td>Sets the committed offset(s) for a consumer group to a specific value. </td></tr><tr><td><code>reset</code></td><td>Sets all committed offsets for a consumer group to the earliest value.</td></tr></tbody></table>

#### **Examples:**

```bash
# Start server with a single pipeline file
k2k-tool server -f /path/to/pipeline.k2k.yml

# Start server watching a directory
k2k-tool server -d /pipelines

# Start server with a pipeline defined over multiple files and custom port
k2k-tool server -f /path/to/pipeline1.k2k.yml,/path/to/pipeline2.k2k.yml -p 9090

# Describe consumer groups from a single pipeline file
k2k-tool describe -f /path/to/pipeline.k2k.yml

# Set offset for a specific topic, partition, and offset
k2k-tool set -f /path/to/pipeline.k2k.yml -o "my-topic:0:100"

# Set offset for all partitions of a topic
k2k-tool set -f /path/to/pipeline.k2k.yml -o "my-topic:*:100"

# Reset offsets to earliest for a pipeline
k2k-tool reset -f /path/to/pipeline.k2k.yml
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenses.io/latest/k2k/k2k-standalone-tool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
