Hey guys, I am trying to upload files larger than 200mb using a netcore app deployed to a kubernetes cluster with a load balancer. When I post to the endpoint the file I get an NGINX error 413 Request Entity Too Large - NGINX. This is weird for me because I didn’t install any nginx to proxy the requests through. I read that netcore apps use Kestrel as the server.
service.yaml
apiVersion: v1
kind: Service
metadata:
name: myapp-api-service
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
type: LoadBalancer
selector:
app: myapp
microService: myapp-api
ports:
- protocol: TCP
port: 80
targetPort: myapp-api
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-api
spec:
selector:
matchLabels:
app: myapp
microService: myapp-api
replicas: 1
template:
metadata:
labels:
app: myapp
microService: myapp-api
spec:
containers:
- name: myapp-api
image: harbor.test.ro/myapp/myapp-api:latest
imagePullPolicy: Always
ports:
- name: myapp-api
containerPort: 80
protocol: TCP
imagePullSecrets:
- name: regcred
Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
WORKDIR /app
# # copy csproj and restore as distinct layers
COPY Myapp.API/Myapp.API/*.csproj ./Myapp.API/
# # COPY utils/*.csproj ./utils/
WORKDIR /app/Myapp.API/
RUN dotnet restore
WORKDIR /app/
COPY Myapp.API/. ./Myapp.API/
# COPY utils/. ./utils/
WORKDIR /app/Myapp.API
RUN dotnet publish -c Release -o out
# test application -- see: dotnet-docker-unit-testing.md
# FROM build AS testrunner
# WORKDIR /app/tests
# COPY tests/. .
# ENTRYPOINT ["dotnet", "test", "--logger:trx"]
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
WORKDIR /app
COPY --from=build /app/Myapp.API/out ./
ENTRYPOINT ["dotnet", "Myapp.API.dll"]
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I believe you want to use a service annotation like such: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-max-body-size
Play around with the sizes a bit to find which ones work best for you.
Regards,
John Kwiatkoski Senior Developer Support Engineer - Kubernetes
thanks @jkwiatkoski Adding nginx.ingress.kubernetes.io/proxy-body-size: xm can help to solve 413 issue.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
