My application requires to communicate with a third party services over REST API, for which in needs to send a POST
request to /auth
and the third-party system responses with a token. that token can then be used for the subsequent calls and it's valid up to 12 hours
.
At the moment the /auth
calls happen when the first request comes to the POD, and that takes few seconds. I am trying to make changes so that the POD always gets the token before serving any request.
The solution I am thinking is to use Readiness Probe in Kubernetes to get the api token before the POD become available. Is this the ideal way of solving the issue?
If so, how can I automatically re-create my POD every 12 hours? Because if I don't delete the pod after 12 hours, the token become invalid.