https://prefect.io logo
Title
t

Thomas La Piana

03/31/2020, 5:27 PM
I would love to spin up the prefect webserver in k8s, but all of the tutorials point to using docker + docker-compose...is there any way that I can bootstrap it myself without having to run docker within docker in k8s?
basically want to bring my own metadata db and containers/pods
j

Joe Schmid

03/31/2020, 5:38 PM
@Thomas La Piana I suspect Prefect (and the community) will provide more documentation for that as they go, but as a starting point you could poke around in the open source server code here: https://github.com/PrefectHQ/prefect/tree/master/server
s

Scott Zelenka

03/31/2020, 5:51 PM
@Thomas La Piana I'm working on a Helm Chart to do this... there's a odd hack to get the flows to register to the service in K8, but it works in minikube .. testing on OpenShift now
👍 1
❤️ 3
j

josh

03/31/2020, 5:54 PM
I have a full set of YAML manifests to run the whole thing on k8s and I’m really interested to see this developed as a project driven by the community 🙂 so I am down to collaborate on this with anyone who wants to
s

Scott Zelenka

03/31/2020, 7:17 PM
@josh interested in how you provisioned it .. there were a few hoops I had to jump through to get the
ui
to behave in K8 (along with getting my dev machine to register with the instance), but the Helm Chart is here: https://github.com/szelenka/prefect-ui This will setup the same servers (with autoscalers) in K8. The default resources likely need to be adjusted depending on traffic, but it works in the small use cases I've tested so far. This Helm Chart will also register a Prefect Kubernetes Agent in the same namespace, so it'd be a one-stop plugin to get up and running with Prefect UI with scale.
j

josh

03/31/2020, 7:21 PM
For my initial minimal test of getting everything up I port-forwarded the UI locally so I could see it but didn’t have any issues other than that. Here’s the yaml for that one, pretty minimal:
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: ui
  name: ui
spec:
  replicas: 1
  selector:
    matchLabels:
      service: ui
  strategy: {}
  template:
    metadata:
      labels:
        service: ui
    spec:
      containers:
      - args:
        - ./intercept.sh
        image: prefecthq/ui:latest
        imagePullPolicy: "Always"
        name: ui
        ports:
        - containerPort: 8080
        resources: {}
      restartPolicy: Always
      serviceAccountName: ""
      volumes: null
status: {}
---
apiVersion: v1
kind: Service
metadata:
  labels:
    service: ui
  name: ui
spec:
  ports:
  - name: "8080"
    port: 8080
    targetPort: 8080
  selector:
    service: ui
status:
  loadBalancer: {}
Note: this may be a bit different compared to how it’s set up to run via the docker-compose.yml now because this is a few days old and I know there were some changes in there prior to the 0.10.0 release
s

Scott Zelenka

03/31/2020, 7:44 PM
There's hard coded 'http://localhost:4200' in the javascript files on the ui container, which I wrote a bash script to substitute with the externally available URL to prefect-apollo in the K8 deployment so you can access the API from the UI from outside of K8.
t

Thomas La Piana

04/01/2020, 4:15 AM
would definitely be interested in making some contributions around this, as I will surely be using this in production as well. I'm not a fan of helm so I'll just be working on the templates themselves, thanks for the guidance everyone! @josh can you point me to your current work? would love to take a look and contribute back upstream when i get it "figured out"
j

josh

04/01/2020, 3:59 PM
I have the files locally on my computer but I’d be down to throw them into a git repo for you to take a look at
t

Thomas La Piana

04/01/2020, 4:04 PM
i'd love that @josh we can compare notes, i'm gonna try to hammer them out tomorrow (end of your day today)
t

Thomas La Piana

04/01/2020, 4:17 PM
thanks josh! I'll make a branch
🙂 1