Overview
Fleet provides a powerful continuous delivery system that automatically deploys applications from Git repositories to multiple Kubernetes clusters. This GitOps-based approach ensures that your clusters always reflect the desired state defined in Git.Continuous Delivery Feature
Fleet’s GitOps capabilities are controlled by the continuous-delivery feature flag:Git Repository Integration
GitRepo Resource
The GitRepo custom resource is the primary way to configure Fleet to monitor a Git repository:Repository Authentication
Fleet supports multiple authentication methods:- HTTPS with basic auth: Username and password/token
- SSH keys: For private repositories
- Public repositories: No authentication required
Polling and Webhooks
Fleet monitors repositories for changes:- Polling: Regularly checks the repository for new commits (default)
- Webhooks: Can be configured for immediate deployments on push
- Poll interval: Configurable per GitRepo resource
Fleet Bundles
What are Bundles?
Bundles are Fleet’s internal representation of application deployments:- Automatically created from GitRepo resources
- Contain Kubernetes manifests and Helm charts
- Include targeting information for cluster selection
- Track deployment status across clusters
Bundle Structure
A Bundle consists of:Bundle Resources
Bundles can contain:- Raw Kubernetes manifests: YAML files with Kubernetes resources
- Helm charts: Charts are automatically detected and deployed
- Kustomize overlays: For environment-specific configurations
- Custom resource definitions: Deployed before other resources
Deployment Strategies
Cluster Targeting
Fleet provides flexible cluster selection mechanisms:Label-Based Selection
Cluster Group Targeting
Named Cluster Targeting
Rolling Updates
Fleet supports controlled rollout strategies:Staged Deployments
Implement progressive delivery using cluster groups:- Development: Deploy to dev clusters first
- Staging: After validation, promote to staging
- Production: Finally deploy to production clusters
Customization and Overlays
Per-Cluster Customization
Fleet allows cluster-specific configurations:Kustomize Integration
Use Kustomize for environment-specific overlays:Helm Value Overrides
Override Helm values per cluster or cluster group:Monitoring Deployments
Deployment Status
Fleet tracks deployment status for each cluster:- Ready: Successfully deployed and healthy
- NotReady: Deployment in progress or issues detected
- Modified: Local changes detected (drift from Git)
- WaitApplied: Waiting for resources to be applied
Bundle Status
Check bundle deployment status:- Number of target clusters
- Deployment progress per cluster
- Any errors or warnings
GitRepo Status
Monitor GitRepo synchronization:Fleet Workspaces for Multi-Tenancy
Workspace Isolation
Fleet workspaces provide multi-tenancy:- Each workspace is a separate namespace
- Teams can manage their own GitRepos and Bundles
- Clusters can be assigned to specific workspaces
- RBAC controls access per workspace
- fleet-default: Default workspace for resources (source:pkg/fleet/const.go:12)
- fleet-local: Workspace for local cluster (source:pkg/fleet/const.go:13)
Creating Workspaces
Create a new Fleet workspace:Workspace Assignment
Assign clusters to workspaces through Rancher or by labeling clusters:Best Practices
Repository Structure
Organize your Git repositories effectively:- Monorepo: Single repository with multiple applications
- Per-app repositories: Separate repository for each application
- Environment branches: Use branches for dev, staging, production
- Directory-based: Use paths to separate applications
Security Considerations
- Store sensitive data in Kubernetes secrets, not Git
- Use private repositories for proprietary applications
- Implement RBAC to control GitRepo creation
- Rotate Git credentials regularly
- Review Git commit history for audit trail
Drift Detection
Fleet detects when cluster state differs from Git:- Automatic correction: Fleet reapplies desired state
- Alerts: Can be configured for drift detection
- Manual changes: Discouraged in GitOps workflow
Rollback Procedures
Revert to previous versions using Git:- Identify the working commit in Git history
- Revert the problematic commit or update branch/tag
- Fleet automatically deploys the previous version
- Verify successful rollback across clusters
Troubleshooting
Common Issues
GitRepo Not Syncing
- Check repository URL and authentication
- Verify network connectivity to Git server
- Review GitRepo status for error messages
- Check Fleet manager logs in cattle-fleet-system namespace
Bundle Not Deploying
- Verify cluster selectors match target clusters
- Check cluster connectivity and Fleet agent status
- Review Bundle status for deployment errors
- Ensure target clusters have required resources
Deployment Failures
- Check application logs in target clusters
- Verify resource manifests are valid
- Ensure namespace and dependencies exist
- Review Fleet agent logs on affected clusters
Debugging Commands
Advanced Scenarios
Multi-Repository Dependencies
Deploy applications with dependencies from multiple repositories:- Create separate GitRepos for each component
- Use dependency ordering through bundle weights
- Coordinate deployments using Fleet workspaces
Custom Resource Definitions
Fleet handles CRD deployment automatically:- CRDs are detected and applied first
- Other resources wait for CRD availability
- Ensures proper dependency ordering
Helm Chart Dependencies
Manage Helm charts with subchart dependencies:- Fleet automatically resolves chart dependencies
- Subcharts are downloaded and deployed
- Values can be passed to subcharts
Integration with CI/CD
Fleet complements CI/CD pipelines:- CI Pipeline: Builds and tests application, pushes to registry
- Update Git: Pipeline updates Git with new image tags
- Fleet Detection: Fleet detects Git changes
- Automatic Deployment: Fleet deploys to target clusters
- Status Reporting: Fleet reports deployment status
Next Steps
- Explore Fleet architecture in detail
- Configure GitRepos for your applications
- Implement progressive delivery strategies
- Set up monitoring and alerting for Fleet deployments