https://github.com/sapcc/with-kubectl-port-forward
Execute "kubectl port-forward" for the duration of another command
https://github.com/sapcc/with-kubectl-port-forward
Last synced: about 1 year ago
JSON representation
Execute "kubectl port-forward" for the duration of another command
- Host: GitHub
- URL: https://github.com/sapcc/with-kubectl-port-forward
- Owner: sapcc
- License: apache-2.0
- Created: 2024-01-16T14:26:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T04:36:22.000Z (about 1 year ago)
- Last Synced: 2025-04-11T05:34:51.034Z (about 1 year ago)
- Language: Makefile
- Size: 122 KB
- Stars: 6
- Watchers: 45
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# with-kubectl-port-forward
As the name implies, this tool executes `kubectl port-forward` for the duration
of the supplied command. For example, Keppel has a PostgreSQL database that can
be reached passwordless on localhost, so the following works to log into the DB:
```
$ with-kubectl-port-forward service/keppel-postgresql 5432:5432 -- psql -U postgres -d keppel -h 127.0.0.1 -p 5432
```
This is the same as:
1. running `kubectl port-forward service/keppel-postgresql 5432:5432` in one shell
2. running `psql -U postgres -d keppel -h 127.0.0.1 -p 5432` in another shell
3. terminating kubectl once psql is done
## Installation
Clone the repo, then run `make install` in it.
## Usage
```
$ with-kubectl-port-forward ... -- ...
```
The exit status will be zero on success, or equivalent to the exit status of
the first failing child otherwise.