I am using Nuclio functions and I need to provide credentials in the function for things like accessing database etc. Is there a way to store these credentials securely (not plain text) ?
Asked
Active
Viewed 69 times
1 Answers
0
You can use Kubernetes secret in an Nuclio function. There are several steps to set this up.
create a Kubernetes secret, simple example using kubectl like this:
kubectl create secret generic db-user-pass --from-literal=username=devuser --from-literal=password='<A-Password-Here>'
Then create an Nuclio function with set_env_from_secret like this:
fn = mlrun.code_to_function("nuclio-with-secret", kind='nuclio', image='mlrun/mlrun', handler="handler") fn.set_env_from_secret("a-secret-name", "db-user-pass", "password") fn.apply(mlrun.auto_mount()) fn.deploy()
In your Nuclio function, you can use the secret like this:
the_secret_inside_nuclio_to_use = os.getenv('a-secret-name')

xsqian
- 199
- 5
- 13