Before contributing to this tool, ensure that you have the following prerequisites installed:
- Go programming language (https://golang.org/dl/)
- Kubernetes client Go library (
go get k8s.io/client-go@v0.24.0
)
You can always download the latest binaries from the release page
sudo tee -a /etc/yum.repos.d/artifact-registry.repo << EOF
[kapeta-production-yum]
name=kapeta-production-yum
baseurl=https://europe-north1-yum.pkg.dev/projects/kapeta-production/kapeta-production-yum
enabled=1
repo_gpgcheck=0
gpgcheck=0
EOF
Then update the package list and install the tool:
sudo dnf update
sudo dnf install portpilot
-
Clone the repository and install the tool using
go install
. -
Create a YAML file named
.portpilot.yaml
. The YAML file should contain the configuration for the services you want to port forward. Below is an example of the YAML file structure:services: - name: example-service1 remotePort: 8080 localPort: 8081 - name: example-service2 remotePort: 8888 localPort: 8889
Customize the
name
,remotePort
, andlocalPort
fields for each service as needed. -
Open a terminal and navigate to the directory containing the
services.yaml
file. -
Build and run the tool using the following command:
portpilot
The tool will read the
services.yaml
file, establish port forwarding connections to the specified services, and print the local URLs for accessing each service. -
To stop the port forwarding, press
Ctrl+C
in the terminal.
- The Kubernetes configuration is automatically read from the default
kubeconfig
file location ($HOME/.kube/config
). Make sure you have a validkubeconfig
file configured for your cluster. - The tool uses the Kubernetes client Go library to interact with the cluster and perform the port forwarding.
- The tool assumes the Kubernetes cluster is reachable using the default
kubeconfig
configuration. - Only the first matching pod is used for each service. If multiple pods match the service selector, only the first pod will be used for port forwarding.
This tool is licensed under the MIT License.