Troubleshooting
This section contains commands and tips to troubleshoot Fleet.
Where to look for root causes of issues​
The first things to check when Fleet behaves unexpectedly would be:
fleet-controllerlogs on the management cluster: has Fleet failed to reconcile any resource's (bundle, bundle deployment) current state with its expected state?gitjobpod logs on the management cluster: has Fleet encountered any issue while creating jobs to generate new bundles for new commits found in monitored git repositories?- status of the
GitRepofor which resources are not properly deployed:- How many
Ready Bundle Deploymentsdoes it list? - How many bundle deployments are listed as expected? How many do you expect to see?
- Keep in mind that a
GitRepocreates a bundle per path; each bundle leads to as many bundle deployments as there are target clusters. A mismatch betweenDesired Ready Clustersand your own expectation could point to a targeting issue.
- Keep in mind that a
- Which resources are listed in the
GitRepo's status? - Which commit appears in the
GitRepo's status?
- How many
If the issue is specific to a target cluster, one might want to check Fleet agent logs on that cluster: has Fleet failed to deploy a bundle deployment on that cluster?
The next section explains how to run all these checks.
How Do I...​
Fetch the log from fleet-controller?​
In the local management cluster where the fleet-controller is deployed, run the following command with your specific fleet-controller pod name filled in:
$ kubectl logs -l app=fleet-controller -n cattle-fleet-system
Fetch the log from the fleet-agent?​
Go to each downstream cluster and run the following command for the local cluster with your specific fleet-agent pod name filled in:
# Downstream cluster
$ kubectl logs -l app=fleet-agent -n cattle-fleet-system
# Local cluster
$ kubectl logs -l app=fleet-agent -n cattle-local-fleet-system
Fetch detailed error logs from GitRepos and Bundles?​
Normally, errors should appear in the Rancher UI. However, if there is not enough information displayed about the error there, you can research further by trying one or more of the following as needed:
- For more information about the bundle, click on
bundle, and the YAML mode will be enabled. - For more information about the GitRepo, click on
GitRepo, then click onView Yamlin the upper right of the screen. After viewing the YAML, checkstatus.conditions; a detailed error message should be displayed here. - Check the
fleet-controllerfor synching errors. - Check the
fleet-agentlog in the downstream cluster if you encounter issues when deploying the bundle.
Fetch detailed status from GitRepos and Bundles?​
For debugging and bug reports the raw JSON of the resources status fields is most useful.
This can be accessed in the Rancher UI, or through kubectl:
kubectl get bundle -n fleet-local fleet-agent-local -o=jsonpath={.status}
kubectl get gitrepo -n fleet-default gitrepo-name -o=jsonpath={.status}
To download more resources, but not the spec fields:
kubectl get clusters.fleet.cattle.io -A -o=jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.metadata.labels}{"\t"}{.status}{"\n"}{end}'
kubectl get bundles -A -o=jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.spec.targets}{"\t"}{.status}{"\n"}{end}'
kubectl get gitrepos -A -o=jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.spec.targets}{"\t"}{.status}{"\n"}{end}'
Check a chart rendering error in Kustomize?​
Check the fleet-controller logs and the fleet-agent logs.
Check errors about watching or checking out the GitRepo, or about the downloaded Helm repo in fleet.yaml?​
Check the gitjob-controller logs using the following command with your specific gitjob pod name filled in:
$ kubectl logs -f $gitjob-pod-name -n cattle-fleet-system
Note that there are two containers inside the pod: the step-git-source container that clones the git repo, and the fleet container that applies bundles based on the git repo.
The pods will usually have images named rancher/tekton-utils with the gitRepo name as a prefix. Check the logs for these Kubernetes job pods in the local management cluster as follows, filling in your specific gitRepoName pod name and namespace:
$ kubectl logs -f $gitRepoName-pod-name -n namespace