默认情况下,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 安装提供所有流量。
  • 基本路径(可选):如果您想在 URL 基本路径下提供 LangSmith,可以在此处指定。例如,添加 "langsmith" 将在 "example.hostname.com/langsmith" 提供应用程序。这将应用于 UI 路径以及 API 端点。
  • IngressClassName(可选):您希望使用的 Ingress 类的名称。如果未设置,将使用默认 Ingress 类。
  • 注释(可选):要添加到 Ingress 的其他注释。某些提供商(如 AWS)可能使用注释来控制诸如 TLS 终止之类的内容。 例如,您可以使用 AWS ALB Ingress Controller 添加以下注释以将 ACM 证书附加到 Ingress:
    annotations:
      alb.ingress.kubernetes.io/certificate-arn: "<your-certificate-arn>"
    
  • 标签(可选):要添加到 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: "" # LangSmith 的主域
  basePath: "" # 如果您想在 URL 基本路径下提供 langsmith(例如,/langsmith)
ingress:
  enabled: true
  hostname: "" # 已弃用:在 v0.12.0 之后改用 config.hostname
  subdomain: "" # 已弃用:在 v0.12.0 之后改用 config.hostname
  ingressClassName: "" # 如果未设置,将使用默认 Ingress 类
  annotations: {} # 如果需要,在此处添加注释
  labels: {} # 如果需要,在此处添加标签
  tls: [] # 如果需要,在此处添加 TLS 配置
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。

参数

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

配置

config:
  hostname: "" # LangSmith 的主域
  basePath: "" # 如果您想在基本路径下提供 langsmith。例如 "example.com/langsmith"
gateway:
  enabled: true
  name: "my-gateway" # 您的 Gateway 资源的名称
  namespace: "gateway-system" # 您的 Gateway 资源的命名空间
  sectionName: "" # 可选:特定侦听器部分名称
  annotations: {} # 如果需要,在此处添加注释
  labels: {} # 如果需要,在此处添加标签
frontend:
  service:
    type: ClusterIP
配置完成后,您可以检查 HTTPRoute 的状态:
kubectl get httproute

Option 3: Istio Gateway

Istio Gateway support is available as of LangSmith v0.12.0
If your cluster uses Istio, you can configure LangSmith to provision VirtualService resources. This will create a VirtualService for LangSmith and a VirtualService for each agent deployment.

Parameters

  • name (optional): The name of the Istio Gateway resource to reference. Defaults to "istio-gateway"
  • namespace (optional): The namespace where the Istio Gateway resource is located. Defaults to "istio-system"
  • hostname (optional): The hostname that you would like to use for your LangSmith installation. E.g "langsmith.example.com"
  • basePath (optional): If you would like to serve LangSmith under a base path, you can specify it here. E.g “example.com/langsmith”
  • annotations (optional): Additional annotations to add to the VirtualService resources
  • labels (optional): Additional labels to add to the VirtualService resources

Configuration

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
Once configured, you can check the status of your VirtualServices:
kubectl get virtualservice

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.