This tool will help you to do bulk port mappings using kubectl command which is installed and configured in your machine. This tool expects configured kubectl tool in your machine prior to using this tool.
- Checkout the code from github
- Then run
make
to compile the tool - Copy the
kpm
binary in the source folder to a desired location and add toPATH
variable
Note: More information will be added how to compile on different platforms later.
- Define different port mapping configurations as defined under First time use.
- Supports command auto completions.
- Start port mapping for several services on a namespace with a single command.
- When pods get restarts, resume the port forwarding by retrying for 10 times before giving up.
- The first 5 retries are done with 1 second delay.
- The rest of the 5 retries are done with 30 seconds delay.
Flag | Description |
---|---|
-h | Print usage help |
-l | Print configured profile names |
-p <profile> | Use the provided profile name |
-complete | Install bash |
-uncomplete | Uninstall bash |
When running for the first time kpm
with no-arguments it will create a empty configuration file at ~/.kpm/config.json
with following content
{
"profiles": [
{
"name": "default",
"config": {
"namespace": "default",
"entries": [
{
"serviceName": "svc/changeme",
"servicePort": 80,
"localPort": 8080
}
]
}
}
]
}
You can then change this file to define your own profiles you want to manage.
Property | Description |
---|---|
profiles[].name | Name of the profile |
profiles[].config.namespace | The kubernetes namespace |
profiles[].config.entries[].serviceName | The kubernetes service name |
profiles[].config.entries[].servicePort | The kubernetes service port |
profiles[].config.entries[].localPort | The local port which you want to bind the service port to |