Saturday, March 7, 2020

What is Nomos in Anthos?

In kubernetes, everything is a code. For code, the best place to reside is any git repository which should act as single source of truth. GCP Anthos enables us to extend the power of kubernetes to multi and hybrid clouds. With this power comes the added complexity of managing multiple kubernetes clusters scattered in GKE, or in GKE on-prem or in other cloud providers.



Anthos Config Management solves this issue elegantly by declaring the desired state of clusters in YAML or JSON files called as Configs. Then Anthos ensures from top-down that all clusters stay reconciled to the desired state. This is the same principle of configuration as code which is the soul of Kubernetes manifests.

In the context of Anthos and Google Kubernetes Engine (GKE), Nomos is a CLI tool which checks config files in git repository for any syntax errors. Nomos tool is installed locally and with Nomos you can check config files for syntax before pushing them to your single source of truth Git repository.

The usage of Nomos is quite intuitive. For help use:

nomos --help

To check installation status of Nomos:

nomos status

To initialize a new Anthos Config Management repo, create an empty directory, change to it, initialize a new Git repository, then run the nomos init command:

mkdir my-repo
cd my-repo
git init
nomos init

This creates the basic directory structure of your repo, including the system/, cluster/, and namespaces/ directories.

Before you commit a config to the repo, use the nomos vet command to check the syntax and validity of the configs in your repo:

nomos vet

If syntax errors are found, the nomos vet command exits with a non-zero status.

You can read more about nomos here.

No comments: