I am trying to deploy a asp .net 5 app to Google Kubernetes Engine. Before i do this with my production application i thought it best to start with the basics and deploy a simple .net 5 web app.
I have created a simple web app
mkdir HellowWorldAspNet
cd HellowWorldAspNet
dotnet new web
dotnet restore
dotnet publish
cd \bin\Debug\net5.0\publish
Then I created a Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS build
ADD ./ /app
ENV ASPNETCORE_URLS=http://*:${PORT}
WORKDIR /app
ENTRYPOINT [ "dotnet", "HellowWorldAspNetCore.dll" ]
Now I try to push it up to Google cloud K8s
// publish the google container
gcloud builds submit --tag gcr.io/{MyProject}/hello-dotnet:v1
// run the pod
kubectl run hello-dotnet --image gcr.io/{MyProject}/hello-dotnet:v1 --port=8080
// Show what pods are running
kubectl get pods
Shows
When i check the logs for the pod i see
kubectl logs hello-dotnet
The specified framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found.
- Check application dependencies and target a framework version installed at: /usr/share/dotnet/shared/Microsoft.AspNetCore.App
- Alternatively, install the framework version '5.0.0'.
I am assuming it has something to do with the docker file but as far as i can tell this should be FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS build telling it to at least build with .net 5 how do I tell it to run with it as well?
Changing it to
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
Didn't seam to help.