> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/k2k/configuration-reference/security-and-permissions.md).

# Security and permissions

Network paths, ACLs, and permissions required by K2K.

K2K uses standard Kafka and Schema Registry clients. Security configuration follows the same properties as any other Kafka application — see [Kafka connectivity and authentication](https://docs.lenses.io/latest/k2k/configuration-reference/kafka-connectivity-authentication.md) and [Secrets and templates](https://docs.lenses.io/latest/k2k/configuration-reference/secrets-and-templates.md).

This page summarizes the network paths and permissions K2K needs on each cluster.

## Network paths

| Direction                  | From              | To                                | Purpose                                                       |
| -------------------------- | ----------------- | --------------------------------- | ------------------------------------------------------------- |
| Source read                | K2K replicator    | Source Kafka bootstrap servers    | Consume replicated topics                                     |
| Target write               | K2K replicator    | Target Kafka bootstrap servers    | Produce replicated records and control messages               |
| Offset mapping (source)    | K2K offset mapper | Source Kafka bootstrap servers    | List consumer groups and read committed offsets via admin API |
| Offset mapping (target)    | K2K offset mapper | Target Kafka bootstrap servers    | Read offset mapping control topic; commit translated offsets  |
| Schema Registry (optional) | K2K replicator    | Source and target Schema Registry | Schema migration when enabled                                 |

Deploy the replicator close to the **target** cluster to minimize producer latency. See [Deployment](https://docs.lenses.io/latest/k2k/deployment.md#deployment-recommendation).

## Source Kafka cluster permissions

The replicator needs:

| Operation                 | Client   | Used for                           |
| ------------------------- | -------- | ---------------------------------- |
| READ on replicated topics | Consumer | Reading records for replication    |
| DESCRIBE on topics        | Admin    | Topic validation and metadata      |
| JOIN consumer group       | Consumer | Partition assignment via K2K group |

The offset mapper needs (when offset mapping is enabled):

| Operation                       | Client | Used for                     |
| ------------------------------- | ------ | ---------------------------- |
| DESCRIBE / LIST consumer groups | Admin  | Discover groups to translate |
| READ committed offsets          | Admin  | Read source group positions  |

K2K does not commit offsets on the source Kafka cluster.

## Target Kafka cluster permissions

The replicator needs:

| Operation                                           | Client   | Used for                                                                                                                     |
| --------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| WRITE on replicated topics                          | Producer | Publishing replicated records                                                                                                |
| WRITE on control topics                             | Producer | Commits, offset mappings, coordination, metrics                                                                              |
| READ on control topics                              | Consumer | Assignment and progress tracking                                                                                             |
| CREATE / ALTER topics (optional)                    | Admin    | [Topic creation](https://docs.lenses.io/latest/k2k/configuration-reference/topic-creation.md) and control topic provisioning |
| INIT\_PRODUCE\_ID / transactional writes (optional) | Producer | [Exactly once delivery](https://docs.lenses.io/latest/k2k/configuration-reference/exactly-once-delivery.md)                  |

The offset mapper needs:

| Operation                            | Client   | Used for                                   |
| ------------------------------------ | -------- | ------------------------------------------ |
| READ on offset mapping control topic | Consumer | Read mappings recorded by replicator       |
| ALTER consumer group offsets         | Admin    | Commit translated offsets on target groups |

## Control topics

Control topics live on the target Kafka cluster. They are created automatically when `features.autoCreateControlTopics` is enabled, or must be provisioned manually. Grant the K2K service principal CREATE and WRITE on the target cluster, or pre-create topics with the expected names from [Topic creation](https://docs.lenses.io/latest/k2k/configuration-reference/topic-creation.md).

Do not grant application consumers access to control topics. They contain internal coordination data, not application payloads.

## Schema Registry permissions

When [schema migration](https://docs.lenses.io/latest/k2k/configuration-reference/schema-migration.md) is enabled, the replicator needs read access to subjects on the source registry and write access on the target registry. Authentication uses the same mechanisms as Kafka — see [Schema Registry connectivity and authentication](https://docs.lenses.io/latest/k2k/configuration-reference/schema-registry-connectivity-authentication.md).

## Secrets management

Keep license tokens, SASL credentials, and TLS keystores out of source control. Use [Secrets and templates](https://docs.lenses.io/latest/k2k/configuration-reference/secrets-and-templates.md) to inject values at deploy time from environment variables, mounted files, or your secrets manager.

## Validation

After configuring security, run through the [Validation checklist](https://docs.lenses.io/latest/k2k/runbooks/validation-checklist.md) and enable [Startup validation](https://docs.lenses.io/latest/k2k/configuration-reference/startup-validation.md) probes before production traffic.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lenses.io/latest/k2k/configuration-reference/security-and-permissions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
