Skip to content

A sample showing you how to use dotnet-monitor in a k8s cluster

License

Notifications You must be signed in to change notification settings

poppastring/dotnet-monitor-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet-monitor Demo

How to run this sample?

Replace dotnet-hello-world and dotnet-monitor with your desired container names

# Build a docker image for your application
docker build -t dotnet-hello-world ./src/

# Build the sidecar image for dotnet-monitor
docker build -t dotnet-monitor ./sidecar/

# Push your images
# If pushing to ACR, you may need to login
# az acr login -n <my-registry.acr.io>
docker push dotnet-hello-world
docker push dotnet-monitor

# Ensure your cluster has access to pull images from your registry

kubectl apply -f kubernetes-manifests/hello.deployment.yaml
kubectl apply -f kubernetes-manifests/hello.sevice.yaml
# Optional: If you have an ingress controller
kubectl apply -f kubernetes-manifests/hello.ingress.yaml

# Clean up
kubectl delete -f kubernetes-manifests/*.yml

How to run this sample with Skaffold?

Alternatively you can use Skaffold to run this application

# Replace my-registry.azurecr.io
skaffold config set default-repo my-registry.azurecr.io

skaffold run

# Clean up
skaffold delete

How do I access the API exposed by dotnet-monitor?

$ kubectl get pod -l app=dotnet-hello-world
NAME                                 READY   STATUS    RESTARTS   AGE
dotnet-hello-world-dc6f67566-t2dzd   2/2     Running   0          37m

$ kubectl port forward pods/dotnet-hello-world-dc6f67566-t2dzd 
Forwarding from 127.0.0.1:7000 -> 52323
Forwarding from [::1]:7000 -> 52323

Once you've established a port forward, you can download diagnostic artifacts by hitting these endpoints:

  1. Process dump: http://localhost:7000/dump
  2. CPU profile: http://localhost:7000/cpuprofile

About

A sample showing you how to use dotnet-monitor in a k8s cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 63.9%
  • Dockerfile 36.1%