Skip to content

manage and run multiple kubectl port-forward configurations directly in the menu bar, syncing configurations with git repositories.

License

Notifications You must be signed in to change notification settings

rustdev3847/kftray

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


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

About

manage and run multiple kubectl port-forward configurations directly in the menu bar, syncing configurations with git repositories.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 48.0%
  • TypeScript 47.8%
  • JavaScript 1.9%
  • Shell 1.1%
  • CSS 0.8%
  • Dockerfile 0.2%
  • HTML 0.2%