Monitor RootSync and RepoSync objects

This page shows you different ways that you can monitor your RootSync and RepoSync objects.

View logs

This section explains how to view the logs for the RootSync and RepoSync objects. Viewing the logs provides information on potential errors.

  • To view the logs for the RootSync reconciler, run the following command:

    kubectl logs -n config-management-system deployment/root-reconciler CONTAINER_NAME
    

    Replace CONTAINER_NAME with one of the following values:

    • git-sync: The git-sync container pulls configs from your Git repository to a local directory that the reconciler container can read them.

    • hydration-controller: The hydration-controller container renders any Helm or Kustomize configurations pulled from your repository, and then saves the rendered configs in the shared volume for the reconciler container to further process.

    • otel-agent: The otel-agent container is an OpenTelemetry agent for retrieving and exporting Config Sync metrics.

    • reconciler: The reconciler container applies configs to the cluster.

  • To view the logs of the RepoSync reconciler, run the following command:

    kubectl logs -n config-management-system deployment/ns-reconciler-NAMESPACE CONTAINER_NAME
    

    Replace the following:

    • NAMESPACE: the namespace that you created your namespace repository in.
    • CONTAINER_NAME: either , git-sync, hydration-controller, otel-agent or reconciler.

View synced commits

You can check which commit is synced to the cluster.

  • To view synced commits for the RootSync, run the following command:

    kubectl get rootsync root-sync -n config-management-system
    
  • To view synced commits for the RepoSync, run the following command:

    kubectl get reposync repo-sync -n NAMESPACE
    

    Replace NAMESPACE with the namespace that you created your namespace repository in.

The output for these commands show you the value of the source commit and the synced commit. For example, if you ran the command for the RepoSync, you would see output similar to the following:

NAME        RENDERINGCOMMIT                            SOURCECOMMIT                               SYNCCOMMIT
root-sync   66882815f0ef5517df27e864fb1315e97756ab72   66882815f0ef5517df27e864fb1315e97756ab72   66882815f0ef5517df27e864fb1315e97756ab72

The value in the RENDERINGCOMMIT column is the commit that is processed by the hydration-controller. If no rendering is needed, the value is the same as the SOURCECOMMIT column. The value in the SOURCECOMMIT column is the commit from the Git repository that should be synced to the cluster. The value in the SYNCCOMMIT column is the commit that is deployed to the cluster. If the two values in the SOURCECOMMIT and SYNCCOMMIT columns are the same, the expected commit has been deployed to the cluster.

View object details

To view details of the RootSync and RepoSync objects, use kubectl describe. This command can provide you with further information about potential errors.

  • To view details for the RootSync object, run the following command:

    kubectl describe rootsync root-sync -n config-management-system
    
  • To view details for the RepoSync object, run the following command:

    kubectl describe reposync repo-sync -n NAMESPACE
    

    Replace NAMESPACE with the namespace that you created your namespace repository in.

View if a resource is ready

To learn if the resources synced to the cluster are ready, view the reconciliation status. For example, viewing the reconciliation status can show you if a synced Deployment is ready to serve traffic.

For a Git repository synced to the cluster, the reconciliation statuses of all resources are aggregated in a resource called ResourceGroup. For each RootSync or RepoSync object, a ResourceGroup is generated to capture the set of resources applied to the cluster and aggregate their statuses.

  • To view the reconciliation status for the RootSync object, run the following command:

    kubectl get resourcegroup.kpt.dev root-sync -n config-management-system -o yaml
    
  • To view the reconciliation status for the RepoSync object, run the following command:

    kubectl get resourcegroup.kpt.dev repo-sync -n NAMESPACE -o yaml
    

    Replace NAMESPACE with the namespace that you created your namespace repository in.

In the output, you see all of the ResourceGroup resource statuses. For example, the following output shows that a Deployment named nginx-deployment is ready:

resourceStatuses:
- group: apps
  kind: Deployment
  name: nginx-deployment
  namespace: default
  status: Current

What's next