mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Add connect timeout to ssh-to-node.
This commit is contained in:
parent
7a43808143
commit
e660adbad8
@ -1511,10 +1511,12 @@ function ssh-to-node {
|
||||
fi
|
||||
|
||||
for try in $(seq 1 5); do
|
||||
if ssh -oLogLevel=quiet -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "${cmd}"; then
|
||||
if ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "echo test > /dev/null"; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "${cmd}"
|
||||
}
|
||||
|
||||
# Restart the kube-proxy on a node ($1)
|
||||
|
@ -1319,13 +1319,13 @@ function ssh-to-node {
|
||||
local cmd="$2"
|
||||
# Loop until we can successfully ssh into the box
|
||||
for try in $(seq 1 5); do
|
||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
# Then actually try the command.
|
||||
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||
}
|
||||
|
||||
# Restart the kube-proxy on a node ($1)
|
||||
|
@ -263,13 +263,13 @@ function ssh-to-node() {
|
||||
local cmd="$2"
|
||||
# Loop until we can successfully ssh into the box
|
||||
for try in $(seq 1 5); do
|
||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
# Then actually try the command.
|
||||
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||
gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "${cmd}"
|
||||
}
|
||||
|
||||
# Restart the kube-proxy on a node ($1)
|
||||
|
@ -345,7 +345,7 @@ function ssh-to-node {
|
||||
if [[ -z "$machine" ]]; then
|
||||
echo "$node is an unknown machine to ssh to" >&2
|
||||
fi
|
||||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no "core@$machine" "$cmd"
|
||||
ssh -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no "core@$machine" "$cmd"
|
||||
}
|
||||
|
||||
# Restart the kube-proxy on a node ($1)
|
||||
|
Loading…
Reference in New Issue
Block a user