🦀⚡ kubectl port-forward on steroids - manage and share multiple k8s port forwards from the menu bar
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.
Learn More: Blog Post - Kubernetes Debugging with KFtray
Demo: GitHub Sync | Demo: Adding a New Configuration |
kubectl
.KFtray is available for macOS and Linux users via Homebrew, and directly from the GitHub releases page for other systems. Here's how you can get started:
For macOS
brew tap hcavarsan/kftray
brew install --HEAD kftray
For Linux
brew tap hcavarsan/kftray
brew install kftray-linux
Please check the caveats section for global app creation instructions after installation.
Linux Note: due to GTK limitations, it is necessary to install and enable the GNOME Shell extension for AppIndicator support to kftray works. See here: https://extensions.gnome.org/extension/615/appindicator-support/
For other systems, visit the GitHub releases page for downloadable binaries.
In a few simple steps, you can configure your first port forward:
Launch the application
Open the configuration panel from the tray icon
Add a new configuration:
Activate Your Configuration: With your configuration saved, simply click on the switch button in the main menu to start the port forward in a single por forward or in Start All to start all configurations at the same time
Note: To use the alias feature with a local domain name, you must enable write permissions in the hosts file. This method is not secure. We are addressing this in the following issue: https://github.com/hcavarsan/kftray/issues/171. Follow these steps to allow write access:
For Windows:
icacls "C:\Windows\System32\drivers\etc\hosts" /grant Everyone:(R,W)
For MacOS and Linux:
sudo chmod ugo+rw /etc/hosts
Export Local File
optionYou can then import this JSON file at any time to restore your configurations.
Example Json configuration File:
[
{
"service": "argocd-server",
"namespace": "argocd",
"local_port": 8888,
"remote_port": 8080,
"context": "test-cluster",
"workload_type": "service",
"protocol": "tcp",
"remote_address": "",
"local_address": "127.0.0.1",
"alias": "argocd",
"domain_enabled": true
}
]
now, with the local json saved, you can share your configurations with your team members by committing the JSON file to a Github repository. This allows for easy collaboration and synchronization of KFtray configurations across your team.
To import and sync your github configs in kftray:
Open the application's main menu
Select the button with github icon in the footer menu
Enter the URL of your Git repository and path containing the JSON file
If your GitHub repository is private, you will need to enter the private token. Credentials are securely saved in the SO keyring (Keychain on macOS). Kftray does not store or save credentials in any local file; they are only stored in the local keyring.
Select the polling time for when Kftray will synchronize configurations and retrieve them from GitHub.
KFtray will now sync with the Git repository to automatically import any new configurations or changes committed to the JSON file.
This allows you to quickly deploy any port forward changes to all team members. And if someone on your team adds a new configuration, it will be automatically synced to everyone else's KFtray.
To compile kftray
, these steps should be followed:
git clone https://github.com/hcavarsan/kftray.git
cd kftray
pnpm install
pnpm run tauri dev
KFtray Server is a Rust application that relays UDP/TCP traffic to an upstream server. Check the source code here.
sequenceDiagram
Application->>Kubernetes Pod: Opens TCP socket, starts port-forwarding
Kubernetes Pod-->>Application: Responds with TCP Packet
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
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
KFtray is available under the MIT License, which is included in the repository. See the LICENSE file for full details.
Thanks goes to these wonderful people (emoji key):
Henrique Cavarsan 💻 |
Filipe Andujar 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!