Kubernetes is an orchestration system for containers. You can host .NET in Kubernetes in the same way as other dev platforms. We've provided samples that demonstrate best practices for configuring .NET apps with Kubernetes. More general container samples are provided in the samples directory.
The samples were tested with:
- kubectl 1.30
- minikube 1.33 (Kubernetes 1.30.0)
- Docker Desktop 26.0.0 (Kubernetes 1.29.2)
The instruction rely on a correctly configured Kubernetes environment.
Apply sample to your cluster.
kubectl apply -f https://raw.githubusercontent.com/dotnet/dotnet-docker/main/samples/kubernetes/hello-dotnet/hello-dotnet.yaml
kubectl port-forward service/hello-dotnet 8080
View the sample app at http://localhost:8080/
. See hello-dotnet for information.
The following examples demonstrate various Kubernetes and .NET capabilities.
- hello-dotnet
- Manual deployment
- Resource limits
- Non-root user
- Replicas and health checks
- dotnet-monitor
- Graceful shutdown
The hello-dotnet example demonstrates multiple capabilities in a single sample.