Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Google Cloud Storage Bucket with GCE LoadBalancer... not in host and paths

I'm trying to route traffic to a static bucket on GCE. Right now I am using ingress, but have found the docs for Google here:

https://cloud.google.com/compute/docs/load-balancing/http/adding-a-backend-bucket-to-content-based-load-balancing

I get all the way through, but cannot select the 'backend bucket' while in the hosts and paths menu doing the url mapping... even though it is listed under the backend buckets. The 'Backend Services' options can be selected, but the backend buckets menu is disabled. Does anyone know of a better tutorial, or a better way to route traffic to a bucket for static content?

Can I specify it in the ingress yaml maybe?

like image 782
ThatCampbellKid Avatar asked Jan 28 '23 07:01

ThatCampbellKid


2 Answers

Specifying "backend buckets" is not supported on GCE Ingress yaml spec currently.

If you modify a load balancer created by the Ingress controller to route some of the traffic to a backend bucket (by editing its URL map), your changes will be periodically overwritten by the Ingress controller.

Your only option is likely to create a separate load balancer for your "backend bucket".

like image 27
ahmet alp balkan Avatar answered Jan 31 '23 07:01

ahmet alp balkan


It looks like this will be available in kubernetes 1.19

Note, however, that 1.19 isn't available on GKE yet (as of the time of this post) but regardless I thought this would be useful information for people landing here. When 1.19 is available, I'll try it out and update this answer.

For a preview of how this will look in config, the pull request for the feature includes an example

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-resource-backend
spec:
  defaultBackend:
    resource:
      apiGroup: k8s.example.com
      kind: StorageBucket
      name: static-assets
  rules:
    - http:
        paths:
          - path: /icons
            pathType: ImplementationSpecific
            backend:
              resource:
                apiGroup: k8s.example.com
                kind: StorageBucket
                name: icon-assets
like image 195
davnicwil Avatar answered Jan 31 '23 07:01

davnicwil