A .NET container starts but the app isn't reachable. What would you check?
IntermediateTroubleshooting.NET builds (dotnet CLI)
Answer
Short answer
Usually the app is listening on the wrong address or port. Check which URL Kestrel reports at startup, that it's bound to 0.0.0.0/+ and not localhost, that the port matches EXPOSE, the docker -p mapping and the Kubernetes Service targetPort, and that HTTPS redirection isn't sending traffic to a port nobody listens on.
Checklist
docker logs shop-api # "Now listening on: http://[::]:8080" ← which port?
| Problem | Fix |
|---|---|
Listening on http://localhost:5000 |
ASPNETCORE_URLS=http://+:8080 |
| .NET 8 listens on 8080 but Service targets 80 | Change targetPort to 8080 (or set ASPNETCORE_HTTP_PORTS=80) |
UseHttpsRedirection() redirects to 443 with no cert |
Terminate TLS at Ingress; disable redirect in container or set forwarded headers |
| App crashed after start | Check logs for missing config (connection string, env) |
| Probe path wrong | Use app.MapHealthChecks("/health") and point probes there |
What to say in the interview
"I read the 'Now listening on' line. Typical causes are binding to localhost, the .NET 8 port change from 80 to 8080 not matching the Service, or HTTPS redirection inside the container when TLS is handled by the Ingress."