Fleet (GitOps)
Fleet is Rancher's built-in GitOps engine. It watches Git repositories and automatically deploys their contents to the cluster.
What GitOps means
Instead of running kubectl apply manually, you push your Kubernetes manifests to a Git repository. Fleet detects the change and applies it to the cluster. This means:
- Your cluster state is defined in Git (the single source of truth)
- Changes are tracked, reviewed, and reversible through Git history
- No one needs to run
kubectldirectly for routine deployments
Current state
Fleet was installed automatically as part of the Rancher deployment. It is running in the cattle-fleet-system namespace:
kubectl -n cattle-fleet-system get podsComponents:
fleet-controller— watches Git repos and reconciles stategitjob— clones repositories and processes manifestshelmops— handles Helm-based deploymentsfleet-agent— runs incattle-fleet-local-system, applies changes to the local cluster
Fleet is operational but has not yet been configured with student Git repositories. This is a planned next step.
How Fleet works
- You define a
GitReporesource pointing to a repository - Fleet clones the repo and watches for changes
- When a change is detected, Fleet processes the manifests (plain YAML or Helm charts)
- Fleet applies the manifests to the target cluster
- Fleet continuously reconciles — if someone manually changes something, Fleet reverts it to match Git
Setting up a GitRepo (example)
apiVersion: fleet.cattle.io/v1alpha1
kind: GitRepo
metadata:
name: student-app
namespace: fleet-default
spec:
repo: https://github.com/student/my-app
branch: main
paths:
- k8s/
targets:
- clusterSelector:
matchLabels:
management.cattle.io/cluster-display-name: localThis tells Fleet: "Watch the k8s/ directory in https://github.com/student/my-app on the main branch. Deploy whatever manifests you find there to the local cluster."
Fleet via Rancher UI
You can manage Fleet repositories through the Rancher UI:
- Go to Continuous Delivery (in the left sidebar)
- Navigate to Git Repos
- Add a new repository
Planned use
The vision for Fleet in this cluster is:
- Each student (or team) has a Git repository with their Kubernetes manifests
- Fleet watches these repositories
- When a student pushes a change, their app is automatically deployed or updated
- Students learn GitOps as a natural part of their workflow
This replaces the manual process of SSH-ing into the cluster and running kubectl apply.
Health check
# Fleet controller and related pods
kubectl -n cattle-fleet-system get pods
# Fleet agent
kubectl -n cattle-fleet-local-system get pods
# Git repos being watched
kubectl -n fleet-default get gitrepoNote: Fleet components may show high restart counts. This is a known behavior with Rancher's Fleet deployment and usually does not indicate a real problem as long as the pods are running.