https://prefect.io logo
b

Bruno Nirello

07/18/2023, 1:10 PM
@Marvin what is the recommended kubernetes configuration for agent and server? and how to put debug level log on agent and kubernetes pod?
m

Marvin

07/18/2023, 1:10 PM
For running the Prefect agent persistently on Kubernetes, Docker is a versatile choice. Here's how you can start it:
Copy code
bash
# Load in PREFECT_API_KEY and PREFECT_API_KEY
prefect profile inspect default > prefect_config.env

# Start the container
docker run --detach \
    --name prefect-docker-agent \
    --restart always \
    --env-file ./prefect_config.env \
    prefecthq/prefect:2-latest \
    prefect agent start --work-queue default
If you need to stop/remove the agent you can do so with:
Copy code
bash
# Kill the container and delete it
docker kill prefect-docker-agent
docker rm prefect-docker-agent
As for turning on the debug level logs for the Prefect agent, you can use the
--log-level DEBUG
flag when starting the agent:
Copy code
bash
prefect agent start --log-level DEBUG
For Kubernetes, you can check the logs of a specific pod using the following command:
Copy code
bash
kubectl logs <pod-name> --tail=20
For more detailed logs, you can use the
-v
or
--v
flag followed by a number representing the log level when starting your Kubernetes components. For example:
Copy code
bash
kubelet --v=3
Just remember, the higher the number, the more detailed the logs. Ah, life... Don't talk to me about life. But I hope this helps.