主题
为安装使用现有 Secret(Kubernetes)
默认情况下,LangSmith 会创建多个 Kubernetes Secret 来存储敏感信息,例如许可证密钥、盐值和其他配置参数。不过,你可能希望使用已在 Kubernetes 集群中创建(或通过某种 secrets operator 预配)的现有 Secret。如果你希望集中管理敏感信息,或有特定的安全要求,这会很有用。
默认情况下,我们会为 LangSmith 的不同组件创建以下 Secret:
langsmith-secrets:此 Secret 包含许可证密钥和其他一些基本配置参数。要开始使用,请参考 secrets 模板。langsmith-redis:此 Secret 包含 Redis 连接字符串(如果使用 Redis 集群,则为节点 URI)和密码。要开始使用,请参考 Redis secrets 模板。langsmith-postgres:此 Secret 包含 Postgres 连接字符串和密码。要开始使用,请参考 Postgres secrets 模板。langsmith-clickhouse:此 Secret 包含 ClickHouse 连接字符串和密码。要开始使用,请参考 ClickHouse secrets 模板。
要求
- 一个现有的 Kubernetes 集群
- 一种在集群中创建 Kubernetes Secret 的方式。可以使用
kubectl、Helm chart,或 Sealed Secrets 之类的 secrets operator
参数
你需要创建自己的 Kubernetes Secret,其结构必须遵循 LangSmith Helm Chart 所创建 Secret 的结构。
WARNING
这些 Secret 的结构必须与 LangSmith Helm Chart 所创建的一致(请参考上方链接查看具体的 Secret)。如果缺少任何必需的键,你的 LangSmith 实例可能无法正常工作。
一个示例 Secret 可能如下所示:
WARNING
请设置一次 api_key_salt,之后不要更改。该值用于在静态存储时对所有 API key 进行哈希。轮换该值会永久使组织中所有现有 API key 失效,所有用户都需要重新生成密钥。
yaml
apiVersion: v1
kind: Secret
metadata:
name: langsmith-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
agent_builder_encryption_key: foo
insights_encryption_key: foo
# Chat (formerly Polly)
polly_encryption_key: foo
# Required only when enabling Engine.
engine_encryption_key: foo
# Optional; include only while rotating engine_encryption_key. Accepted for
# decryption only, so runs encrypted just before the swap still complete.
engine_encryption_key_previous: foo
# Optional. Ed25519/OKP JWKS (JSON) that signs OAuth Authorization Server /
# Remote MCP tokens. Required only to enable the LangSmith Remote MCP server
# (see /langsmith/langsmith-remote-mcp); omit it otherwise.
langsmith_signing_jwks: foo
# Required only when enabling LangSmith Sandboxes.
sandbox_x_service_auth_jwt_secret: foo
# Ed25519 private JWK.
sandbox_callback_signing_jwk: '<ed25519-private-jwk>'
# Optional; include only while rotating sandbox_x_service_auth_jwt_secret.
sandbox_x_service_auth_jwt_secret_previous: foo配置
创建这些 Secret 后,你可以配置 LangSmith 实例直接使用它们,从而避免以明文传递密钥值。具体做法是修改 LangSmith Helm Chart 安装的 langsmith_config.yaml 文件。
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 是否被正确使用:
bash
kubectl describe deployment langsmith-backend | grep -i <secret-name>你应该会在输出中看到类似以下内容:
bash
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