Scheduling a pod to specific node after some egress tests

Hi, I came across specific use case. Below are the details. Would like to know any IDEA’s to acheive it.

Deployment X would like to schedule a pod after certain egress tests passes. If test fails in first node then continue to other node and run egress tests if passes schedule the pod in the node.

  • Explored the option of using init containers, however the main problem is if the egress tests fails, the pod will not get moved to another node.

  • Tried to explored the option of using custom schedulers. But, i’ve limited knowledge now, how i can incorporate the testing logic to custom scheduler.

I am not sure, if there is a native way to satisfy this use case.

Cluster information:

Kubernetes version: 1.24.X

Cloud being used: bare-metal

Installation method: kubeadm

Host OS: Ubuntu

CNI and version: Calico v3.25.0

CRI and version: ContainerD v1.6.15