I am trying to containerize my asp.net application with Kubernetes. I have an Ingress and Service set up in Kubernetes. A dns as well. However, I’m still not exactly sure what Endpoint needs to be run for the actual application running Kestrel in a container.
Example:
- I have a dns of: “myapp.mynetwork.com:80/doSomething” (with an ip of 184.23.43.10 lets say)
- ingress will take that endpoint and forward it to port 2000 (hypothetical)
- I have a service.yaml that exposes port 2000 for my running application.
Question is: Kestrel in this case should be exposing an endpoint using which ip address? the service IP? the cluster IP? the IP of the pod itself?
Thank you
2
You needn’t configure the Kestrel to other ip address, just use the as default localhost
.
Then after deployment, you will be able vist the application using “container” IP.
What really matters is the port. Such as following configuration you build the image and expose the kestrel endpoint to port 80.
...
EXPOSE 80
...
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet","Test01.dll","--server.urls","http://*/80"]
Then the deployment yaml need to configure the same container port “80”
...
kind: Deployment
...
containers:
- name: xxx
image: xxx
ports:
- containerPort: 80