Hello, I have configured ory hydra in my K8s clust...
# ory-selfhosting
l
Hello, I have configured ory hydra in my K8s cluster with helm. I need to run a python script after the container is started as it is talking to the one of the hydra endpoints in order to configure something called a “json web token key set”. I was planning to run the python script inside an initcontainer. But this wont work if the hydra containers needs to be up and running for this script to run. Another solution that i was looking is to run the script as a Post-Start Lifecycle Hook. But the hydra container doesn't have python libraries. Any idea how to run a python script inside the hydra deployment ?
r
Create your own container with Python and copy hydra into it?
l
hmm... im thinking about integrating the python container as a side container...
e
wouldnt the simplest solution be to deploy a post-install job with your script?
l
Initially, I considered running the script from the initContainer, but that won't work because the Hydra endpoints need to be up and running. I also explored using the postStart lifecycle hook, but that won't work either since the Hydra container lacks the necessary Python libraries. So, I am planning to add another container to run the Python script alongside the Hydra pod like a sidecar pattern, allowing it to operate in parallel with the main Hydra container.
e
imho that is a bad idea. You will spawn that sidecar for each replika and afaik you only need to perform the operation once, right?
l
Yes.
So, do you have any recommendation ?
e
a job object with a post-install hook that will ensure it will run once, perform the script after hydra is installed and then remove itself 🙂
l
Seems like the perfect solution..
Thanks for the idea.. @enough-yak-81379
👍 1