Exception at startup (missing config or secret): logs --previous shows InvalidOperationException or OptionsValidationException.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | // ====================================================================== // Q: A pod is in CrashLoopBackOff. What do you do? // // - Exception at startup (missing config or secret): logs --previous shows // InvalidOperationException or OptionsValidationException. // - OOMKilled: describe shows Last State: Terminated, Reason: OOMKilled. // - Liveness probe too strict: Events show Liveness probe failed, with restarts // and no exception in the logs. // - Wrong port: the probe fails; the app listens on 8080 but the manifest says // 80. // - ImagePullBackOff: wrong tag or missing access to the registry (ACR). // ValidateOnStart() on Options makes a bad setting show up immediately at // startup with a clear message, instead of later on the first request. // ====================================================================== // Fail fast on invalid configuration builder.Services.AddOptions<ErpOptions>() .BindConfiguration("Erp") .ValidateDataAnnotations() .ValidateOnStart(); // the pod fails immediately, with a clear message in the logs |