<p>I need to run a script on a <em>node</em> shell level (<strong>not inside the container</strong>) whenever a pod is scheduled or unscheduled on it. I've searched documentation, but found only ways to add hooks running inside containers (<a href="https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/</a>, <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes</a>). Does kubernetes have an API I could use to achieve this somehow?
Thanks!</p>

morgwai
<p>This is what you should do</p>

<ol>
<li>use event exporter to capture those events</li>
<li>Deploy a webhook service</li>
<li>invoke the webhook when shedule or unshedule event happens</li>
<li>via webhook you should be able to trigger a script</li>
</ol>
