-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubernetes
58 lines (58 loc) · 2.21 KB
/
kubernetes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
SVER='0.1.0'
##############################################################################
# kubernetes - Kubernetes supportconfig plugin
# Copyright (C) 2023 SUSE LLC
#
# Copy to the /usr/lib/supportconfig/plugins directory and change mode to
# executable. It will collect Kubernetes related information.
#
##############################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Authors/Contributors:
# Jason Record <[email protected]>
# Nicola Di Marzo <[email protected]>
##############################################################################
OF="kubernetes.txt"
RC="/usr/lib/supportconfig/resources/supportconfig.rc"
KDIR="${LOG}/rancher2_logs_collector"
COLLECTOR_DIR='/usr/local/sbin'
echo "Kubernetes supportconfig plugin v${SVER}"
echo "See $OF for details"
if [[ -s $RC ]]; then
. $RC
else
echo "ERROR: File not found - $RC"
exit 1
fi
mkdir -p $KDIR
if [ ! -f ${COLLECTOR_DIR}/rancher2_logs_collector.sh ]; then
echo -e "Collector rancher2_logs_collector.sh not found in /usr/local/sbin\nYou can download it and install it by running:\n";
echo -e 'sudo curl -Ls rnch.io/rancher2_logs -o /usr/local/sbin/rancher2_logs_collector.sh'
exit 1
elif rpm -qa | grep -i kubeadm 2>&1 > /dev/null && $(kubeadm version >/dev/null 2>&1); then
echo "K8S kubeadm distro detected and collecting logs..."
log_cmd $OF "bash ${COLLECTOR_DIR}/rancher2_logs_collector.sh -d $KDIR -r kubeadm"
else
echo "Collecting Rancher logs..."
log_cmd $OF "bash ${COLLECTOR_DIR}/rancher2_logs_collector.sh -d $KDIR"
fi
cd $KDIR
for i in *gz
do
tar xf $i
rm $i
done
exit 0