mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #9367 from justinsb/aws_ssh_check
AWS: Check for SSH connectivity & better logging on failure
This commit is contained in:
commit
e14d9038fe
@ -735,14 +735,43 @@ function kube-up {
|
|||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Check for SSH connectivity
|
||||||
|
attempt=0
|
||||||
|
while true; do
|
||||||
|
echo -n Attempt "$(($attempt+1))" to check for SSH to master
|
||||||
|
local output
|
||||||
|
local ok=1
|
||||||
|
output=$(ssh -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ubuntu@${KUBE_MASTER_IP} uptime 2> $LOG) || ok=0
|
||||||
|
if [[ ${ok} == 0 ]]; then
|
||||||
|
if (( attempt > 30 )); then
|
||||||
|
echo
|
||||||
|
echo "(Failed) output was: ${output}"
|
||||||
|
echo
|
||||||
|
echo -e "${color_red}Unable to ssh to master on ${KUBE_MASTER_IP}. Your cluster is unlikely" >&2
|
||||||
|
echo "to work correctly. Please run ./cluster/kube-down.sh and re-create the" >&2
|
||||||
|
echo -e "cluster. (sorry!)${color_norm}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e " ${color_green}[ssh to master working]${color_norm}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo -e " ${color_yellow}[ssh to master not working yet]${color_norm}"
|
||||||
|
attempt=$(($attempt+1))
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
# We need the salt-master to be up for the minions to work
|
# We need the salt-master to be up for the minions to work
|
||||||
attempt=0
|
attempt=0
|
||||||
while true; do
|
while true; do
|
||||||
echo -n Attempt "$(($attempt+1))" to check for salt-master
|
echo -n Attempt "$(($attempt+1))" to check for salt-master
|
||||||
local output
|
local output
|
||||||
output=$(ssh -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ubuntu@${KUBE_MASTER_IP} pgrep salt-master 2> $LOG) || output=""
|
local ok=1
|
||||||
if [[ -z "${output}" ]]; then
|
output=$(ssh -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ubuntu@${KUBE_MASTER_IP} pgrep salt-master 2> $LOG) || ok=0
|
||||||
|
if [[ ${ok} == 0 ]]; then
|
||||||
if (( attempt > 30 )); then
|
if (( attempt > 30 )); then
|
||||||
|
echo
|
||||||
|
echo "(Failed) output was: ${output}"
|
||||||
echo
|
echo
|
||||||
echo -e "${color_red}salt-master failed to start on ${KUBE_MASTER_IP}. Your cluster is unlikely" >&2
|
echo -e "${color_red}salt-master failed to start on ${KUBE_MASTER_IP}. Your cluster is unlikely" >&2
|
||||||
echo "to work correctly. Please run ./cluster/kube-down.sh and re-create the" >&2
|
echo "to work correctly. Please run ./cluster/kube-down.sh and re-create the" >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user