diff --git a/anolis-courses/cloud-native/compile_runD/step3.md b/anolis-courses/cloud-native/compile_runD/step3.md index 0d2e07ee4de93e2ae70a9ee1526cdc31b88b3b4c..a2c9da794317b03a93e969d859058901d2a3d173 100644 --- a/anolis-courses/cloud-native/compile_runD/step3.md +++ b/anolis-courses/cloud-native/compile_runD/step3.md @@ -1,4 +1,5 @@ 1. 可以尝试修改runD的代码,可以修改一些日志输出或者不影响功能的地方, 比如: +```s --- a/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs +++ b/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs @@ -135,7 +135,7 @@ impl Sandbox for VirtSandbox { @@ -7,3 +8,4 @@ self.hypervisor.start_vm(10_000).await.context("start vm")?; - info!(sl!(), "start vm"); + info!(sl!(), "start vm for myself!"); +``` diff --git a/anolis-courses/cloud-native/compile_runD/step4.md b/anolis-courses/cloud-native/compile_runD/step4.md index e609ee6f77f50b68f648ce8586d5b85d416d5e26..ee45bd69bd445fb7ad967e4ed3229d96dcba4756 100644 --- a/anolis-courses/cloud-native/compile_runD/step4.md +++ b/anolis-courses/cloud-native/compile_runD/step4.md @@ -3,13 +3,16 @@ [[ container-image=cloud-native-registry.cn-shanghai.cr.aliyuncs.com/runtime/rund:shim-builder-latest ]] -[[ nerdctl run --rm -i -v "${repo-root-dir}:${repo-root-dir}" \ +```s +nerdctl run --rm -i -v "${repo-root-dir}:${repo-root-dir}" \ -w "${repo-root-dir}/src/runtime-rs" \ "${container-image}" \ - bash -c "git config --global --add safe.directory ${repo-root-dir} && make -j8" ]] + bash -c "git config --global --add safe.directory ${repo-root-dir} && make -j8" +``` 2. 上面编译需要一段时间,需要等编译完,然后运行下面的命令替换最新的runD,并运行查看日志结果 [[ cp $repo-root-dir/src/runtime-rs/target/x86_64-unknown-linux-musl/release/containerd-shim-kata-v2 /opt/kata/bin/containerd-shim-rund-v2 ]] +如果发现有file busy的错误,可能是存在当前正在运行的rund实例,需要把rund实例都删除掉 [[ time nerdctl run --runtime io.containerd.rund.v2 busybox /bin/sh -c "uname -a" ]] diff --git a/anolis-courses/cloud-native/running_runD/step4.md b/anolis-courses/cloud-native/running_runD/step4.md index 899efa1747c9f54f7e7407fff2bf78c8f853ffbe..5127115a5dd3249b259ba54758b5e456956e2ab8 100644 --- a/anolis-courses/cloud-native/running_runD/step4.md +++ b/anolis-courses/cloud-native/running_runD/step4.md @@ -5,20 +5,26 @@ [[ tar -zxvf crictl-v1.24.2-linux-amd64.tar.gz -C /usr/local/bin/ ]] 3. 配置crictl命令 -[[ cat << EOF > /etc/crictl.yaml +```s +cat << EOF > /etc/crictl.yaml runtime-endpoint: unix:///run/containerd/containerd.sock image-endpoint: unix:///run/containerd/containerd.sock timeout: 10 debug: false -EOF ]] +EOF +``` +或者直接使用下面的链接进行下载配置文件 +[[ wget https://cloud-native.oss-cn-shanghai.aliyuncs.com/runtime/crictl.yaml ]] +[[ cp crictl.yaml /etc/ ]] 4. 使用crictl来pull需要启动的镜像 [[ crictl pull busybox ]] 5. 添加运行pod的配置文件 -[[ cat << EOF > sandbox-config.json +```s +cat << EOF > sandbox-config.json { - "metadata": { + "metadata": { "name": "test-sandbox", "namespace": "default", "attempt": 1, @@ -32,7 +38,10 @@ EOF ]] } } } -EOF ]] +EOF +``` +或者直接用下面的链接下载配置文件 +[[ wget https://cloud-native.oss-cn-shanghai.aliyuncs.com/runtime/sandbox-config.json ]] 6. 使用rund来运行pod [[ crictl runp -r rund sandbox-config.json ]]