-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Francois Laupretre
committed
Jul 21, 2023
1 parent
2f02ce0
commit fb78001
Showing
5 changed files
with
138 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# K8S kubectl port forwarding | ||
# | ||
# Parameters : | ||
# GATEWAY_HOST: a string usable as port forwarding target (pod/xxx, service/xxx, deployment/xxx...) | ||
# KUBECTL_CMD: Alternate command to run kubectl (default: 'kubectl') | ||
# KUBECTL_CONTEXT: Context name (as defined in kubectl config file, default: current context) | ||
# KUBECTL_NAMESPACE: Kubernetes namespace (default: current namespace) | ||
# KUBECTL_OPTIONS: Other options (default: empty) | ||
#---------------------------------------------------------------------------- | ||
|
||
opts="$KUBECTL_OPTIONS" | ||
[ -n "$KUBECTL_CONTEXT" ] && opts="$opts --context=$KUBECTL_CONTEXT" | ||
[ -n "$KUBECTL_NAMESPACE" ] && opts="$opts --namespace=$KUBECTL_NAMESPACE" | ||
|
||
$KUBECTL_CMD port-forward $opts "$GATEWAY_HOST" $LOCAL_PORT:$TARGET_PORT & | ||
|
||
CPID=$! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters