Bowen Zhang
10/13/2024, 7:47 PMMarvin
10/13/2024, 7:47 PMPREFECT_API_URL
. If you're only hosting a local instance of Prefect Server, you'll likely want to set PREFECT_API_URL
to the Route that your OpenShift setup exposes. This way, any components or tools trying to communicate with the Prefect API (like workers or agents) can do so through the publicly accessible route. For more detailed configuration, you might want to consult the documentation here for Prefect 2.x and here for Prefect 3.x.
Regarding accessing the UI without deploying a worker: Yes, it is possible to interact with the Prefect UI without deploying any workers. Workers in Prefect are responsible for executing flows, so if your intention is only to manage flows (for example, configuring and tracking but not running), you can access the UI without having any active workers. The UI configuration and proper Prefect Server setup should allow you to manage flows appropriately. The UI is accessible via the server itself, which is detailed in their setup documentation.
For more information, please refer to the respective version's documentation: Prefect 2.x Kubernetes Deployment and Prefect 3.x Infrastructure Examples.
If you have any more questions or need further help, feel free to ask!Bowen Zhang
10/13/2024, 7:50 PM---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bowen
name: prefect-server
spec:
replicas: 1
selector:
matchLabels:
app: bowen
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: bowen
spec:
containers:
- name: prefect-server
image: prefecthq/prefect:3-python3.12-conda
command: ["/bin/bash", "-c"]
args: ["source activate prefect && prefect server start"]
env:
- name: PREFECT_UI_STATIC_DIRECTORY
value: /cache
- name: PREFECT_API_DATABASE_CONNECTION_URL
value: <postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db>
- name: PREFECT_API_URL
value: <http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api>
resources: {}
ports:
- name: ui
containerPort: 4200
volumeMounts:
- mountPath: /cache
name: cache-volume
volumes:
- name: cache-volume
emptyDir:
sizeLimit: 500Mi
---
apiVersion: v1
kind: Service
metadata:
name: prefect-bowen-service
spec:
ports:
- name: ui
port: 4200
protocol: TCP
targetPort: 4200
selector:
app: bowen
---
apiVersion: <http://route.openshift.io/v1|route.openshift.io/v1>
kind: Route
metadata:
name: bowen-prefect-webserver-route
spec:
host: <http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com|prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com>
port:
targetPort: ui
to:
kind: Service
name: prefect-bowen-service
Marvin
10/13/2024, 7:50 PMthe following is my openshift template for deploying only the server, and I would like to access the UI through the route, but after my deployment, it complains about “This site can’t be reached”, what’s wrong with my template?```--- apiVersion: apps/v1 kind: Deployment metadata: labels: app: bowen name: prefect-server spec: replicas: 1 selector: matchLabels: app: bowen strategy: {} template: metadata: creationTimestamp: null labels: app: bowen spec: containers: - name: prefect-server image: prefecthq/prefect:3-python3.12-conda command: ["/bin/bash", "-c"] args: ["source activate prefect && prefect server start"] env: - name: PREFECT_UI_STATIC_DIRECTORY value: /cache - name: PREFECT_API_DATABASE_CONNECTION_URL value: postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db - name: PREFECT_API_URL value: http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api resources: {} ports: - name: ui containerPort: 4200 volumeMount
Marvin
10/13/2024, 7:51 PMwhat’s wrong with following template```--- apiVersion: apps/v1 kind: Deployment metadata: labels: app: bowen name: prefect-server spec: replicas: 1 selector: matchLabels: app: bowen strategy: {} template: metadata: creationTimestamp: null labels: app: bowen spec: containers: - name: prefect-server image: prefecthq/prefect:3-python3.12-conda command: ["/bin/bash", "-c"] args: ["source activate prefect && prefect server start"] env: - name: PREFECT_UI_STATIC_DIRECTORY value: /cache - name: PREFECT_API_DATABASE_CONNECTION_URL value: postgresql+asyncpg://postgres_user:postgres_password@bowen-db-service:5432/postgres_db - name: PREFECT_API_URL value: http://prefect-bowen-ui.apps.ocp-scc-rnd.fg.rbc.com:4200/api resources: {} ports: - name: ui containerPort: 4200 volumeMounts: - mountPath: /cache name: cache-volume volumes: - name: cache-volume emptyDir: sizeLimit: 500Mi --- apiVersion