Search code examples
google-cloud-platformload-balancinggcp-load-balancer

GCP - HTTP(S) Load Balancer L7 Backend Bucket Issue


I have just migrated from the HTTP(S) L7 Load balancer (Classic) to the new HTTP(S) L7 load balancer.

I currently have two backend services working fine, and I am looking at creating two backend buckets - however I am getting an error when creating them.

If I select simple host and path rule and specify the host, path and backend bucket - it works fine. enter image description here

However, if I specify advanced host and path rule, and supply the following configuration:

defaultService: projects/MY_PROJECT/global/backendBuckets/my-backend-bucket
name: matcher2
routeRules:
- matchRules:
  - prefixMatch: /
  priority: 0
  routeAction:
    weightedBackendServices:
    - backendService: projects/MY_PROJECT/global/backendBuckets/my-backend-bucket
      weight: 100

I am getting this cryptic error

Invalid value for field 'resource': '{ "name": "my-loadbalancer", "hostRule": [{ "host": ["myhost.com"], "pathMatcher": ...'. Invalid resource: URL_MAP/ID.my-loadbalancer

Has anyone come across this issue before? I am getting this even though I am creating a new backend bucket. I also tried using the old backend buckets I had created with the classic load balancer, and still I am getting this error?

Any help would be much appreciated, thanks.


Solution

  • This concern is actually feasible just using a different yaml, I believe what you have tried is the yaml from code guidance under load balancer routing. I also tried to use the code guidance but I am having an error message wherein load balancer is not created.

    I used the url maps documentation as a guidance and came up with this configuration and it worked using the advanced host and path.

    name: video-matcher
    pathRules:
    - paths:
      - /video/hd
      - /video/hd/*
      service: projects/project id /global/backendBuckets/bucketname