https://prefect.io logo
Title
t

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.
1
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 --from-file=id_rsa.pub=/path/to/.ssh/id_rsa.pub
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.
b

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: https://discourse.prefect.io/t/how-to-set-secrets-e-g-github-access-token-on-server/70 Example #5 may also be helpful to you.
t

Tony Yun

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