forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kata-debug is a tool that is used as part of the Kata Containers CI to gather information from the node, in order to help debugging issues with Kata Containers. As one can imagine, this can be expanded and used outside of the CI context, and any contribution back to the script is very much welcome. The resulting container is stored at the [Kata Containers quay.io space](https://quay.io/repository/kata-containers/kata-debug) and can be used as shown below: ```sh kubectl debug $NODE_NAME -it --image=quay.io/kata-containers/kata-debug:latest ``` Fixes: kata-containers#7397 Signed-off-by: Fabiano Fidêncio <[email protected]>
- Loading branch information
Showing
6 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
FROM ubuntu:22.04 | ||
|
||
COPY debug.sh /usr/bin/debug.sh | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends tree && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/ | ||
|
||
CMD ["/usr/bin/debug.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# kata-debug | ||
|
||
`kata-debug` is a tool that is used as part of the Kata Containers CI to gather | ||
information from the node, in order to help debugging issues with Kata | ||
Containers. | ||
|
||
As one can imagine, this can be expanded and used outside of the CI context, | ||
and any contribution back to the script is very much welcome. | ||
|
||
The resulting container is stored at the [Kata Containers `quay.io` | ||
space](https://quay.io/repository/kata-containers/kata-debug) and can | ||
be used as shown below: | ||
```sh | ||
kubectl debug $NODE_NAME -it --image=quay.io/kata-containers/kata-debug:latest | ||
``` | ||
|
||
## Building and publishing | ||
The project can be built and publish by calling the following command from the | ||
Kata Containers top directory: | ||
```sh | ||
make build-and-publish-kata-debug | ||
``` | ||
|
||
Users can specify the following environment variables to the build: | ||
* `KATA_DEBUG_REGISTRY` - The container registry to be used | ||
default: `quay.io/kata-containers/kata-debug` | ||
- `KATA_DEBUG_TAG` - A tag to the be used for the image | ||
default: `$(git rev-parse HEAD)-$(uname -a)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
echo "Let's gather Kata Containers debug information" | ||
echo "" | ||
echo "::group::Check Kata Containers logs" | ||
chroot /host /bin/bash -c "sudo journalctl -xe -t kata | tee" | ||
echo "::endgroup::" | ||
echo "" | ||
echo "::group::Checking the loaded kernel modules" | ||
chroot /host /bin/bash -c "sudo lsmod" | ||
echo "::endgroup::" | ||
echo "" | ||
echo "::group::Check Kata Containers deployed binaries" | ||
tree /host/opt/kata /host/usr/local/bin | ||
echo "::endgroup::" | ||
echo "" | ||
echo "::group:: Check node's dmesg" | ||
chroot /host /bin/bash -c "sudo dmesg" | ||
echo "::endgroup::" |
42 changes: 42 additions & 0 deletions
42
tools/packaging/kata-debug/kata-debug-build-and-upload-payload.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2023 Intel | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
[ -z "${DEBUG}" ] || set -x | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
set -o errtrace | ||
|
||
KATA_DEBUG_DIR="`dirname ${0}`" | ||
|
||
REGISTRY="${1:-"quay.io/kata-containers/kata-debug"}" | ||
TAG="${2:-}" | ||
|
||
arch=$(uname -m) | ||
[ "$arch" = "x86_64" ] && arch="amd64" | ||
IMAGE_TAG="${REGISTRY}:$(git rev-parse HEAD)-${arch}" | ||
|
||
pushd ${KATA_DEBUG_DIR} | ||
|
||
echo "Building the image" | ||
docker build --tag ${IMAGE_TAG} . | ||
|
||
echo "Pushing the image to the registry" | ||
docker push ${IMAGE_TAG} | ||
|
||
if [ -n "${TAG}" ]; then | ||
ADDITIONAL_TAG="${REGISTRY}:${TAG}" | ||
|
||
echo "Building the ${ADDITIONAL_TAG} image" | ||
|
||
docker build --tag ${ADDITIONAL_TAG} . | ||
|
||
echo "Pushing the image ${ADDITIONAL_TAG} to the registry" | ||
docker push ${ADDITIONAL_TAG} | ||
fi | ||
|
||
popd |