Multi Cluster Ingress — GKE

Johanes Glenn
FAUN — Developer Community 🐾
4 min readSep 13, 2021

--

Background

In the last snippet, I explored the Multi Cluster Service in GKE using traffic director which enables a single cluster set FQDN to load-balanced between services in different clusters. In this snippet, I focus on the Multi Cluster Ingress which allows me to set an ingress that loadbalanced between two backends in a different cluster. To set the context I have not yet used Anthos Service Mesh at this point.

To see the documentation please go to :

and

Test

In this test the oversimplified version is that:

  1. I will create two different clusters with the same configuration I used for Multi Cluster Service, one in asia-southeast1-b and the other is in asia-southeast2-b.
  2. Register the cluster into Hub
  3. Enable the MCI on the cluster
  4. Deploy the MCS svc & MCI CRD on the Cluster

The Multi Cluster Ingress will allow me to create an HTTP(S) Load Balancer that has two backends coming from both clusters which came from a headless service created. This headless service has the pods ip as the endpoint which allows the ingress to have visibility to the pods.

Overly simplified version of multi-cluster-ingress

Steps

[One] Let’s create the two clusters, I will emphasize enabling the workload identity option.

Two clusters are ready, one in asia-southeast2-b and the other in asia-southeast1-b

For easier moving between contexts, we can rename the context or directly use kubectx cli. One highlight is to prepare namespaces that I may use on both clusters.

[Two] Then we can register the cluster into the hub and then enable hub ingress config on one of the clusters.

We can check by describing the hub ingress configuration through gcloud command

gcloud beta container hub ingress describe
hub ingress is active

[Three] let's deploy the workloads into both clusters but wait for exposing the service at a later step using the multi-cluster-service & multi-cluster-ingress on the cluster we configure the hub ingress.

as I enable the ingress on the jkt cluster, then I can apply the mcs and mci yaml on the jkt cluster
we can see on the ui that we have zone-mcs that registered on both cluster and mci-zone-mcs headless svc on each cluster
check of both headless svc
The ingress created through Multi Cluster Ingress
the description of mci created

[Four] Let's test to call the ingress VIP

When I run curl from my cloud shell it will redirect to the nearest cluster which in the end redirected to pods in asia-southeast1 (SG Cluster), I run the kubectl get pods -n sharedsvc in Jkt cluster to show that the list of pods is over there.

calling the VIP from my own machine which redirected to cluster in asia-southeast2

That’s the test for this snippet which shows the test for Multi Cluster Ingress that directly load balanced the traffic to the sets of backend through single HTTP(S) Load Balancer. Do you have any experience in running such a configuration? Looking forward to some stories!

Join FAUN: Website 💻|Podcast 🎙️|Twitter 🐦|Facebook 👥|Instagram 📷|Facebook Group 🗣️|Linkedin Group 💬| Slack 📱|Cloud Native News 📰|More.

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇

--

--