我正在使用Nuclio函数,我需要在函数中为访问数据库等提供凭据。是否有一种方法可以安全地存储这些凭据(不是纯文本)?
发布于 2022-06-22 17:45:42
你可以在核子函数中使用Kubernetes秘密。有几个步骤来设置它。
kubectl create secret generic db-user-pass --from-literal=username=devuser --from-literal=password='<A-Password-Here>'
然后,
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()
the_secret_inside_nuclio_to_use = os.getenv('a-secret-name')
https://stackoverflow.com/questions/72690551
复制相似问题