Using cdn (aws cloudfront) inside Google kubernetes engine

62 views Asked by At

I have an application running on gke. It has pods of backend and frontend servers, at least initially 1 replica each. For clientside ui, it has a ui-deployment and ui-cluster-service. I have this app at an IP 35.244.xx.xx. I have this at abcxyz.com. I used ingress for routing, so that every route at '/' will be handled by frontend deployment, which can make reqs to '/server/xxx' this by ingress is sent to backend deployment. I want to use a cdn for frontend instead of a deployment in kubernetes. I have frontend of app deployed on aws cloudfront.

Is it just possible to config in ingress so that any search to abcxyz.com/(or)35.244.xx.xx/ will have served content of xxx.x.cdn.cloudfront.net? Rather than using cdn as face of app which communicates with gke.

1

There are 1 answers

0
Gari Singh On

There's nothing specific from a GKE-perspective, but I think what you want to do is use a custom domain with CloudFront.

So rather than point abcxyz.com at the GKE LB IP, you'd be creating a CNAME record in CloudFront which points abcxyz.com -> xxx.x.cdn.cloudfront.net. You'd also then create a different FQDN for the GKE LB IP and then use that as the origin in your CloudFront distribution:

...
Origins:
  - CustomOriginConfig:
      HTTPPort: 80
      OriginProtocolPolicy: match-viewer
    DomainName: "lb.abcxyz.com"
...

Alternatively, if you don't have to use CloudFront, you can use Cloud CDN directly with GKE Ingress.