Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4fdadbb1
Commit
4fdadbb1
authored
Mar 07, 2016
by
Joe Finney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a simple SSH test before attempting to gather logs in log-dump.sh.
parent
e660adba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
log-dump.sh
cluster/log-dump.sh
+13
-0
No files found.
cluster/log-dump.sh
View file @
4fdadbb1
...
...
@@ -30,6 +30,13 @@ source "${KUBE_ROOT}/cluster/kube-util.sh"
readonly
report_dir
=
"
${
1
:-
_artifacts
}
"
echo
"Dumping master and node logs to
${
report_dir
}
"
# Attempts to SSH to a node ($1) and run a simple command. Returns 0 on
# success and 1 on error.
function
test-ssh
()
{
local
-r
node_name
=
"
${
1
}
"
return
$(
ssh-to-node
"
${
node_name
}
"
"echo test > /dev/null"
&> /dev/null
)
}
# Saves a single output of running a given command ($2) on a given node ($1)
# into a given local file ($3). Does not fail if the ssh command fails for any
# reason, just prints an error to stderr.
...
...
@@ -70,6 +77,8 @@ if [[ ! "${master_ssh_supported_providers}" =~ "${KUBERNETES_PROVIDER}" ]]; then
echo
"Master SSH not supported for
${
KUBERNETES_PROVIDER
}
"
elif
!
$(
detect-master &> /dev/null
)
;
then
echo
"Master not detected. Is the cluster up?"
elif
!
test-ssh
"
${
MASTER_NAME
}
"
;
then
echo
"Could not SSH to
${
MASTER_NAME
}
"
>
&2
else
echo
"Master Name:
${
MASTER_NAME
}
"
readonly
master_prefix
=
"
${
report_dir
}
/
${
MASTER_NAME
}
"
...
...
@@ -88,6 +97,10 @@ elif [[ "${#NODE_NAMES[@]}" -eq 0 ]]; then
else
echo
"Node Names:
${
NODE_NAMES
[*]
}
"
for
node_name
in
"
${
NODE_NAMES
[@]
}
"
;
do
if
!
test-ssh
"
${
node_name
}
"
;
then
echo
"Could not SSH to
${
node_name
}
"
>
&2
continue
fi
node_prefix
=
"
${
report_dir
}
/
${
node_name
}
"
save-log
"
${
node_name
}
"
"cat /var/log/kube-proxy.log"
"
${
node_prefix
}
-kube-proxy.log"
save-common-logs
"
${
node_name
}
"
"
${
node_prefix
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment