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.
- 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.
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.
- Node.js and pnpm or yarn for building the frontend.
- Rust for building the backend.
To compile kftray
, these steps should be followed:
- Clone the repository:
git clone https://github.com/hcavarsan/kftray.git
- Navigate to the cloned directory:
cd kftray
- Install dependencies:
pnpm install
- Launch the application in development mode:
pnpm run tauri dev
Below is an intuitive guide to getting started with KFtray.
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.
- Single Configuration: Click to initiate a single port forward.
- All Configurations: Start multiple port forward simultaneously.
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
.
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"
}
]
KFtray Server is a Rust application that relays UDP/TCP traffic to an upstream server. Check the source code here.
- 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
- 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
- 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
- π 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.
KFtray is available under the MIT License, which is included in the repository. See the LICENSE file for full details.