File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ function kcmd() {
67
67
local image="${2:-ubuntu}"
68
68
local ns="$(kubectl get ns | _inline_fzf | awk '{print $1}')"
69
69
if [ -n "$cmd" ]; then
70
- kubectl run shell-$RANDOM --namespace $ns --rm -i --tty --image ${image} -- /bin/sh -c "${cmd}"
70
+ kubectl run shell-$RANDOM --pod-running-timeout 600s -- namespace $ns --rm -i --tty --image ${image} -- /bin/sh -c "${cmd}"
71
71
else
72
- kubectl run shell-$RANDOM --namespace $ns --rm -i --tty --image ${image} -- /bin/bash
72
+ kubectl run shell-$RANDOM --pod-running-timeout 600s -- namespace $ns --rm -i --tty --image ${image} -- /bin/bash
73
73
fi
74
74
}
75
75
@@ -316,6 +316,18 @@ function ktree() {
316
316
fi
317
317
}
318
318
319
+ # [kssh] select the external node IP to connect to the node via SSH. If external IP is not set, internal IP is used.
320
+ function kssh() {
321
+ local user=${1:-root}
322
+ local node_name="$(kubectl get node -o wide | _inline_fzf | awk '{print $1}')"
323
+ local node_ext_ip="$(kubectl get node -o wide --no-headers $node_name | awk '{print $7}')"
324
+ if [[ "$node_ext_ip" == "<none>" ]]; then
325
+ local node_ext_ip="$(kubectl get node -o wide --no-headers $node_name | awk '{print $6}')"
326
+ fi
327
+ echo "ssh $user@$node_ext_ip"
328
+ ssh $user@$node_ext_ip
329
+ }
330
+
319
331
# [konsole] create root shell on a node
320
332
function konsole() {
321
333
local node_hostname="$(kubectl get node --label-columns=kubernetes.io/hostname | _inline_fzf | awk '{print $6}')"
You can’t perform that action at this time.
0 commit comments