dapr / quickstarts

Dapr quickstart code samples and tutorials showcasing core Dapr capabilities
Apache License 2.0
1.02k stars 516 forks source link

Pub-sub tutorial csharp-subscriber pod crash, running .NET8 in .NET7 container #1000

Open antontroshin opened 3 months ago

antontroshin commented 3 months ago

Expected Behavior

When following the tutorial to run pub-sub in Kubernetes, during the deployment step, all applications are expected to start and be healthy. https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub#deploy-assets

Actual Behavior

csharp-subscriber pods crash looping with the following error from pod

You must install or update .NET to run this application.

App: /app/csharp-subscriber.dll
Architecture: arm64
Framework: 'Microsoft.NETCore.App', version '8.0.0' (arm64)
.NET location: /usr/share/dotnet/

The following frameworks were found:
  7.0.16 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=arm64&rid=debian.11-arm64

The project file has .NET target 8.0 https://github.com/dapr/quickstarts/blob/6c1392af01bef762efeef44a79a14af8a14f2c18/tutorials/pub-sub/csharp-subscriber/csharp-subscriber.csproj#L4

While docker uses .NET 7 base image. https://github.com/dapr/quickstarts/blob/6c1392af01bef762efeef44a79a14af8a14f2c18/tutorials/pub-sub/csharp-subscriber/Dockerfile#L4

Steps to Reproduce the Problem

Follow the pub-sub tutorial to run apps in Kubernetes https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub#run-in-kubernetes

  1. Setup Redis
  2. Deploy assets
  3. Observe pods of csharp-subscriber crashing
  4. Observe log with kubectl logs deployments/csharp-subscriber
sitistas commented 3 months ago

One workaround is to use a previous version of the image, for my case the version 1.12 worked fine. Just change the image field in the cshapr-subscriber.yaml file as follows:

...
        image: ghcr.io/dapr/samples/pubsub-csharp-subscriber:1.12
...