Google Cloud Anthos — Configuring Google Cloud Anthos for Multi-Cluster Operation — Part 3

Payoda Technology Inc
3 min readAug 9, 2021

--

This is part-3 of the Google Cloud Anthos Series. Please click here for Part 1 and here for Part 2.

  1. Google Cloud Anthos covering the basics of Anthos and Kubernetes.
  2. Creating Clusters using Kubernetes Engine in both Azure and GCP and enabling services in the same.

In this blog, we will learn about

  1. Kubectl
  2. Kubectx
  3. Registering clusters with Anthos
  4. Create service account, role, and role binding

Kubectl

Kubectl controls the Kubernetes Cluster. It is one of the key components of Kubernetes which runs on the workstation on any machine when the setup is done. It has the capability to manage the nodes in the cluster.

  • Displays nodes in the cluster
    - Kubectl get nodes
  • Displays all the pods
    - Kubectl get pods
  • It has the capability to configure a resource by file
    - Kubectl apply -f <filename>
  • Displays the deployment in the cluster
    - Kubectl get deployment
  • Displays the current-context
    - Kubectl config current-context
  • Displays the services in the cluster
    - Kubectl get services
  • Deletes the specified deployment
    - Kubectl delete deployment <deployment name>
  • Deletes the specified service
    - Kubectl delete service <service name>

Kubectx

Kubectx is a utility to manage and switch between kubectl contexts. It helps you switch between clusters back and forth.

  • list the contexts
    - kubectx
  • switch to context <NAME>
    - kubectx <NAME>
  • kubectx
  • show the current context name
    - kubectx -c, — current

Step 1: Registering Clusters with Anthos

In Azure:

In GCP:

Step 2: Check if the clusters are registered with Anthos

Step 3: Run the below commands to create the service account, role, and role binding.

In Azure — Create a file called node-reader. YAML

The below commands create the service account, role, and role binding.

Step 4: The secret associated with the anthos-user service account

Step 5: Paste the token in GCP-Login

Access the Anthos dashboard and click on the cluster name and click on the login button.

Under the Token, paste the string copied in the previous step and click the Login button.

Now, you can access the GCP cluster information from Anthos. Repeat the above steps with the AKS context to enable access to it.

Congratulations! You have successfully registered two clusters with Anthos.

Author: Santhosh Mathavan, Karthik Prabhu — Cloud CoE

--

--

Payoda Technology Inc

Your Digital Transformation partner. We are here to share knowledge on varied technologies, updates; and to stay in touch with the tech-space.