In my case the app is .NET app running in Linux docker container in k8s pod.
Switch to a k8s namespace of your app:
kubectl config set-context --current --namespace test-app-dev
Open bash on your app container running in k8s pod:
kubectl exec -i -t test-app-pod --container test-app-service -- /bin/bash
Run these commands in container bash:
apt-get update apt-get install curl curl -L -o dotnet-gcdump https://aka.ms/dotnet-gcdump/linux-x64 chmod +x dotnet-gcdump ./dotnet-gcdump collect -p 1 gzip /app/20240108_212900_1.gcdump exit
Copy gcdump file from the pod container to your local storage:
kubectl cp "test-app-pod:/app/20240108_212900_1.gcdump.gz" ./20240108_212900_1.gcdump.gz
Then you can investigate gcdump in VisualStudio