Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiClusterIngress with CDN #1093

Closed
LeifRoss opened this issue May 4, 2020 · 5 comments
Closed

MultiClusterIngress with CDN #1093

LeifRoss opened this issue May 4, 2020 · 5 comments

Comments

@LeifRoss
Copy link

LeifRoss commented May 4, 2020

Hi, I am experiencing a slight issue that has turned out to be quite the showstopper. I have set up a multi cluster ingress, and I am attempting to set up CDN for the static files. I followed this guide which works fine for regular ingresses, but nothing happens when using the MultiClusterIngress, and setting up the CDN manually from the load balancer works for a while, but it gets deleted randomly between 2 and 5 minutes after creation(?).

Is there something special that needs to be setup for Cloud CDN to be working for the MultiClusterIngress Load Balancer, or is there another approach that is suitable for serving a few static files to a huge amount of clients? (a SPA)

The guide: https://cloud.google.com/kubernetes-engine/docs/how-to/cdn-backendconfig

apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
  name: zone-ingress-facade
  namespace: prod
  annotations:
    kubernetes.io/ingress.global-static-ip-name: facade-mci-address-mk1
    networking.gke.io/managed-certificates: facade-cert-mci
spec:
  template:
    spec:
      backend:
        serviceName: zone-facade
        servicePort: 80

-------------------------------------------

apiVersion: networking.gke.io/v1
kind: MultiClusterService
metadata:
  name: zone-facade
  namespace: prod
  annotations:
    cloud.google.com/backend-config: '{"ports": {"80":"cdn-config"}}' // have attempted using the name http outright here
spec:
  template:
    spec:
      type: NodePort
      selector:
        app.kubernetes.io/instance: facade
        app.kubernetes.io/name: facade
      ports:
      - name: http
        port: 80
        protocol: TCP
        targetPort: http

-------------------------------------------

  apiVersion: cloud.google.com/v1beta1
  kind: BackendConfig
  metadata:
    namespace: prod
    name: cdn-config
  spec:
    cdn:
      enabled: true
      cachePolicy:
        includeHost: true
        includeProtocol: true
        includeQueryString: false

@rramkumar1
Copy link
Contributor

rramkumar1 commented May 4, 2020

@LeifRoss That's not exactly the right documentation you want to be following.

https://cloud.google.com/kubernetes-engine/docs/concepts/ingress-for-anthos is the authoritative source for all features supported. Note that while filing feature requests here is okay, the software maintained here is different than what you are trying to configure with the MultiClusterIngress CRD. It's really two different products.

Happy to answer more questions.

@LeifRoss
Copy link
Author

LeifRoss commented May 5, 2020

Allright, thanks for the pointer!

I guess what I am wondering is if the Cloud CDN is supposed to be supported, or if I am doing something wrong, or if it is possible to put another regular http(s) load balancer on top of mci load balancer that I can enable CDN manually on without it being overwritten and without it messing up the magic of the Load balancer generated by the MultiClusterIngress?

Have a awesome day!

@rramkumar1
Copy link
Contributor

@LeifRoss Nope, CDN is not yet supported in that API. We are working on it though and hope to support it in the next couple of weeks. I can ping this thread when it is available.

@LeifRoss
Copy link
Author

LeifRoss commented May 5, 2020

That would be great, thank you!

Managed to create a small work-around by manually establishing a new load balancer with rules to route requests for the client files to a backend bucket (+cdn support), and the unmatched traffic to the same backend that was defined in the load balancer established by the mci. Not sure if this is considered a viable solution, but it seems to be stable for now.

@rramkumar1
Copy link
Contributor

@LeifRoss This is now supported in Ingress for Anthos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants