/kftray

kubect port-forward on steroids ๐Ÿš€ kftray makes it easy for you to manage and share multiple k8s port forwards right from your menu bar - built with rust ๐Ÿฆ€ and ts using tauri

Primary LanguageRustMIT LicenseMIT

Node.js version Tauri version React version Rust version downloads release= contributors
KFtray Demo

Download for macOS ยท Download for Windows ยท Download for Linux


What Is Kftray?

KFtray is a cross-platform system tray app made with Tauri (Rust and TypeScript) for Kubernetes users. It simplifies setting up multiple kubectl port forward configurations through a user-friendly interface. Easily store and manage all configurations from local files or GitHub repositories.

Table of Contents

๐Ÿš€ Features

  • Resilient Port Forwarding Connection: Ensures continuous service even if a pod dies, by reconnecting to another running pod automatically.
  • One-Click Multiple Port Forwards: Allows for the setup of several port forwarding instances at the same time with a single click.
  • Independent of Kubectl: Directly interfaces with the Kubernetes API, eliminating the need for kubectl.
  • Multi-Protocol Support: Enables access to internal or external servers through a Proxy Relay server deployed in a Kubernetes cluster, including TCP and UDP port forwarding.
  • Import Configs from Git: Store and import configurations directly from Git repositories with a few clicks.

๐Ÿ“ฆ Installation

Homebrew on macOS and Linux

Install kftray with ease using Homebrew by tapping into the custom repository. Run the following commands:

For Linux:

brew tap hcavarsan/kftray
brew install --HEAD kftray

For macOS:

brew tap hcavarsan/kftray
brew install --HEAD kftray

Please check the caveats section for global app creation instructions after installation.

Building from Source

Requirements
  • Node.js and pnpm or yarn for building the frontend.
  • Rust for building the backend.

To compile kftray, these steps should be followed:

  1. Clone the repository:
    git clone https://github.com/hcavarsan/kftray.git
  2. Navigate to the cloned directory:
    cd kftray
  3. Install dependencies:
    pnpm install
  4. Launch the application in development mode:
    pnpm run tauri dev

๐Ÿงญ Usage

Below is an intuitive guide to getting started with KFtray.

๐ŸŽ› Configure Port Forwards

Use the UI to add new port forward settings. Necessary details include:

  • Workload Type: Proxy or Service.
  • Alias: A unique name for the settings.
  • Context, Namespace, Service: As per Kubernetes configuration.
  • Remote Address: For Proxy type workload.
  • Protocol: TCP or UDP.
  • Local and Remote Ports: Endpoint details.
Create Service Configuration Screenshot

Create Service Configuration

โ–ถ๏ธ Activate Configurations

  • Single Configuration: Click to initiate a single port forward.
  • All Configurations: Start multiple port forward simultaneously.
Start Single Configuration Screenshot

Start Single Configuration

๐Ÿ—‚ Configuration Management

Manage and share port forward settings:

  • Export and Import: Quickly transfer configurations using JSON files.
  • Git Synchronization: Seamlessly fetch configurations from a Git repository.
  • Local Storage: Securely save configurations at $HOME/.kftray/configs.db.
  • Server Pod Manifest: Tailor the Proxy Relay server manifests stored at $HOME/.kftray/proxy_manifest.json.

Configuration JSON Sample

Below is an example of an exported JSON configuration:

[
  {
    "alias": "consul-ui",
    "context": "kind-7",
    "local_port": 8500,
    "namespace": "consul",
    "protocol": "tcp",
    "remote_port": 8500,
    "service": "consul-ui",
    "workload_type": "service"
  },
  {
    "alias": "redis-gcp",
    "context": "kind-6",
    "local_port": 26379,
    "namespace": "default",
    "protocol": "udp",
    "remote_address": "redis-prod.gcp.internal",
    "remote_port": 6379,
    "workload_type": "proxy"
  }
]

๐Ÿ— Architecture

Server

KFtray Server is a Rust application that relays UDP/TCP traffic to an upstream server. Check the source code here.

Forwarding Flows

  • TCP Forwarding: A local TCP socket, similar to kubectl, can be used to communicate with a Kubernetes pod. This approach offers parallel execution and improved resilience.
sequenceDiagram
Application->>Kubernetes Pod: Opens TCP socket, starts port-forwarding
Kubernetes Pod-->>Application: Responds with TCP Packet
Loading
  • Proxy TCP Forwarding: The local TCP connects to the kftray-server pod, which then sends TCP packet to the upstream server.
sequenceDiagram
Application->>Kubernetes Pod: Socket to kftray-server, facilitates TCP relay
Kubernetes Pod->>Remote Service: Relays TCP Packet
Remote Service-->>Kubernetes Pod: Responds
Kubernetes Pod-->>Application: Returns TCP Packet
Loading
  • UDP Forwarding: The KFtray client opens a local UDP socket and connects a local TCP socket to the kftray-server pod. The TCP socket sends UDP packets over TCP, which are then forwarded to the upstream server.
sequenceDiagram
Application->>Kubernetes Pod: UDP socket, TCP port-forward to kftray-server
Kubernetes Pod->>Service/Remote: Converts to UDP, sends packet
Service/Remote-->>Kubernetes Pod: Responds with UDP Packet
Kubernetes Pod-->>Application: Relays as TCP
Loading

๐Ÿ‘ฅ Contributing

  • ๐Ÿ›  Pull Requests: Feel free to create pull requests for bug fixes, new features, or improvements.
  • ๐Ÿ“ Issues: Report bugs, suggest new features, or ask questions.
  • ๐Ÿ’ก Feedback: Your feedback helps improve kftray.

๐Ÿ“„ License

KFtray is available under the MIT License, which is included in the repository. See the LICENSE file for full details.

Stargazers over time

Stargazers over time

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

Henrique Cavarsan
Henrique Cavarsan

๐Ÿ’ป
Filipe Andujar
Filipe Andujar

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!