Skip to content

Commit 197f1a9

Browse files
committed
dev-docs: add e2e debugging guide
Document how to collect and navigate logs after e2e tests and manual deployments. Covers host-level journal logs (kernel, k3s, kata) and how to trace a pod to its kata sandbox ID in the logs. Signed-off-by: Spyros Seimenis <sse@edgeless.systems>
1 parent 893495a commit 197f1a9

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

dev-docs/e2e/debugging.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Debugging e2e failures
2+
3+
## Collecting logs
4+
5+
### After a `just e2e` run
6+
7+
`just e2e` deploys a log-collector DaemonSet that streams pod logs from the
8+
start. After the test finishes (pass or fail), download the logs:
9+
10+
```bash
11+
just download-logs
12+
```
13+
14+
Logs are written to `workspace/logs/`.
15+
16+
### After a manual deployment (`just`)
17+
18+
If you deployed with `just` (the default target) and want to collect logs:
19+
20+
```bash
21+
just download-logs
22+
```
23+
24+
This deploys the log-collector DaemonSet (if not already running), collects
25+
host-level journal entries, and downloads everything.
26+
27+
### In CI
28+
29+
CI runs `just download-logs` automatically after every e2e test. Logs are
30+
uploaded as GitHub Actions artifacts. To find them: go to the workflow run,
31+
scroll to the bottom of the run summary page, and look for artifacts named
32+
`e2e_pod_logs-<platform>-<test>` (e.g. `e2e_pod_logs-Metal-QEMU-SNP-openssl`).
33+
Alternatively you can expand the "Upload logs" step in a particular test and
34+
get the Artifact download URL.
35+
36+
## Log structure
37+
38+
```
39+
workspace/logs/
40+
├── <namespace>_<pod>_<uid>/ # pod container logs
41+
│ └── <container>/0.log
42+
├── <namespace>-k8s-events.yaml # kubernetes events
43+
└── host/ # host-level journal logs
44+
├── kernel.log # journalctl -k (SEV-ES termination, VFIO/IOMMU)
45+
├── k3s.log # journalctl -u k3s (kubelet/containerd errors)
46+
└── kata.log # journalctl -t kata (QEMU lifecycle, register dumps)
47+
```
48+
49+
Host logs are time-scoped to the namespace creation time, so they only contain
50+
entries relevant to the test run.
51+
52+
## Debugging CVM failures
53+
54+
CVM boot failures (e.g. SEV-ES termination, OVMF crashes) leave no trace in
55+
pod logs -the guest never starts. Look at host-level logs instead:
56+
57+
1. **kernel.log** -look for `SEV-ES guest requested termination`, VFIO/IOMMU
58+
errors, or KVM failures.
59+
2. **kata.log** -look for `detected guest crash`, QEMU launch arguments,
60+
register dumps, and console output (`vmconsole=` lines contain guest serial
61+
output).
62+
3. **k3s.log** -look for `task is in unknown state` or containerd errors that
63+
indicate the CVM process died.
64+
65+
## Tracing a pod to its sandbox in kata.log
66+
67+
kata.log contains interleaved logs from all sandboxes. To find logs for a
68+
specific pod, you need to go from runtime class to sandbox ID.
69+
70+
1. Find the test namespace:
71+
72+
```bash
73+
ns=$(cat workspace/just.namespace)
74+
```
75+
76+
2. List pods and their runtime classes:
77+
78+
```bash
79+
kubectl get pods -n "$ns" -o custom-columns='NAME:.metadata.name,RUNTIME:.spec.runtimeClassName'
80+
# NAME RUNTIME
81+
# openssl-backend-85cd89c76-q6w6h contrast-cc-metal-qemu-snp-fd4512d5
82+
# openssl-frontend-97f6d865d-mvph4 contrast-cc-metal-qemu-snp-fd4512d5
83+
# coordinator-0 contrast-cc-metal-qemu-snp-fd4512d5
84+
```
85+
86+
3. Get the runtime hash and list sandbox IDs. The hash is the last component
87+
of the runtime class name (e.g. `fd4512d5` from
88+
`contrast-cc-metal-qemu-snp-fd4512d5`):
89+
90+
```bash
91+
hash="fd4512d5"
92+
grep "$hash" workspace/logs/host/kata.log | grep -oP 'sandbox=\K[a-f0-9]+' | sort -u
93+
# 8c0277d1f16fbbce871d5ab4982fbc376aa7c39e3ae00615cf0722f9b0d7f9a9
94+
# 2fbc275ee03b0fe9929f4e6ef474dd6e855c1da6cfbcd4843a535e51e8ba5441
95+
# 548cbab9ee75a3f1...
96+
```
97+
98+
Each sandbox ID corresponds to one pod/CVM.
99+
100+
4. Filter kata.log for a specific sandbox:
101+
102+
```bash
103+
sandbox="8c0277d1f16fbbce"
104+
grep "$sandbox" workspace/logs/host/kata.log
105+
```
106+
107+
Note that some kata log lines (config loading, factory init, device cold plug)
108+
don't have a sandbox ID. These are shared across all CVMs and may be relevant
109+
for debugging startup failures.

0 commit comments

Comments
 (0)