<p>I have many FastApi apps that are running in kubernetes. All of them are using some common kubernetes functionalities like liveness and readiness probe, discovering neighbour pods using ordinals(This is my next challenge). There are some logic in code that I need to implement but in general many parts of the code stay the same like:</p>
<ol>
<li>create route for live and readiness probes</li>
<li>sending request to different ordinals of the statefulset to find neighbours, implementing the endpoints for those requests.</li>
</ol>
<p>Is there a Library that can use in my python/FastApi code to implement generic features that are available in Kubernetes.</p>

Abbas Jafari
<p>What specific feature of K8S do you want to implement in your FastAPI apps? Liveness- and readiness endpoints are easy (as in, they are endpoints you can define in FastAPI and then declare them in your YAML definition of your pod).</p>
<p>My understanding is, you want pods in a StatefulSet to communicate with each other, but you would need information from K8S to do so. E.g. you want FastAPI-Pod-1 to know it is pod 1 out of let's say 4. I would recommend the Downward API that K8S offers and built your logic around that (e.g. read pod information from environment variables): kubernetes.io/docs/tasks/inject-data-application/… I do not know of any standard framework that implements any logic for you..</p>
