Unregister worker prior to shutdown

Hello folks,

I was just wondering if there is a way to tell the Boundary worker to unregister itself before shutting down. Either by running it with some specific configuration or by hacking the way through it… supposedly making an API call to the controller’s /v1/workers/{id} endpoint with the DELETE method and passing a token with the right privileges (this is part of the question too - I’m obviously looking for a solution that doesn’t require passing an admin token to a Pod as a Secret or Env). Ideally this imaginary token would only work for that specific worker.

It seems to me the worker does not store any kind of token on the filesystem that would allow me to make that call on its behalf (even a short-lived one would do).

A little bit of context, we’re running boundary on Kubernetes (EKS) with AWS KMS auth. Although the worker Pods now have been named explicitly by the StatefulSet that controls them, I would like to be able to use Deployments for workers too. That would mean the hostnames of the Pods would be a lot more dynamic and unpredictable and I could end up with a lot of registered workers that aren’t active (that’s a problem if you scale down the StatefulSet as well).

Whatever way the unregistration could be done, it’s likely that I can run it as a preStop lifecycle handler for those Pods.


Hi @macmiranda, this is a good idea, could you submit a feature request on Github?

Hi @xingluw here is the link to the issue