<p>I am new to Kubernetes.</p>
<p>I have a k8s cron job that runs once per minute and executes a C# app that checks a SQL Server table for new records and processes them.</p>
<p>The new records are inserted based on actions the user takes on a web page.</p>
<p>I want to change the triggering mechanism.<br />
Instead of running the app every minute in k8s using a cron job, I want to instead trigger it from the website immediately after the new records have been inserted in SQL Server.</p>
<p>I am not finding answers on best practices for doing this.<br />
Would I create a k8s job to execute the app, then somehow expose a URL that can be POSTed to that will trigger the job to run?</p>

Mark Nugent
<p>There is no direct link from &quot;website to k8s&quot;</p>
<p>Your website would need to use Javascript to communicate with a backend. That backend would have an authenticated k8s client (e.g. <a href="https://github.com/kubernetes-client/csharp" rel="nofollow noreferrer"><code>kubernetes-client/csharp</code></a>) that can issue requests to the k8s api-server.</p>
<hr />
<p>Regarding the actual problem, you should ideally be using <a href="https://learn.microsoft.com/en-us/sql/relational-databases/track-changes/about-change-data-capture-sql-server?view=sql-server-ver15" rel="nofollow noreferrer">change-data-capture (CDC)</a> from the database, not a cron job. Depending on what tools you use to capture those events, then yes, you would need some kind of route/websocket to receive updates back to the front-end.</p>
