I'm trying to run dotnet core project in Kubernetes and I am wondering if there a way to limit memory usage from dotnet core project itself the same way we can set a limit for jvm projects.
I see there is an optional argument in Docker to set memory limit:
docker run --memory="198m" xxx
Also in Kubernetes yaml file, we can set memory limit as well:
resources:
requests:
# ~402 MB
memory: "384Mi"
cpu: "250m"
limits:
# ~1500MB
memory: "1430Mi"
cpu: "500m"
If you're using dotnet core 2.0.2 or higher I believe it respects Docker's cgroup limits by default.
So all good on 2.0.2+. Just set the resource limits in K8S 👍