dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.52k stars 10.35k forks source link

eShop Kubernetes pods fail - incorrect .NET Core version #319

Closed jamesbannan closed 7 years ago

jamesbannan commented 7 years ago

I've completed a deployment of eShopOnContainers to Kubernetes using VSTS. Everything worked, but every service which was deployed using the "eshop" containers failed to launch properly.

Every pod failed with the same error:

This is confusing, as according to the Dockerfiles on these images, they are all based on microsoft/aspnetcore:2.0.0 which is supposed to have the latest version of .NET Core.

Anyone else seeing this behaviour?

eiximenis commented 7 years ago

Hi!

Have you tried the images locally? Worked their using netcore2?

What is the source of the images configured in k8s?

jamesbannan commented 7 years ago

Hi @eiximenis - thanks for the response. The netcore2 branch works during the "dotnet restore" step but fails during "dotnet publish" as there is still a dependency on .NET Core 1.x.

I haven't tried the images locally, yet - in K8s the image source is steamacr1.azurecr.io, as I built and pushed the Docker images from VSTS to a private container registry.

jamesbannan commented 7 years ago

I tried modifying one of the eshop containers to use microsoft/aspnetcore:2.0.0 and this time got a bit further. However the container still failed with the following:

2017-09-06T12:37:08.693767551Z crit: Microsoft.AspNetCore.Server.Kestrel[0] 2017-09-06T12:37:08.693788951Z Unable to start Kestrel. 2017-09-06T12:37:08.693792751Z System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase(). 2017-09-06T12:37:08.693795951Z at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__7.MoveNext() 2017-09-06T12:37:08.693799051Z --- End of stack trace from previous location where exception was thrown ---

eiximenis commented 7 years ago

Hi! Do you use the build container or just build the app using the CLI?

We have an issue that requires to have both netcore1.1 & netcore2 installed on same time (and build container do no have it). It is because the dotnet bundle command of Identity.API that is current on netcore1.1. We are waiting for IdSvr to be migrated to netcore2 to update Identity.API image and all its dependences.

Anyway, i'll test and I will update the public images on DockerHub, to allow you (and anyone) to deploy k8s.

I'll come back tomorrow with news about that.

jamesbannan commented 7 years ago

I am using the CLI on the VSTS Build agent to build out the application. The build agent is running Ubuntu 16.04 LTS with .NET Core 2.0.0 + SDK.

Because I can't get the "dotnet publish" step to complete using .NET Core 2.0.0 (although "dotnet restore" works), I am using a VSTS step to install and enable .NET Core SDK 1.0.4.

Should I get rid of .NET Core 2.0.0 on the build agent and replace it with the latest 1.x version?

eiximenis commented 7 years ago

Hi!

tried modifying one of the eshop containers to use microsoft/aspnetcore:2.0.0 and this time got a bit further. However the container still failed with the following:

Yes, this is detected and a patch for it is on the way. Will be hopefully released today to dev branch. This is due to a breaking change introduced in netcore2.

eiximenis commented 7 years ago

Hi again. I updated the dev branch with the needed fixes to avoid the error A path base can only be configured using IApplicationBuilder.UsePathBase()

Also updated the k8s deployment script. Everything should work now.

I also updated the images of DockerHub (the ones tagged with dev tag). If you don't want to build the images you should be able to deploy the dockerhub images with:

 .\deploy.ps1 -configFile .\conf_local.yml -imageTag dev -buildImages $false
jamesbannan commented 7 years ago

Hi @eiximenis - thanks very much for the update. So just to confirm: 1) build from the dev branch, and 2) only use .NET Core 2.0.0 on the VSTS build agent? I'll give that a try shortly.

jamesbannan commented 7 years ago

Hi @eiximenis - another road block, unfortunately. The Identity.API is still referencing netcoreapp1.1 so the "dotnet publish" step fails on the build agent as it only has access to .NET Core 2.0. Do both frameworks need to be installed on the build agent or can the Identity.API be updated to use netcoreapp2.0?

CESARDELATORRE commented 7 years ago

We still cannot update the Identity service to netcore2 because IdentityServer4 still doesn't support netcore2. So yes, you'd need netcore1.1 for that case, temporary

jamesbannan commented 7 years ago

@CESARDELATORRE Thanks Cesar - I had some issues installing both .NET Core 2.0 and .NET Core 1.1 due to some issues with the package listing (https://github.com/dotnet/core-setup/issues/2339). However, got that sorted and I've been able to do a full build, publish and deploy to Kubernetes from the dev branch :-) Thanks to you and @eiximenis for the asistance - I'll close this issue down now.