Moritz Rocholl
07/25/2024, 7:27 AMMarvin
07/25/2024, 7:28 AMselfHosted
configuration under the worker
section in the Prefect Helm chart is used to configure the worker to interact with a self-hosted Prefect server instead of Prefect Cloud. Here's what each part means:
* apiConfig: selfHosted
sets the worker to use a self-hosted API configuration.
* config.workPool
specifies the target work pool name.
* selfHostedCloudApiConfig.apiUrl
is the API URL of the self-hosted Prefect server.
* selfHostedCloudApiConfig.accountId
and workspaceId
are used to specify the target account and workspace.
* selfHostedCloudApiConfig.uiUrl
is the URL for the self-hosted Prefect UI.
This configuration is primarily useful when your Prefect server is hosted externally or within the same Kubernetes cluster but not using Prefect Cloud.
For detailed guidance, you can refer to the following resources:
1. Deploying a worker using Helm: https://docs.prefect.io/latest/guides/deployment/kubernetes/
2. Hosting a Prefect server instance: https://docs.prefect.io/latest/guides/host/Moritz Rocholl
07/25/2024, 7:29 AMMarvin
07/25/2024, 7:29 AMapiConfig
attribute in the Prefect Helm chart under the worker
section can be configured with three options: selfHosted
, selfHostedCloudApiConfig
, and server
. Here's the difference between them:
1. selfHosted:
- Configures the worker to connect to a self-hosted Prefect server.
- Requires detailed settings such as apiUrl
, accountId
, workspaceId
, and uiUrl
under selfHostedCloudApiConfig
.
2. selfHostedCloudApiConfig:
- A specialized form of selfHosted
where the worker is configured to communicate with the Prefect Cloud-like instance that you host yourself.
- It primarily contains the same settings as selfHosted
but is used when you want fine-grained control over the specific cloud-like settings.
3. server:
- Used when the worker needs to connect to a standard Prefect server instance, either local or remote.
- The PREFECT_API_URL
should be set to the appropriate URL of the Prefect server instance, for example, <http://127.0.0.1:4200/api>
for a local instance.
In summary:
- Use selfHosted or selfHostedCloudApiConfig for connecting to a self-hosted server, with the latter being useful for cloud-like configurations.
- Use server for general Prefect server instances.
For more details:
- Deploy a worker using Helm
- Configure Prefect server settingsMoritz Rocholl
07/25/2024, 1:43 PMMarvin
07/25/2024, 1:43 PMimagePullSecrets
section to your deployment's values.yaml
file. Here is a sample configuration:
yaml
worker:
apiConfig: selfHosted
config:
workPool: <target work pool name>
selfHostedCloudApiConfig:
apiUrl: "https://<DNS of Self Hosted Cloud API>"
accountId: <target account ID>
workspaceId: <target workspace ID>
uiUrl: "https://<DNS of Self Hosted Cloud UI>"
## Specify image pull secrets
imagePullSecrets:
- name: <your-image-pull-secret>
You also need to create a Kubernetes secret that contains the Docker registry credentials. For example:
sh
kubectl create secret docker-registry <your-image-pull-secret> \
--docker-server=<your-docker-registry> \
--docker-username=<your-username> \
--docker-password=<your-password> \
--namespace=<your-namespace>
For a detailed guide, you can refer to the Prefect Kubernetes deployment documentation.
This setup ensures that Kubernetes can pull your Docker images using the specified credentials when executing Prefect flows.
Sources:
- Deploy a worker using Helm
- Docker integration guideMoritz Rocholl
07/25/2024, 1:46 PMMoritz Rocholl
07/25/2024, 1:51 PMMarvin
07/25/2024, 1:51 PMvalues.yaml
file under the worker configuration for your Prefect Helm chart. Here’s an example configuration that shows how to specify image pull secrets:
1. Add the imagePullSecrets
section to your values.yaml
file:
yaml
worker:
apiConfig: selfHosted
config:
workPool: <target work pool name>
selfHostedCloudApiConfig:
apiUrl: "https://<DNS of Self Hosted Cloud API>"
accountId: <target account ID>
workspaceId: <target workspace ID>
uiUrl: "https://<DNS of Self Hosted Cloud UI>"
imagePullSecrets:
- name: <your-image-pull-secret>
2. Ensure you have created the Kubernetes secret for your Docker registry credentials:
sh
kubectl create secret docker-registry <your-image-pull-secret> \
--docker-server=<your-docker-registry> \
--docker-username=<your-username> \
--docker-password=<your-password> \
--namespace=<your-namespace>
This configuration will ensure that Kubernetes uses the specified image pull secret for pulling images specified in your flow container.
For in-depth guidance, refer to the following documentation:
- Guide to deploying on Kubernetes
- Guide to using Docker with Prefect