Configuration Guide

Learn how to configure KFtray and KFtui for optimal use in your environment.

Shared Configuration

KFtray and KFtui share the same configuration database and state management. Changes made in one interface are immediately reflected in the other.

Configuration File Format

kftray use a JSON configuration format:

{
  "service": "my-service",
  "namespace": "default",
  "local_port": 8080,
  "remote_port": 80,
  "context": "my-cluster",
  "workload_type": "service",
  "protocol": "tcp",
  "alias": "my-service",
  "domain_enabled": false
}

Configuration Fields

  • service: Target service or pod name
  • namespace: Kubernetes namespace
  • local_port: Port on your local machine
  • remote_port: Port on the target service
  • context: Kubernetes context name
  • workload_type: "service" or "pod"
  • protocol: "tcp" or "udp"
  • alias: Friendly name for the forward
  • domain_enabled: Enable local domain name

Environment Variables

Common Variables

# Kubeconfig path
export KUBECONFIG=~/.kube/config


# Custom configuration directory
export KFTRAY_CONFIG_DIR=~/.config/kftray

Configuration Storage

Shared Storage

  • Database: ~/.kftray/kftray.db
  • Logs: ~/.kftray/app.log
  • Http Logs: ~/.kftray/http_logs/
Both interfaces access the same storage locations, ensuring configuration consistency across interfaces.

GitHub Storage (KFtray only)

  1. Create repository
  2. Add configuration file
  3. Configure GitHub sync
  4. Set polling interval

Configuration Examples

Web Application

{
  "service": "frontend",
  "namespace": "web",
  "local_port": 3000,
  "remote_port": 80,
  "protocol": "tcp",
  "alias": "web-app"
}

Database

{
  "service": "postgres",
  "namespace": "db",
  "local_port": 5432,
  "remote_port": 5432,
  "protocol": "tcp",
  "alias": "database"
}

Process Management

Important considerations:
  • Port forwards must be stopped from the same interface that started them
  • Status is synchronized between interfaces
  • Configuration changes affect both interfaces
  • Process handling is interface-specific

Best Practices

  • Use meaningful aliases
  • Group related services
  • Document port assignments
  • Regular configuration backups
  • Monitor resource usage