Skip to content

Commit

Permalink
dev-docs: document method for obtaining serial console on CoCo AKS
Browse files Browse the repository at this point in the history
  • Loading branch information
malt3 committed Mar 4, 2024
1 parent e4b0848 commit 99b7d19
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dev-docs/aks/serial-console.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Obtain a serial console inside the podvm

Get a shell on the AKS node. If in doubt, use [nsenter-node.sh](https://github.com/alexei-led/nsenter/blob/master/nsenter-node.sh).
Now run the following commands to use a debug igvm and enable debugging for the kata runtime.

```sh
sed -i -e 's#^igvm = "\(.*\)"#igvm = "/opt/confidential-containers/share/kata-containers/kata-containers-igvm-debug.img"#g' /opt/confidential-containers/share/defaults/kata-containers/configuration-clh-snp.toml
sed -i -e 's/^#enable_debug = true/enable_debug = true/g' /opt/confidential-containers/share/defaults/kata-containers/configuration-clh-snp.toml
systemctl restart containerd
```

Now you need to reconnect to the host. Use the following commands to print the sandbox ids of kata VMs.
Please note that only the pause container of every pod has the `clh.sock`. Other containers are part of the same VM.

```shell-session
$ ctr --namespace k8s.io container ls "runtime.name==io.containerd.kata-cc.v2"
$ sandbox_id=ENTER_SANDBOX_ID_HERE
```

And attach to the serial console using socat. You need to type `CONNECT 1026<ENTER>` to get a shell.

```shell-session
$ cd /var/run/vc/vm/${sandbox_id}/ && socat stdin unix-connect:clh.sock
CONNECT 1026
```

Alternatively, you can use `kata-runtime exec`, which gives you proper tty behavior including tab completion.
First ensure the kata-monitor is running, then connect.

```
$ kata-monitor &
$ kata-runtime exec ${sandbox_id}
```

If you are done, use the following commands to go back to a release igvm.

```sh
sed -i -e 's#^igvm = "\(.*\)"#igvm = "/opt/confidential-containers/share/kata-containers/kata-containers-igvm.img"#g' /opt/confidential-containers/share/defaults/kata-containers/configuration-clh-snp.toml
sed -i -e 's/^enable_debug = true/#enable_debug = true/g' /opt/confidential-containers/share/defaults/kata-containers/configuration-clh-snp.toml
systemctl restart containerd
```

0 comments on commit 99b7d19

Please sign in to comment.