DEV Community

Cover image for Managing multiple kubectl port-forward configurations and sharing them via Git 📦
Henrique Cavarsan
Henrique Cavarsan

Posted on

Managing multiple kubectl port-forward configurations and sharing them via Git 📦

kubectl port-forward is an invaluable tool for developers working with Kubernetes, allowing for the exposure of local services through a tunnel. However, as the number of services grows, this manual method can become cumbersome. Common issues like terminal lock-up, tunnels lost after pod termination, and lack of support for UDP services can occur.

Introducing Kftray

To overcome these challenges, we created Kftray, a graphic interface application developed with Rust and TypeScript using the Tauri framework. Kftray offers a more efficient way to manage port-forward tunnels in a Kubernetes environment.

Kftray Demo

Key Features

  • Configuration Management: Easily add, start, and stop multiple port-forward configurations.

  • Autocomplete: Reduces the need to remember complex commands thanks to an autocomplete feature.

Add Configs

  • Configuration Export: Export your settings to a JSON file and keep a backup for quick restorations.

Json Example:

[
  {
    "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"
  }
]
Enter fullscreen mode Exit fullscreen mode

Solutions for Common Issues

  • Terminals Don't Get Locked: Kftray operates independently of kubectl and won't lock up terminals. An internal relay server allows UDP services to be port-forwarded over TCP.
  • Pod Failure Resilience: The application redirects traffic to new pods when the old ones fail, providing continuous connection.
  • Access to Non-Kubernetes Internal Services: Kftray can direct TCP traffic even for internal services not hosted on the Kubernetes cluster.

Git Sync Plus

The latest version of Kftray v0.7.1 introduces a new feature: synchronizing configurations with a GitHub repository. As soon as updates are made to the JSON configuration file, just one click is needed for Kftray to apply them.

Github Sync

Getting Started with Kftray

To try out Kftray, visit our GitHub repository and follow the instructions for downloading and installation: Github Kftray

Contributions Are Welcome

We invite the community to collaborate on the Kftray project. If you find bugs or have ideas for new features, feel free to contribute. Your participation is crucial for making Kftray even better! Github Kftray

we plan to release updates with new features like pooling for synchronization and the ability to add multiple configuration repositories. That's all for now! I hope you find Kftray helpful! 🚀🎉

If you do, please consider giving us a star on GitHub at Kftray. It really helps us! 🌟

Top comments (0)