

Follow along this lab to learn how to launch multiple Kubernetes clusters, tie them together with a Federated control plane, and launch a Ingress controller with a single, globally addressable IP address.

What you'll learn

What you'll need

How will you use this tutorial?

Read it through only Read it and complete the exercises

How would rate your experience with Google Cloud Platform?

Novice Intermediate Proficient

Self-paced environment setup






In this section you'll create a two Google Container Engine clusters.

Login to Google Cloud Console


Setup Project Prerequisites

Enable APIs


Now click "Enable"

Set Compute Zone



We'll be using the gcloud command to create the clusters.

Create Two New Clusters

You can create a the container clusters with the gcloud command:

Create the first cluster as a background task:

gcloud container clusters create cluster-1 \
  --zone=us-west1-a --quiet \
  --scopes cloud-platform,storage-ro,logging-write,monitoring-write,service-control,service-management, \
  > /dev/null 2>&1 &

Then, create the second cluster at the same time:

gcloud container clusters create cluster-2 \
  --zone=us-east1-b --quiet \

These commands create two new clusters called "cluster-1" and "cluster-2" with three nodes (VMs). You can configure this command with additional flags to change the number of nodes, the default permissions, and other variables. See the documentation for more details. The clusters also have the "Cloud DNS" scope, which is required to set up Federation.

One cluster is located in the us-west region, while the other is located in the us-east region. You can create clusters in any Google Cloud region.


cluster-2  us-east1-b  1.5.2   n1-standard-1  1.5.2         3          RUNNING

In order for pods in a Kubernetes cluster to discover services in remote clusters, you need to create a DNS zone with a registered domain name.

In order to set up the Federation Control Plane, we will use the kubefed tool.

Download kubefed and move it into the path:

curl -O && \
  tar -xzvf kubernetes-client-linux-amd64.tar.gz && \
  sudo cp kubernetes/client/bin/kubefed /usr/local/bin && \
  sudo chmod +x /usr/local/bin/kubefed

The next step is to create a new federated context. This will act as a virtual "super cluster" that can schedule onto all the federated clusters.

To see the current contexts, run this command:

kubectl config get-contexts

You should see the two clusters that you created in the previous steps:

kubectl config get-contexts
CURRENT   NAME                                         CLUSTER                                      AUTHINFO                                     NAMESPACE
          gke_codelab-93622_us-east1-b_cluster-2   gke_codelab-93622_us-east1-b_cluster-2   gke_codelab-93622_us-east1-b_cluster-2   
*         gke_codelab-93622_us-west1-a_cluster-1   gke_codelab-93622_us-west1-a_cluster-1   gke_codelab-93622_us-west1-a_cluster-1 

Now, create the virtual context with the kubefed tool


What we've covered

Next Steps