【发布时间】:2022-08-08 11:44:18
【问题描述】:
我有一个 shell 脚本,可以在 Kubernetes pod 中启动调试器。在 VSCode 中,我可以将此脚本作为调试配置文件运行,并将其附加到连接到 pod 的本地 kubectl 进程(在脚本中启动)。调试器按预期工作,所有断点都被命中。
然而,在 Rider 中,我将同样的脚本作为调试配置运行,调试器启动但没有遇到断点。正在调试什么?它是附加到 bash 进程而不是 kubectl 进程吗?
kube-debug.sh
STORAGE_UID=`kubectl get pvc/$1-bin -o jsonpath=\'{.metadata.uid}\'`
echo \"Copying to storage: $STORAGE_UID\"
rsync -av bin/Debug/net6.0/* user@storage-server:/srv/default-$1-bin-pvc-$STORAGE_UID/
POD=`kubectl get pods --selector=app=$1 -o jsonpath=\'{.items[0].metadata.name}\'`
echo \"Deleting pod: $POD\"
kubectl delete pods/$POD
kubectl wait pod -l app=$1 --for=condition=Ready
POD=`kubectl get pods --selector=app=$1 -o jsonpath=\'{.items[0].metadata.name}\'`
echo \"Debugging pod: $POD\"
# This is the line where I was hoping the debugger
# would attach to the kubectl process as it does in VSCode
kubectl exec $POD -i -- ../vsdbg/vsdbg
标签: bash shell debugging remote-debugging jetbrains-rider