2021-05-11 10:28:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Run this script to gather details about the environment where the CI job is
|
|
|
|
# running. This can be helpful to identify issues why minikube failed to
|
|
|
|
# deploy, or tests encounter problems while running.
|
|
|
|
#
|
|
|
|
|
|
|
|
function minikube_ssh() {
|
|
|
|
ssh \
|
|
|
|
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
|
|
|
|
-l docker -i "$(minikube ssh-key)" \
|
|
|
|
"$(minikube ip)" "${*}"
|
|
|
|
}
|
|
|
|
|
|
|
|
function log() {
|
2021-05-12 12:11:10 +00:00
|
|
|
echo "###" >/dev/stderr
|
|
|
|
echo "### going to execute: ${*}" >/dev/stderr
|
|
|
|
echo "###" >/dev/stderr
|
2021-05-11 10:28:55 +00:00
|
|
|
"${@}"
|
2021-05-12 12:11:10 +00:00
|
|
|
echo "###" >/dev/stderr
|
|
|
|
echo "### execution finished: ${*}" >/dev/stderr
|
|
|
|
echo "###" >/dev/stderr
|
2021-05-11 10:28:55 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 15:36:01 +00:00
|
|
|
# get the logs from the host
|
|
|
|
log journalctl --boot
|
|
|
|
|
2021-05-11 10:28:55 +00:00
|
|
|
# get the status of the VM in libvirt
|
|
|
|
log virsh list
|
|
|
|
|
|
|
|
# status of the minikube Kubernetes cluster
|
|
|
|
log minikube status
|
|
|
|
log minikube logs
|
|
|
|
|
|
|
|
# get the status of processes in the VM
|
2021-05-11 15:40:14 +00:00
|
|
|
log minikube_ssh top -b -c -n1 -w
|
2021-05-11 10:28:55 +00:00
|
|
|
|
|
|
|
# get the logs from the VM
|
2023-08-24 09:54:52 +00:00
|
|
|
log minikube_ssh sudo journalctl --boot
|
2021-05-11 10:28:55 +00:00
|
|
|
|
2022-05-06 06:22:53 +00:00
|
|
|
# get kubelet status
|
2023-08-24 09:54:52 +00:00
|
|
|
log minikube_ssh sudo systemctl status kubelet
|
|
|
|
log minikube_ssh sudo journalctl -xeu kubelet
|
2022-05-06 06:22:53 +00:00
|
|
|
|
2021-05-11 10:28:55 +00:00
|
|
|
# filesystem status for host and VM
|
2021-05-12 08:36:05 +00:00
|
|
|
log df -hT
|
|
|
|
log minikube_ssh df -hT
|
2021-05-12 12:11:10 +00:00
|
|
|
|
2021-08-12 14:10:40 +00:00
|
|
|
# get the rbd-nbd logs from the VM and write them to stdout
|
|
|
|
log minikube_ssh "sudo find /var/log/ceph/ -type f | xargs sudo tail -n +1"
|
|
|
|
|
2021-05-12 12:11:10 +00:00
|
|
|
# fetch all logs from /var/lib/rook in the VM and write them to stdout
|
|
|
|
log minikube_ssh sudo tar c /var/lib/rook | tar xvO
|
|
|
|
|
2021-05-20 09:55:23 +00:00
|
|
|
# gets status from all namespaces
|
|
|
|
for NAMESPACE in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}')
|
2021-05-12 16:58:17 +00:00
|
|
|
do
|
2021-05-20 09:55:23 +00:00
|
|
|
log kubectl describe namespace "${NAMESPACE}"
|
|
|
|
log kubectl -n "${NAMESPACE}" get events
|
|
|
|
log kubectl -n "${NAMESPACE}" get pods
|
|
|
|
for POD in $(kubectl -n "${NAMESPACE}" get pods -o jsonpath='{.items[*].metadata.name}')
|
|
|
|
do
|
|
|
|
log kubectl -n "${NAMESPACE}" describe pod "${POD}"
|
|
|
|
log kubectl -n "${NAMESPACE}" logs "${POD}" --all-containers
|
|
|
|
log kubectl -n "${NAMESPACE}" logs "${POD}" --all-containers --previous=true
|
|
|
|
done
|
2021-05-12 16:58:17 +00:00
|
|
|
done
|
2021-05-12 12:11:10 +00:00
|
|
|
log kubectl -n rook-ceph describe CephCluster
|
|
|
|
log kubectl -n rook-ceph describe CephBlockPool
|
|
|
|
log kubectl -n rook-ceph describe CephFilesystem
|
|
|
|
|
|
|
|
# run "ceph -s" in the toolbox
|
|
|
|
log kubectl -n rook-ceph exec \
|
|
|
|
"$(kubectl -n rook-ceph get pod -l app=rook-ceph-tools -o jsonpath='{.items[0].metadata.name}')" \
|
2021-05-17 10:29:56 +00:00
|
|
|
-- ceph -s
|