无法在 Google Cloud 中的现有 Kubernetes 服务上创建基于标头的外部 HTTPS LBS 路由规则

问题描述

我正在尝试更改现有的外部 HTTPS LBS 配置以在 GCloud 上应用基于高级自定义标头的路由规则,但在更新 url-map 时出现以下错误

HTTPError 400:字段'resource.defaultService' 的值无效:......方案EXTERNAL 不支持高级路由规则

当前设置是作为服务公开的 Kubernetes 工作负载(部署),并具有基于路径的入口规则。仅供参考 - 基于路径的 LBS 工作。

示例网址映射

kind: compute#urlMap
name: k8s-um-development-lbs-test
defaultService: https://www.googleapis.com/compute/v1/projects/beans-cloud/global/backendServices/backend-1
hostRules:
- hosts:
  - '*'
  pathMatcher: user-agent-matcher
pathMatchers:
- name: user-agent-matcher
  routeRules:
    - matchRules:
        - prefixMatch: /
          headerMatches:
            - headerName: User-Agent
              regexMatch: "*Pattern-1*"
      priority: 0
      service: https://www.googleapis.com/compute/v1/projects/beans-cloud/global/backendServices/backend-1
    - matchRules:
        - prefixMatch: /
          headerMatches:
            - headerName: User-Agent
              regexMatch: "*Pattern-2*"
      priority: 1
      service: https://www.googleapis.com/compute/v1/projects/beans-cloud/global/backendServices/backend-2
  defaultService: https://www.googleapis.com/compute/v1/projects/beans-cloud/global/backendServices/backend-1
selfLink: https://www.googleapis.com/compute/v1/projects/beans-cloud/global/urlMaps/k8s-um-development-lbs-test

解决方法

我想确认只能与 HTTP(s) Load Balancer 一起使用,因此,如果您想重写或修改 URL,请查看如何 here

为了获得更多参考,here 是另一个参考,但请注意这仅适用于内部负载均衡器(也包括 HTTP(s))。

最后,我添加了有关当前无法为外部 HTTP(s) 负载均衡器自定义标头的信息,请发表评论 here,以便了解有关任何更新的信息

问候和新年快乐。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...