<p>I have an asp.net core 3.1 web api app. Can I write an end point by which if I call this the entire application will go into hung or deadlock situation? or a background task where I wrote some code to make this happen?</p>
<p>I am trying to test Kubernetes Liveness probe which I wrote as a health check endpoint in asp.net core web API application.</p>
<p>Thanks.</p>

user584018
<p>If it's for testing some kind of hung situation, you can do something like making the thread / process to sleep. Make sure that the sleep period is greater than the <code>timeoutSeconds</code> configuration of the <code>livenessProbe</code>.</p>
<p>Or if you want to simulate the app to be down, you can also return http status &gt;= 400 (ex: 500 / Internal Server Error) in the API response, so that livenessProbe will think the app is not healthy.</p>
<p><code>livenessProbe</code> also has <code>failureThreshold</code> which is used to indicate how many failures to tolerate before K8 will terminate the pod, so if you want the pod to be terminated after just 1 failure, set it to 1.</p>
