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.
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
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
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"]
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.