:wave: A few months back, I <asked a question here...
# ask-metaflow
s
👋 A few months back, I asked a question here about deploying Metaflow to GCP. Naturally, after asking the question, I was almost immediately pulled into other projects and couldn't get back to the project until now. So let me try to re-ask in a better way: I'm trying to deploy Metaflow to GCP using https://github.com/outerbounds/metaflow-tools/tree/master/gcp/terraform as my baseline. This code works and I have a metaflow cluster up and running. The problem is I don't know how to expose this cluster to my developers. My ideal solution would be a load balanced endpoint (e.g. metaflow.example.com) that correctly routes their requests to the UI/API/metadata service/etc that is managed as part of our terraform for deploying metaflow generally. If I'm reading docs correctly, there are three missing parts in the current GCP example deployment: 1. The load balancer (IP, url map, other objects) 2. The k8s ingress controller holding the routes to the actual services 3. The backend service/network endpoint that connects 1 & 2. 1 is easy. There are plenty of examples of creating load balancers in GCP. 2 is harder. I have yet to see a good example of "here are the routes you need to put Metaflow behind a load balancer". Has anyone successfully made one of these (that isn't the not terribly helpful helm chart in the metaflow-tools repo)? 1. Is also a bit confusing to me. It looks like I need a backend service/network endpoint group to point at k8s, but it isn't clear how I actually connect those things. So has anyone else gotten Metaflow deployed in GKE successfully that has any advice for me? I know I can do a lot of this manually, but I'd vastly prefer to have all of this in terraform so we can more consistently reproduce the infrastructure.
1
👍 2
a
below i edited the picture from the AWS doc to show what you want to achieve in GCP/K8S world, not sure if thats helpful:
one point here is it will be far easier to have separate
<http://metaflow-ui.example.com|metaflow-ui.example.com>
and
<http://metaflow-service.example.com|metaflow-service.example.com>
with separate ingresses
(they don't need to talk to each other, just talk to the same postgres db)
that helm chart link contains the routing for metaflow-ui bit
in this case
<http://metaflow-ui.example.com|metaflow-ui.example.com>
would be the metaflow UI, which is accessed by end users via their browser only, no programmatic access of any kind to this
s
Right. And the service is for access by actual experiments/etc.
a
<http://metaflow-service.example.com|metaflow-service.example.com>
will be the programmatic endpoint metaflow-the-python-library talks to programmatically
s
So I could theoretically have
<http://metaflow.example.com/ui|metaflow.example.com/ui>
and
<http://metaflow.example.com/service|metaflow.example.com/service>
do similar things?
Or are subpath routes allowed?
a
theoretically yes practically this is kind of off the beaten path, good chance you'll be the first person trying to set it up like that :) I'm suggesting two domains option since I've set it up many times and wrote that helm chart with that in mind
also if you want to have auth later its often easier to have two, since UI will have some sort of browser friendly auth (OIDC etc.), and the service endpoint would use API key or something of that sort
s
IAP does actually support OIDC and token-based auth. I've gotten that working before.
a
nice! yeah we mostly do this on AWS, and while it may be possible through AWS ALB too (not 100% sure), its would be too convoluted for us so we gave up
s
I could still do one load balancer with host-based routing (which I have to assume you also do), right?
a
I think you could, not sure how IAP ingress controller does it. There are two ingresses in K8S land but maybe IAP controller is clever enough to serve both out of one "physical" load balancer? I know AWS ALB ingress controller would create two
s
IAP attaches to the "backend service", not directly to the load balancer. But also not to the ingress controller, so we should be able to point individual services to whatever ingress controller we need
a
the only tricky part there is you can see in the helm chart, there is routing so that both backend static assets and UI backend API are served from the same host but its two different K8S services under the hood, routed by HTTP path prefix
as long as it can be done with IAP you should be good
s
Yep. Again, IAP attaches to the backend service, which is (kind of) part of the load balancer, not the the actual service the backend service is reaching out to.
Do you have an example of the ingress routers without all the templating in them? It's a bit hard to suss out exactly what's needed and what isn't.
a
/api
goes to ui backend, everything else / /static goes to ui front end service (that is nginx pod that serves js/html )
s
Yep. Okay cool.