Rod*_*one 5 google-cloud-platform kubernetes dockerfile
我正在将一个dotnet核心应用程序设置为kubernetes集群,我收到错误"无法启动红隼".
Dockerfile在本地计算机上运行正常.
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
Unhandled Exception: System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found.
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found.
Unable to start Kestrel.
Run Code Online (Sandbox Code Playgroud)
我的dockerfile:
[...build step]
FROM microsoft/dotnet:2.1-aspnetcore-runtime
COPY --from=build-env /app/out ./app
ENV PORT=5000
ENV ASPNETCORE_URLS=http://+:${PORT}
WORKDIR /app
EXPOSE $PORT
ENTRYPOINT [ "dotnet", "Gateway.dll" ]
Run Code Online (Sandbox Code Playgroud)
我期望应用程序成功启动,但我收到此错误"无法启动红隼".
[ 更新 ]
我从应用程序中删除了https端口并在没有https的情况下再次尝试,但现在应用程序只是启动和停止而没有任何错误或警告.容器日志波纹管:
使用dotnet运行本地运行或构建映像并从容器运行,一切正常.应用程序刚关闭到kubernetes.
我使用的是dotnet core 2.2
[ 更新 ]
我已经生成了一个证书,在项目中添加,在kestrel中设置,我得到了相同的结果.Localhost使用docker imagem它工作,但在kubernetes(谷歌云),它只是在它启动后立即关闭.
本地主机:
$ docker run --rm -it -p 5000:5000/tcp -p 5001:5001/tcp juooo:latest
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {f7808ac5-0a0d-47d0-86cb-c605c2db84a3} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'https://+:5001, http://+:5000'. Binding to endpoints defined in UseKestrel() instead.
Hosting environment: Production
Content root path: /app
Now listening on: https://0.0.0.0:5001
Application started. Press Ctrl+C to shut down.
Run Code Online (Sandbox Code Playgroud)
我发现一个事件日志,其中包含 kubernetes 错误,指出 kubernetes 无法命中 (:5000/)。所以我尝试创建一个针对根应用程序的控制器(因为它是一个 api,所以没有像网络应用程序那样的根)并且它起作用了。
| 归档时间: |
|
| 查看次数: |
412 次 |
| 最近记录: |