Skip to main content

K2I Deployment Guide

K2I 0.2.0 is production-oriented, not production-complete. Before broad rollout, validate your exact Kafka cluster, Iceberg catalog, object store, Schema Registry behavior, recovery expectations, and maintenance workflow.

See Production Readiness for the current verification status and hardening follow-ups.

Deployment Stance​

Recommended first-release model:

  • Run one K2I process for one configured Kafka topic and one configured Iceberg table.
  • Persist transaction_log.log_dir on durable storage.
  • Use the REST catalog path first if you want the same path covered by local Docker E2E.
  • Use /healthz for liveness and /readyz for readiness.
  • Run the Docker Iceberg E2E and load profile before promoting a build.
  • Keep table maintenance explicit until scheduler wiring is reviewed for your deployment.

Avoid multiple active K2I writers to the same table until conflict handling, recovery, and multi-partition offset behavior have been validated with your workload.

Build And Package​

Build from source:

git clone https://github.com/osodevops/k2i.git
cd k2i
cargo build --release
./target/release/k2i --version

Use released binaries from GitHub Releases when publishing a versioned deployment. Version-tag pushes also publish Docker images to GitHub Container Registry.

docker pull ghcr.io/osodevops/k2i:v0.2.0

Required Persistent State​

K2I writes operational state to the configured transaction log directory:

[transaction_log]
log_dir = "/var/lib/k2i/txlog"

Treat this directory as durable state. Do not place it on ephemeral Kubernetes emptyDir, a Docker tmpfs, or a local scratch disk that can disappear across restarts.

Docker​

Mount the config read-only and the transaction log as a named volume:

docker run -d \
--name k2i \
-p 8080:8080 \
-p 9090:9090 \
-v "$PWD/config.toml:/etc/k2i/config.toml:ro" \
-v k2i-txlog:/var/lib/k2i/txlog \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-e AWS_REGION \
ghcr.io/osodevops/k2i:v0.2.0 \
ingest --config /etc/k2i/config.toml

Minimal Compose service:

services:
k2i:
image: ghcr.io/osodevops/k2i:v0.2.0
command: ["ingest", "--config", "/etc/k2i/config.toml"]
ports:
- "8080:8080"
- "9090:9090"
volumes:
- ./config.toml:/etc/k2i/config.toml:ro
- k2i-txlog:/var/lib/k2i/txlog
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_REGION: ${AWS_REGION}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
interval: 30s
timeout: 5s
retries: 3

volumes:
k2i-txlog:

Kubernetes​

Use a single replica first, with a persistent volume for the transaction log:

apiVersion: apps/v1
kind: Deployment
metadata:
name: k2i
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: k2i
template:
metadata:
labels:
app: k2i
spec:
containers:
- name: k2i
image: ghcr.io/osodevops/k2i:v0.2.0
args: ["ingest", "--config", "/etc/k2i/config.toml"]
ports:
- containerPort: 8080
name: health
- containerPort: 9090
name: metrics
readinessProbe:
httpGet:
path: /readyz
port: health
livenessProbe:
httpGet:
path: /healthz
port: health
volumeMounts:
- name: config
mountPath: /etc/k2i
readOnly: true
- name: txlog
mountPath: /var/lib/k2i/txlog
volumes:
- name: config
configMap:
name: k2i-config
- name: txlog
persistentVolumeClaim:
claimName: k2i-txlog

The config should set:

[transaction_log]
log_dir = "/var/lib/k2i/txlog"

Use Kubernetes Secrets, cloud workload identity, or an external secrets operator for Kafka and object-store credentials. Do not store credentials directly in a ConfigMap.

Systemd​

Example unit:

[Unit]
Description=K2I Kafka to Iceberg ingestion
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=k2i
Group=k2i
ExecStart=/usr/local/bin/k2i ingest --config /etc/k2i/config.toml
Restart=on-failure
RestartSec=10
EnvironmentFile=-/etc/k2i/k2i.env
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

Create durable state before starting:

sudo useradd --system --home /var/lib/k2i --shell /usr/sbin/nologin k2i
sudo mkdir -p /etc/k2i /var/lib/k2i/txlog
sudo chown -R k2i:k2i /var/lib/k2i

Health And Readiness​

EndpointUseBehavior
/healthFull JSON statusIncludes component-level health
/healthzLivenessStays 200 for degraded but operational states
/readyzReadinessReturns 503 for schema pauses and other blockers
/metricsPrometheusExposed on the configured metrics port

A breaking Protobuf schema change should block readiness before offsets are advanced past incompatible data. Operators should resolve the schema issue or apply an explicit recovery plan.

Monitoring​

Start with these Prometheus checks:

scrape_configs:
- job_name: k2i
static_configs:
- targets: ["k2i:9090"]
metrics_path: /metrics

Alert on:

  • K2I process down.
  • /readyz returning 503.
  • Non-zero k2i_errors_total rate.
  • Buffer size approaching configured capacity.
  • Flush duration exceeding Kafka poll and session timing assumptions.
  • Iceberg commit failures.

Maintenance​

The CLI exposes manual maintenance commands:

k2i maintenance compact --config config.toml
k2i maintenance expire-snapshots --config config.toml
k2i maintenance clean-orphans --config config.toml

For the first release, validate maintenance behavior against your exact catalog and object store before scheduling it unattended. It is also valid to run Iceberg table maintenance from a separate, established engine such as Spark or Trino if that is already your platform standard.

Pre-Promotion Checklist​

Run these checks before promoting a build:

scripts/e2e-docker.sh
K2I_E2E_LOAD_MESSAGES=100000 scripts/e2e-docker-load.sh
scripts/e2e-docker-iceberg.sh
K2I_E2E_LOAD_MESSAGES=100000 scripts/e2e-docker-iceberg-load.sh

Then validate your own environment:

  • Kafka authentication and topic permissions.
  • Schema Registry compatibility behavior.
  • Target Iceberg catalog commit path.
  • Object-store credentials and path-style/endpoint settings.
  • Transaction-log persistence across restart.
  • Readiness behavior after a deliberate incompatible schema in staging.
  • Query engine visibility through DuckDB, Trino, Spark, or your production engine.

Upgrade Procedure​

  1. Stop K2I gracefully.
  2. Back up the transaction log directory.
  3. Replace the binary or container image.
  4. Start K2I.
  5. Check /health, /readyz, /metrics, and downstream table visibility.
k2i status --url http://localhost:8080
curl -s http://localhost:8080/readyz
curl -s http://localhost:9090/metrics | grep k2i