0

我正在尝试更改现有的外部 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
4

1 回答 1

0

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

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

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

问候和新年快乐。

于 2020-12-28T21:23:51.613 回答