I am trying to deploy Sample .NET Core reference application to Openshift using the provided helm charts. Following is the repo for it: https://github.com/dotnet-architecture/eShopOnContainers I first tried on local Kubernetes and it worked out of the box as per instructions. It uses some infrastructure services for redis, sql server, rabbitmq and mongodb. The web applications use the default Kestrel web server. I am getting errors with Kestrel, first of all, on Openshift, with following exceptions:
[11:54:31 WRN] Overriding address(es) 'http://*:8080'. Binding to endpoints defined in UseKestrel() instead.
[11:54:31 FTL] Unable to start Kestrel.
System.Net.Sockets.SocketException (13): Permission denied
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
I have already modified the Dockerfiles for services to include following configurations, and various combinations of them:
LABEL io.k8s.description="Platform for running .NET 5 applications" \
io.k8s.display-name=".NET 5" \
io.openshift.tags="runtime,.net,dotnet,dotnetcore,rh-dotnet50-runtime" \
io.openshift.expose-services="8080:http" \
io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \
io.s2i.scripts-url=image:///usr/libexec/s2i
EXPOSE 8080
# Don't download/extract docs for nuget packages
ENV NUGET_XMLDOC_MODE=skip
## By default, ASP.NET Core runs on port 5000. We configure it to match
## the container port.
ENV ASPNETCORE_URLS=http://*:8080
# Create a group and user so we are not running our container and application as root and thus user 0 which is a security issue.
RUN addgroup --system --gid 1000 customgroup \
&& adduser --system --uid 1000 --ingroup customgroup --shell /bin/sh customuser
# Tell docker that all future commands should run as the appuser user, must use the user number
USER 1000
I also tried including following in launchSettings.json in all profiles:
"externalUrlConfiguration" : true,
Even after trying all possible solutions with my own modified images, I'm stuck. Can anyone with knowledge of .net-core and Openshift guide as to what I'm missing and how I can get this sample application up and running on Openshift cluster. Thanking in advance.
Following is the fork from original repo with the changes I tried mainly in Dockerfiles and in launchSettings.json: https://github.com/VineetKanwal1/eShopOnContainers