Sending a cancel request to a pod


I think I know the answer already, (not possible) but I still am hoping. I am trying to run an app in k8s (just experimenting locally with minikube so far). It is essentially stateless except for one small thing.

I am using an Nginx Ingress to Service to Deployment.

The app receives an HTTP request with a config to perform a long-running job and returns a job id (it can be running more than one job). In most cases the job runs to completion but sometimes we need to cancel a job. The HTTP delete request is sent with the job id, but I can not find a way to know which pod in the deployment is handling the job.

Stateful sets don’t get me much farther, since even with a reliable network name I need to somehow track which pod is handling which job.

Basically I want the benefit of an autoscaling but I need to be able to tell a pod to quit based on a HTTP parameter. To me, this seems like it must be a common requirement, even for a stateless app (I realize that the requirement probably makes it technically stateful).

I am hoping someone has solved this before and can advise me :slight_smile:

(Also I don’t think using separate deployments with a single pod gets me any closer, I still cannot target a deployment and I lose autoscaling).

Thanks very much for your time!