Tony Yun

08/17/2022, 8:07 PM
Hi, could anyone suggest how do we set up ssh keys in prefect kubernetes agent? we need to connect to a SFTP server that we can only let local development env work but not after register the flow.
I just learned that we can create k8s secret in this way:
kubectl create secret generic ssh-keys --from-file=id_rsa=/path/to/.ssh/id_rsa
But how can we mount the ssh key to Prefect flow job? In all answers I see, it needs to be specified in k8s pod definition.

Bianca Hoch

08/18/2022, 2:30 PM
Hello Tony, are you using prefect 1? I believe you can accomplish this by passing the secrets (ssh keys) to the agent as an environment variable. Check out example #2 in this article: Example #5 may also be helpful to you.

Tony Yun

08/19/2022, 7:34 PM
got it thanks!
🙌 1