To run Prefect servers in Kubernetes with the Helm chart and log with the JSON handler:
1.
Create a values.yaml
file to customize your Prefect worker configuration via the Helm chart.
2.
Set the logging configuration using environment variables or within the
values.yaml
file.
Here's an example of what your
values.yaml
file might look like for configuring JSON logging:
yaml
env:
- name: PREFECT_LOGGING_FORMAT
value: "JSON"
worker:
cloudApiConfig:
accountId: <target account ID>
workspaceId: <target workspace ID>
config:
workPool: <target work pool name>
Finally, apply your Helm chart with the custom values:
sh
helm install prefect-prefecthq/prefect -f values.yaml
Resources:
-
Deploying with Helm
-
Configuring Logging
For fine-tuning JSON logging and handlers, check
Prefect's logging docs.
Make sure
PREFECT_LOGGING_FORMAT
is set correctly to JSON, making logs JSON formatted for easier parsing and handling.