跳到主要内容
默认情况下,LangSmith 将为 langsmith-frontend 配置一个 LoadBalancer 服务。根据您的云提供商,这可能会导致为该服务分配一个公共 IP 地址。如果您想使用自定义域或对流向 LangSmith 安装的流量路由进行更多控制,您可以配置 Ingress、Gateway API 或 Istio Gateway。

要求

  • 一个现有的 Kubernetes 集群
  • 以下之一已安装在您的 Kubernetes 集群中
    • 一个 Ingress Controller(用于标准 Ingress)
    • Gateway API CRD 和一个 Gateway 资源(用于 Gateway API)
    • Istio(用于 Istio Gateway)

参数

您可能需要为您的 LangSmith 安装提供某些参数来配置 Ingress。此外,我们希望将 langsmith-frontend 服务转换为 ClusterIP 服务。
  • 主机名(可选):您希望用于 LangSmith 安装的主机名。例如 "langsmith.example.com"。如果留空,Ingress 将向 LangSmith 安装提供所有流量。
  • BasePath(可选):如果您想在 URL 基本路径下提供 LangSmith,您可以在此处指定。例如,添加 "langsmith" 将在 "example.hostname.com/langsmith" 提供应用程序。这将适用于 UI 路径和 API 端点。
  • IngressClassName(可选):您希望使用的 Ingress 类的名称。如果未设置,将使用默认 Ingress 类。
  • Annotations(可选):要添加到 Ingress 的附加注解。某些提供商(如 AWS)可能会使用注解来控制 TLS 终止等功能。 例如,您可以使用 AWS ALB Ingress Controller 添加以下注解,将 ACM 证书附加到 Ingress:
    annotations:
      alb.ingress.kubernetes.io/certificate-arn: "<your-certificate-arn>"
    
  • Labels(可选):要添加到 Ingress 的附加标签。
  • TLS(可选):如果您想通过 HTTPS 提供 LangSmith,您可以在此处添加 TLS 配置(许多 Ingress 控制器可能有其他控制 TLS 的方法,因此通常不需要)。这应该是一个 TLS 配置数组。每个 TLS 配置应具有以下字段:
    • hosts:证书应有效的宿主数组。例如 [“langsmith.example.com”]
    • secretName:包含证书和私钥的 Kubernetes 秘密的名称。此秘密应具有以下键:
      • tls.crt:证书
      • tls.key:私钥
    • 您可以在此处阅读有关创建 TLS 秘密的更多信息。

配置

您可以将 LangSmith 实例配置为使用以下三种路由选项之一:标准 Ingress、Gateway API 或 Istio Gateway。选择最适合您的基础架构的选项。

选项 1:标准 Ingress

有了这些参数,您可以配置 LangSmith 实例以使用 Ingress。您可以通过修改 LangSmith Helm Chart 安装的 config.yaml 文件来完成此操作。
config:
  hostname: "" # Main domain for LangSmith
  basePath: "" # If you want to serve langsmith under a URL base path (e.g., /langsmith)
ingress:
  enabled: true
  hostname: "" # Deprecated: Use config.hostname instead after v0.12.0
  subdomain: "" # Deprecated: Use config.hostname instead after v0.12.0
  ingressClassName: "" # If not set, the default ingress class will be used
  annotations: {} # Add annotations here if needed
  labels: {} # Add labels here if needed
  tls: [] # Add TLS configuration here if needed
frontend:
  service:
    type: ClusterIP
配置完成后,您需要更新 LangSmith 安装。如果一切配置正确,您的 LangSmith 实例现在应该可以通过 Ingress 访问。您可以运行以下命令来检查 Ingress 的状态:
kubectl get ingress
您应该在输出中看到类似以下内容:
NAME                         CLASS   HOSTS    ADDRESS          PORTS     AGE
langsmith-ingress            nginx   <host>   35.227.243.203   80, 443   95d
如果您没有自动 DNS 设置,则需要手动将 IP 地址添加到您的 DNS 提供商。

选项 2:Gateway API

Gateway API 支持自 LangSmith v0.12.0 起可用
如果您的集群使用 Kubernetes Gateway API,您可以配置 LangSmith 来提供 HTTPRoute 资源。这将为 LangSmith 创建一个 HTTPRoute,并为每个代理部署创建一个 HTTPRoute。

参数

  • 名称(必需):要引用的 Gateway 资源的名称
  • 命名空间(必需):Gateway 资源所在的命名空间
  • 主机名(可选):您希望用于 LangSmith 安装的主机名。例如 "langsmith.example.com"
  • 基本路径(可选):如果您想在基本路径下提供 LangSmith,您可以在此处指定。例如“example.com/langsmith”
  • sectionName(可选):要使用的 Gateway 中特定监听器部分的名称
  • annotations(可选):要添加到 HTTPRoute 资源的附加注解
  • labels(可选):要添加到 HTTPRoute 资源的附加标签

配置

config:
  hostname: "" # Main domain for LangSmith
  basePath: "" # If you want to serve langsmith under a base path. E.g "example.com/langsmith"
gateway:
  enabled: true
  name: "my-gateway" # Name of your Gateway resource
  namespace: "gateway-system" # Namespace of your Gateway resource
  sectionName: "" # Optional: specific listener section name
  annotations: {} # Add annotations here if needed
  labels: {} # Add labels here if needed
frontend:
  service:
    type: ClusterIP
配置完成后,您可以检查 HTTPRoutes 的状态
kubectl get httproute

选项 3:Istio Gateway

Istio Gateway 支持自 LangSmith v0.12.0 起可用
如果您的集群使用 Istio,您可以配置 LangSmith 来提供 VirtualService 资源。这将为 LangSmith 创建一个 VirtualService,并为每个代理部署创建一个 VirtualService。

参数

  • 名称(可选):要引用的 Istio Gateway 资源的名称。默认为 "istio-gateway"
  • 命名空间(可选):Istio Gateway 资源所在的命名空间。默认为 "istio-system"
  • 主机名(可选):您希望用于 LangSmith 安装的主机名。例如 "langsmith.example.com"
  • 基本路径(可选):如果您想在基本路径下提供 LangSmith,您可以在此处指定。例如“example.com/langsmith”
  • annotations(可选):要添加到 VirtualService 资源的附加注解
  • labels(可选):要添加到 VirtualService 资源的附加标签

配置

config:
  hostname: "" # Main domain for LangSmith
  basePath: "" # If you want to serve langsmith on a separate basePath. E.g "example.com/langsmith"
istioGateway:
  enabled: true
  name: "istio-gateway" # Name of your Istio Gateway resource
  namespace: "istio-system" # Namespace of your Istio Gateway resource
  annotations: {} # Add annotations here if needed
  labels: {} # Add labels here if needed
frontend:
  service:
    type: ClusterIP
配置完成后,您可以检查 VirtualService 的状态
kubectl get virtualservice

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.