Yu Shao Pang
07/01/2025, 5:24 AMMarvin
07/01/2025, 5:24 AMMarvin
07/01/2025, 5:25 AMDeployment.build_from_flow()
method is removed
- New pattern: flow.from_source(...).deploy(...)
- CLI command prefect deployment build
is replaced with prefect deploy
2. Infrastructure Changes (Breaking Change):
- Agents are replaced with Workers
- Infrastructure blocks are replaced with Work Pools
- The entire infrastructure module from 2.x has been removed
3. Kubernetes-Specific Changes:
- Existing Kubernetes agent configurations need to be migrated to the new worker system
- Work pools now handle infrastructure configuration instead of blocks
- Workers poll for scheduled runs differently than agents did
4. Server and Database:
- Server data from Prefect 2.x is not compatible with 3.x due to internal changes
- Fresh server setup is required for 3.x
- Uses Pydantic 2, which may affect custom type definitions
5. General Migration Steps:
- Review and update any custom deployment logic
- Update CI/CD pipelines to use new deployment syntax
- Migrate infrastructure configurations to work pools
- Update any scripts that use the Prefect CLI
For a smooth migration, I recommend:
1. Start with a fresh Prefect 3.x server instance
2. Migrate flows one at a time to test compatibility
3. Update your Kubernetes configurations to use the new worker model
4. Test thoroughly in a non-production environment first
You can find detailed migration instructions in the official upgrade guide.
For Kubernetes specifically, you'll need to:
1. Replace your agent deployments with worker deployments
2. Update your work pool configurations to match your current infrastructure needs
3. Review and update any custom Kubernetes configurations or resource definitions
Most flow code should work without major changes, but the deployment and infrastructure management aspects require significant updates.