For the complete documentation index, see llms.txt. This page is also available as Markdown.

Architecture

How K2K applications, Kafka clients, and pipeline configuration fit together.

K2K connects a source Kafka cluster to a target Kafka cluster. The replicator copies records from source to target. When offset mapping is enabled, a second application — the offset mapper — translates consumer group positions so applications can continue on the target without reprocessing. A single YAML pipeline file describes the whole deployment — cluster connections, what to replicate, and which features to enable. Both applications read that same file; each uses the sections it needs and ignores the rest.

K2K architecture showing source and target Kafka clusters connected by the Lenses K2K replicator

Applications

K2K ships as two applications:

Application
Command
Role

K2K replicator

k2k start

Reads records from the source Kafka cluster and writes them to the target Kafka cluster. Handles schema migration, topic creation, exactly once delivery, and other replication features configured in the pipeline.

K2K offset mapper

k2k-offset-mapping start

Translates consumer group positions from the source Kafka cluster to the target Kafka cluster using offset mappings recorded by the replicator. Required whenever offset mapping is enabled.

The replicator is required for every pipeline. When offset mapping is enabled, deploy both applications and keep both running. See Deployment for when to deploy each application.

Kafka clients

Each application is built from standard Kafka clients — consumers, producers, and admin clients — configured through the pipeline file. K2K does not embed cluster-specific logic beyond what these clients provide; connection settings use the same properties as any other Kafka application.

Properties are declared under source.kafka and target.kafka. A common block on each side holds settings shared by every client on that side (bootstrap servers, security, TLS). Client-specific blocks (consumer, producer, admin) add or override properties for that client only.

Replicator

Client
Purpose

Source consumer

Reads records from replicated topics. Joins a consumer group on the source Kafka cluster so multiple instances can share partition assignment.

Source admin

Describes topics, validates cluster state, and supports topic auto-creation on the source Kafka cluster when configured.

Target producer

Writes replicated records and control messages (offset mappings, commits, coordination). Uses transactional writes when exactly once is enabled.

Target consumer

Reads control topics on the target Kafka cluster (assignment, commit progress, coordination).

Target admin

Creates topics, validates control topics, and supports exactly once fencing.

When schema migration is enabled, the replicator also connects to Schema Registry on each side through source.registry and target.registry. See Schema Registry connectivity.

Offset mapper

Client
Purpose

Source admin

Lists consumer groups and reads committed offsets through the admin API (without reading __consumer_offsets directly).

Target consumer

Reads the offset mapping control topic written by the replicator.

Target admin

Commits translated offsets to consumer groups on the target Kafka cluster.

The offset mapper does not run a source consumer or a target producer for replication. It uses admin and consumer clients only.

Pipeline configuration

The pipeline file is the single configuration surface for both applications. At a high level it declares:

Area
Purpose

name

Unique pipeline identifier

license

License token and EULA acceptance

source

Connection to the source Kafka cluster and optional Schema Registry

target

Connection to the target Kafka cluster and optional Schema Registry

replication

Source and sink stages that define which topics to replicate and how records are routed

features

Feature toggles (exactly once, offset mapping, schema migration, and others)

groups

Consumer groups to translate (offset mapper)

coordination

Control topic names and commit settings

One pipeline file can be split across multiple YAML files at startup. Later files override earlier ones for the same keys, which lets you keep secrets in a separate overlay. See Minimal Configuration.

Connection details are configured under nested blocks:

Both applications are started with the same file:

For Kafka connection and authentication settings, see Kafka connectivity and authentication. For command-line options, see Deployment.

Topic
Guide

Deploying applications

Minimal pipeline example

Consumer group on the source Kafka cluster

Offset translation

Glossary of terms

Last updated

Was this helpful?