I've been reading a lot about kubernetes, docker and containers in general. There is a ton of materials on the web. Problem is that some specific but important information is hard to come by.
Right now kestrel is the default web server for asp.net core but it has some limitations (lack of functionalities) and recommended hosting option is one with use of reverse proxy. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.2
This can be easily achieved on local environments for example with use of IIS. Now my question is how should it work in Azure AKS ? If I'm not mistaken right now if we would deploy using below docker kubernetes scripts Kestrel will be the hosting server in Azure.
Docker:
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app
RUN mkdir /output
# Copy project and publish
COPY . /app
WORKDIR /app/WebApi
RUN dotnet publish --configuration Release --output /output -nowarn:1701,1702,1591;
# Build runtime image
FROM microsoft/dotnet:aspnetcore-runtime
ENV ASPNETCORE_URLS http://*:5100
WORKDIR /app
COPY --from=build-env /output .
EXPOSE 5100
ENTRYPOINT ["dotnet", "WebApi.dll"]
Kubernetes:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-api
spec:
replicas: 1
selector:
matchLabels:
app: web-api
template:
metadata:
labels:
app: web-api
spec:
containers:
- name: web-api
image: azureadress.io/web-api:latest
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Azure_Development"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 5100
---
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/load-balancer-source-ranges:
name: web-api
spec:
loadBalancerIP: xxxxx.xxx.xxx
type: LoadBalancer
ports:
- port: 5100
selector:
app: web-api
Should reverse proxy also be used in this case ? I wasn't able to find any materials on how the production setup should look like.