View Config Sync status across multiple clusters

If you install and configure Config Sync on multiple registered clusters in a project, you can use gcloud alpha anthos config sync repo to list the status for the repo being synced across clusters and debug problems with Config Sync. Compared with nomos status, gcloud alpha anthos config sync repo groups status by repo whereas the nomos status command groups status by cluster.

Before you begin

Before using gcloud alpha anthos config sync repo, complete the following steps:

  1. Update the Google Cloud CLI components by running the following command

    gcloud components update
    
  2. Register your clusters if you haven't. If you installed and configured Config Sync through the console, you can skip this step.

  3. The platform administrators need to set up Connect Gateway for the registered cluster if it is not a GKE cluster.

  4. Set your project by running the following command:

    gcloud config set project PROJECT_ID
    

    Replace PROJECT_ID with the project ID in which Config Sync is set up and running.

Basic usage

List all repos

   gcloud alpha anthos config sync repo list

This command lists all the status of Git repositories that are synced to any registered clusters in the current project. The output is similar to the following:

┌─────────────────────────────────────────────────────────────────┬───────┬────────┬─────────┬───────┬─────────┬─────────────┐
│                       SOURCE                                    │ TOTAL │ SYNCED │ PENDING │ ERROR │ STALLED │ RECONCILING │
├─────────────────────────────────────────────────────────────────┼───────┼────────┼─────────┼───────┼─────────┼─────────────┤
│ https://source.developers.google.com/p/test/r/test//@main       │ 2     │ 2      │ 0       │ 0     │ 0       │ 0           │
│ https://source.developers.google.com/p/test/r/dev//@main        │ 2     │ 1      │ 0       │ 0     │ 1       │ 0           │
│ https://source.developers.google.com/p/test/r/staging//@main    │ 1     │ 0      │ 0       │ 1     │ 0       │ 0           │
└─────────────────────────────────────────────────────────────────┴───────┴────────┴─────────┴───────┴─────────┴─────────────┘

Each row of the output described the repo and its corresponding status across clusters:

  • TOTAL is the number of clusters the repo is ynced to.
  • SYNCED is the number of clusters where this repo is synced successfully.
  • PENDING is the number of clusters where this repo is pending to sync.
  • ERROR is the number of clusters where this repo encounters some error during syncing.
  • STALLED is the number of clusters where the Deployment that syncs this repo is stalled.
  • RECONCILING is the number of clusters where the Deployment that syncs this repo is being reconciled.

List repos with the ERROR status

You can also list the repos with a specific status using the flag --status. The supported values are synced, pending, error, stalled and reconciling. For example, list the repos that have errors by running the following command:

gcloud alpha anthos config sync repo list --status=error

The output is similar to the following:

┌─────────────────────────────────────────────────────────────────┬───────┬────────┬─────────┬───────┬─────────┬─────────────┐
│                       SOURCE                                    │ TOTAL │ SYNCED │ PENDING │ ERROR │ STALLED │ RECONCILING │
├─────────────────────────────────────────────────────────────────┼───────┼────────┼─────────┼───────┼─────────┼─────────────┤
│ https://source.developers.google.com/p/test/r/staging//@main    │ 1     │ 0      │ 0       │ 1     │ 0       │ 0           │
└─────────────────────────────────────────────────────────────────┴───────┴────────┴─────────┴───────┴─────────┴─────────────┘

Describe a repo

Use the describe command to see details about your repo's status:

   gcloud alpha anthos config sync repo describe \
     --source URL

Replace URL with the URL that is from the output of the list command described in the previous section.

You can also use --namespace and --name to specify the repo you want to describe.

   gcloud alpha anthos config sync repo describe \
     --namespace config-management-system --name root-sync

By default, it prints the repo status as well as any managed resources that are applied but failed reconciliation.

   [
     {
       "clusters": [
         "cluster-1",
         "cluster-2",
       ],
       "commit": "32293c90a63efba3121c7648048fcd3e85043a34",
       "errors": [],
       "source": "https://source.developers.google.com/p/test/r/test//@main",
       "status": "SYNCED"
     }
   ]

You can also use the flag --managed-resources to control the managed resources that you want to view. The supported values are all, current, inprogress, notfound, failed (the default) or unknown. You can use the following command to view all managed resources:

   gcloud alpha anthos config sync repo describe \
     --namespace config-management-system --name root-sync \
     --managed-resources all

The output is similar to the following:

   [
     {
       "clusters": [
         "cluster-1",
         "cluster-2",
       ],
       "commit": "32293c90a63efba3121c7648048fcd3e85043a34",
       "errors": [],
       "source": "https://source.developers.google.com/p/test/r/test//@main",
       "status": "SYNCED"
     }
   ]
   ┌────────────────────────────────────────────────────────────────┐
   │                       managed_resources                        │
   ├───────┬───────────┬─────────┬───────────┬─────────┬────────────┤
   │ GROUP │    KIND   │   NAME  │ NAMESPACE │  STATUS │ CONDITIONS │
   ├───────┼───────────┼─────────┼───────────┼─────────┼────────────┤
   │       │ Namespace │ default │           │ Current │            │
   │       │ ConfigMap │ foo     │ default   │ Current │            │
   └───────┴───────────┴─────────┴───────────┴─────────┴────────────┘