mirror of
https://github.com/wahyd4/kt-connect.git
synced 2026-08-09 05:16:02 +10:00
feat: support expose port mapping
This commit is contained in:
@@ -93,6 +93,11 @@ SSH Remote port-forward for POD starting
|
||||
2019/06/19 11:19:14 ssh remote port-forward start at pid: 3567
|
||||
```
|
||||
|
||||
```
|
||||
tips:
|
||||
if your remote port diffrent local port, you can user ${remotePort}:{localPort} set expose parameter
|
||||
```
|
||||
|
||||
Access local tomcat by internal service DNS address:
|
||||
|
||||
> Note: if `kubectl connect` not running, you can only access from cluster
|
||||
|
||||
@@ -54,7 +54,14 @@ func remotePortForward(expose string, kubeconfig string, namespace string, targe
|
||||
|
||||
time.Sleep(time.Duration(2) * time.Second)
|
||||
log.Printf("SSH Remote port-forward POD %s 22 to 127.0.0.1:%d starting\n", remoteIP, localSSHPort)
|
||||
cmd := util.SSHRemotePortForward(expose, "127.0.0.1", expose, localSSHPort)
|
||||
localPort := expose
|
||||
remotePort := expose
|
||||
ports := strings.SplitN(expose, ":", 2)
|
||||
if len(ports) > 1 {
|
||||
localPort = ports[1]
|
||||
remotePort = ports[0]
|
||||
}
|
||||
cmd := util.SSHRemotePortForward(localPort, "127.0.0.1", remotePort, localSSHPort)
|
||||
return util.BackgroundRun(cmd, "ssh remote port-forward", debug)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user