我有一个伙伴关系。 NET 核心6应用在Kubernetes。 在启动阶段,它只是为启动伙伴关系制定典型的守则。 NET 核心应用。 现在突然开始,但并不总是在<代码>builder.Build()打电话(我用Console表示)。 在进入<代码>Startup级的构造之前,以及在经过一段时间后,K8S将杀死od。
我不知道如何进一步调查这一问题。 是什么原因?
Is there something I can try to change in the code or in the configuration of the application? Or could there be something in Kubernetes that could cause this issue to suddenly appear?
public static void Main(string[] args)
{
var builder = CreateHostBuilder(args);
var host = builder.Build(); // hangs here
host.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
var builder = Host.CreateDefaultBuilder(args);
builder = builder.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
return builder;
}
Added:
Running kubectl logs <pod_name>
will only produce some logs from linkerd, which does not show me anything weird (the errors look like failing health check, which makes sense given the application does not fully start up):
Defaulted container "linkerd-proxy" out of: linkerd-proxy, <deployment_name>, linkerd-init (init)
[ 0.020493s] INFO ThreadId(01) linkerd2_proxy::rt: Using single-threaded proxy runtime
[ 0.021883s] INFO ThreadId(01) linkerd2_proxy: Admin interface on 0.0.0.0:4191
[ 0.021913s] INFO ThreadId(01) linkerd2_proxy: Inbound interface on 0.0.0.0:4143
[ 0.021927s] INFO ThreadId(01) linkerd2_proxy: Outbound interface on 127.0.0.1:4140
[ 0.021935s] INFO ThreadId(01) linkerd2_proxy: Tap DISABLED
[ 0.021941s] INFO ThreadId(01) linkerd2_proxy: Local identity is default.default.serviceaccount.identity.linkerd.cluster.local
[ 0.021948s] INFO ThreadId(01) linkerd2_proxy: Identity verified via linkerd-identity-headless.linkerd.svc.cluster.local:8080 (linkerd-identity.linkerd.serviceaccount.identity.linkerd.cluster.local)
[ 0.021954s] INFO ThreadId(01) linkerd2_proxy: Destinations resolved via linkerd-dst-headless.linkerd.svc.cluster.local:8086 (linkerd-destination.linkerd.serviceaccount.identity.linkerd.cluster.local)
[ 0.043719s] INFO ThreadId(02) daemon:identity: linkerd_app: Certified identity id=default.default.serviceaccount.identity.linkerd.cluster.local
[ 17.330501s] INFO ThreadId(01) inbound:server{port=80}:rescue{client.addr=87.233.137.147:47108}: linkerd_app_core::errors::respond: HTTP/1.1 request failed error=error trying to connect: Connection refused (os error 111) error.sources=[Connection refused (os error 111)]
[ 37.318022s] INFO ThreadId(01) inbound:server{port=80}:rescue{client.addr=87.233.137.147:49918}: linkerd_app_core::errors::respond: HTTP/1.1 request failed error=error trying to connect: Connection refused (os error 111) error.sources=[Connection refused (os error 111)]
[ 57.317661s] INFO ThreadId(01) inbound:server{port=80}:rescue{client.addr=87.233.137.147:55614}: linkerd_app_core::errors::respond: HTTP/1.1 request failed error=error trying to connect: Connection refused (os error 111) error.sources=[Connection refused (os error 111)]
[ 77.317162s] INFO ThreadId(01) inbound:server{port=80}:rescue{client.addr=87.233.137.147:49574}: linkerd_app_core::errors::respond: HTTP/1.1 request failed error=error trying to connect: Connection refused (os error 111) error.sources=[Connection refused (os error 111)]
[ 97.317333s] INFO ThreadId(01) inbound:server{port=80}:rescue{client.addr=87.233.137.147:41688}: linkerd_app_core::errors::respond: HTTP/1.1 request failed error=error trying to connect: Connection refused (os error 111) error.sources=[Connection refused (os error 111)]```