以编程方式使用文档

默认情况下,LangSmith 会配置多个 Kubernetes 密钥来存储敏感信息,如许可证密钥、盐值和其他配置参数。但是,您可能希望使用已在 Kubernetes 集群中创建的现有密钥(或通过某种密钥运算符配置的密钥)。如果您想集中管理敏感信息或有任何特定的安全要求,这会非常有用。

默认情况下,我们将配置以下对应于 LangSmith 不同组件的密钥:

  • * langsmith-secrets:此密钥包含许可证密钥和其他一些基本配置参数。要开始使用,请参考 密钥模板.
  • * langsmith-redis:此密钥包含 Redis 连接字符串(或使用 Redis 集群时的节点 URI)和密码。要开始使用,请参考 Redis 密钥模板.
  • * langsmith-postgres:此密钥包含 Postgres 连接字符串和密码。要开始使用,请参考 Postgres 密钥模板.
  • * langsmith-clickhouse:此密钥包含 ClickHouse 连接字符串和密码。要开始使用,请参考 ClickHouse 密钥模板.

要求

  • * 一个现有的 Kubernetes 集群
  • * 在集群中创建 Kubernetes 密钥的方式。可以使用 kubectl、Helm chart 或密钥运算符如 Sealed Secrets

参数

您需要创建自己的 Kubernetes 密钥,这些密钥需要遵循 LangSmith Helm Chart 配置的密钥结构。

密钥示例可能如下所示:

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
  # 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

配置

配置了这些密钥后,您可以配置 LangSmith 实例直接使用这些密钥,以避免通过明文传递密钥值。您可以通过修改 langsmith_config.yaml LangSmith Helm Chart 安装的文件来完成此操作。

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 访问。您可以运行以下命令来检查您的密钥是否正确使用:

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