Skip to content

Instantly share code, notes, and snippets.

@pavel-agarkov
Last active February 11, 2021 15:29
Show Gist options
  • Save pavel-agarkov/0942fadbedb2cbbe0bee0dde01ced865 to your computer and use it in GitHub Desktop.
Save pavel-agarkov/0942fadbedb2cbbe0bee0dde01ced865 to your computer and use it in GitHub Desktop.
Script for starting remote debugging of dotnet app in kubernetes from Visual Studio 2019
#!/bin/bash
set -e
while [ "$1" != "" ]; do
case $1 in
-n | --namespace)
NAMESPACE=$2
shift 2
;;
-s | --selector)
SELECTOR=$2
shift 2
;;
esac
done
# searching for the pod to connect to by selector and namespace
POD=`kubectl get pods -n ${NAMESPACE} --selector=$SELECTOR -o jsonpath='{.items[0].metadata.name}'`;
# starting remote debugger that we installed earlier inside our docker image
kubectl exec $POD -n ${NAMESPACE} -i -- ../vsdbg/vsdbg --interpreter=vscode;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment