Member-only story
Kubernetes Development Tricks
Beyond the Basics: Mastering Kubernetes Port-Forwarding for Seamless Development
Advanced Techniques to Keep Services Accessible
Table of Contents
1. Using & to Run in Background
2. Using nohup to Run Without a Hangup
3. Using screen or tmux for Session Management
4. Using systemd or a Similar Service Manager
5. Usinging an entrypoint script in a Pod
6. Using a third-party tool
7. Using Kubernetes networking objects
In Kubernetes, kubectl port-forward is a command designed for use during development, debugging, and troubleshooting, and it’s not meant to be used as a permanent solution for exposing services. For production use, Kubernetes offers several other options to expose a service, such as using a LoadBalancer, NodePort, or Ingress.
When kubectl port-forward is used, it usually requires for us to keep the terminal open, in order for the port forwarding to work. This article will explain how can we avoid that.