默认情况下,LangSmith 将提供多个 Kubernetes secret 来存储敏感信息,例如许可证密钥、盐值和其他配置参数。但是,您可能希望使用您已经在 Kubernetes 集群中创建(或通过某种 secret 运算符提供)的现有 secret。如果您希望以集中方式管理敏感信息,或者您有特定的安全要求,这会很有用。 默认情况下,我们将提供以下对应于 LangSmith 不同组件的 secret:
langsmith-secrets:此 secret 包含许可证密钥和其他一些基本配置参数。您可以在此处查看此 secret 的模板。
langsmith-redis:此 secret 包含 Redis 连接字符串和密码。您可以在此处查看此 secret 的模板。
langsmith-postgres:此 secret 包含 Postgres 连接字符串和密码。您可以在此处查看此 secret 的模板。
langsmith-clickhouse:此 secret 包含 ClickHouse 连接字符串和密码。您可以在此处查看此 secret 的模板。
- 现有的 Kubernetes 集群
- 在集群中创建 Kubernetes secret 的方法。这可以通过
kubectl、Helm chart 或像 Sealed Secrets 这样的 secret 运算符来完成
您需要创建自己的 Kubernetes secret,这些 secret 必须符合 LangSmith Helm Chart 提供的 secret 结构。
这些 secret 必须与 LangSmith Helm Chart 提供的 secret 具有相同的结构(请参阅上面的链接以查看特定 secret)。如果您缺少任何必需的密钥,您的 LangSmith 实例可能无法正常工作。
一个示例 secret 可能如下所示
apiVersion: v1
kind: Secret
metadata:
name: langsmith-existing-secrets
namespace: langsmith
stringData:
oauth_client_id: foo
oauth_client_secret: foo
oauth_issuer_url: foo
langsmith_license_key: foo
langgraph_cloud_license_key: foo
api_key_salt: foo
jwt_secret: foo
initial_org_admin_password: foo
blob_storage_access_key: foo
blob_storage_access_key_secret: foo
azure_storage_account_key: foo
azure_storage_connection_string: foo
配置好这些 secret 后,您可以将 LangSmith 实例配置为直接使用这些 secret,以避免通过明文传递 secret 值。您可以通过修改 LangSmith Helm Chart 安装的 langsmith_config.yaml 文件来完成此操作。
config:
existingSecretName: "langsmith-secrets" # The name of the secret that contains the license key and other basic configuration parameters
redis:
external:
enabled: true # Set to true to use an external Redis instance. This secret is only needed if you are using an external Redis instance
existingSecretName: "langsmith-redis" # The name of the secret that contains the Redis connection string and password
postgres:
external:
enabled: true # Set to true to use an external Postgres instance. This secret is only needed if you are using an external Postgres instance
existingSecretName: "langsmith-postgres" # The name of the secret that contains the Postgres connection string and password
clickhouse:
external:
enabled: true # Set to true to use an external ClickHouse instance. This secret is only needed if you are using an external ClickHouse instance
existingSecretName: "langsmith-clickhouse" # The name of the secret that contains the ClickHouse connection string and password
配置完成后,您需要更新 LangSmith 安装。您可以按照我们的升级指南此处进行操作。如果一切配置正确,您的 LangSmith 实例现在应该可以通过 Ingress 访问。您可以运行以下命令来检查您的 secret 是否正确使用:
kubectl describe deployment langsmith-backend | grep -i <secret-name>
您应该在输出中看到类似以下内容:
POSTGRES_DATABASE_URI: <set to the key 'connection_url' in secret <your-secret-name> Optional: false
CLICKHOUSE_DB: <set to the key 'clickhouse_db' in secret <your-secret-name> Optional: false