DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Anatomy of a High Availability Kubernetes Cluster
  • Auditing Tools for Kubernetes
  • Kubernetes Cluster Setup on Ubuntu, Explained
  • Key Considerations When Implementing Virtual Kubernetes Clusters

Trending

  • Architecting Zero-Trust AI Agents: How to Handle Data Safely
  • Rethinking Java CRUDs With Event Sourcing and CQRS Patterns
  • Implementing Secure API Gateways for Microservices Architecture
  • Exactly-Once Processing: Myth vs Reality
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Multicluster Gateways With Kubernetes Gateway API

Multicluster Gateways With Kubernetes Gateway API

In this article, discover how to use the Gateway API spec to configure gateways for multicluster setup.

By 
Ravi Verma user avatar
Ravi Verma
·
Aug. 22, 24 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
8.2K Views

Join the DZone community and get the full member experience.

Join For Free

Kubernetes Gateway API is the new specification released by CNCF to standardize the Kubernetes Ingress traffic. Now, what if a service is configured as High Availability (HA)? (Say it is in a different cloud environment and you have to access it from the Gateway; i.e., multicluster, multi-cloud scenario.) In this article, we will showcase how to use the Gateway API spec to configure gateways for multicluster setup. 

Multicluster Kubernetes Gateway Demo Overview

We have two clusters: one in EKS (primary) and the other in GKE (remote). I have deployed Istio in both the clusters and the setup is primary-remote Istio installation. Istio is used as the controller to implement the Gateway API resources. 

Here’s what I’m going to do:

  • In the primary cluster/EKS, deploy the helloworld-v1 deployment, helloworld service, and echoserver service.
  • In the remote cluster/GKE, deploy helloworld-v2 deployment, helloworld service, echoserver deployment, and echoserver service.
  • Deploy the Kubernetes Gateway API resources — Gateway and HTTPRoutes — in the primary cluster.
  • After the deployments, we will verify that the Gateway in the primary cluster/EKS can access the services in the remote cluster/GKE, as shown in the image below:

Multicluster Kubernetes Gateway Demo Overview

Multicluster, multi-cloud Gateway with K8s Gateway API demo setup

Deploy the Applications and Services in Clusters

Deploy helloworld-service in both the primary and remote clusters:

YAML
 
kubectl -f apply helloworld-service.yaml --context=eks-cluster
kubectl -f apply helloworld-service.yaml --context=gke-cluster


Deploy helloworld-deployment-v1 to the primary cluster/EKS and helloworld-deployment-v2 to the remote cluster/GKE:
YAML
 
kubectl -f apply helloworld-deployment-v1.yaml --context=eks-cluster
kubectl -f apply helloworld-deployment-v2.yaml --context=gke-cluster


Deploy echoserver-service in both the clusters and echoserver-deployment only in the remote cluster:
YAML
 
kubectl -f apply echoserver-service.yaml --context=eks-cluster
kubectl -f apply echoserver-service.yaml --context=gke-cluster
kubectl -f apply echoserver-deployment.yaml --context=gke-cluster


Note that service resources need to be deployed in both clusters for this to work. That is why I deployed the echoserver-service in the primary cluster/EKS although the deployment is only in the remote cluster/GKE.

Now, let us verify the deployments in both the primary and secondary clusters:

YAML
 
kubectl get svc -n demo --context=eks-cluster
kubectl get pods -n demo --context=eks-cluster
kubectl get svc -n demo --context=gke-cluster
kubectl get pods -n demo --context=gke-cluster

Deployments in both the primary and secondary clusters

The primary cluster has the helloworld-v1 pod running, while the remote cluster has both helloworld-v2 and echoserver pods running successfully:

Primary cluster (EKS) and remote cluster (GKE)

Deploy K8s Gateway API Resources and Verify Multicluster Communication

Apply the gateway resource in the primary/EKS cluster:

YAML
 
kubectl apply -f gateway-api-gateway.yaml --context=eks-cluster


The Gateway uses Istio as the controller and is deployed in the istio-ingress namespace.

Deploy HTTPRoute in the primary cluster for the helloworld application, which listens on path /hello:

YAML
 
kubectl apply -f helloworld-httproute.yaml --context=eks-cluster


Now, let us verify multicluster communication by curling the helloworld application; but first, we need to get the Gateway IP:

YAML
 
kubectl get svc -n istio-ingress --context=eks-cluster


Verify multicluster communication:
YAML
 
curl your_gateway_external_ip/hello


Multicluster communication

You can see that the request is served by both the helloworld-v1 and helloworld-v2 that are deployed in the primary and secondary clusters, respectively.

Now, let us deploy the HTTPRoute for echoserver in the primary cluster, which listens on / :

YAML
 
kubectl apply -f echoserver-httproute.yaml --context=eks-cluster


Verify if the Gateway is able to access echoserver deployed in the remote cluster:

YAML
 
curl your_gateway_external_ip

ateway is able to access echoserver deployed in the remote cluster

The Gateway is able to get a response from echoserver deployed in the remote cluster successfully. And that is the end of the demo.

API Kubernetes YAML cluster clusters

Published at DZone with permission of Ravi Verma. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Anatomy of a High Availability Kubernetes Cluster
  • Auditing Tools for Kubernetes
  • Kubernetes Cluster Setup on Ubuntu, Explained
  • Key Considerations When Implementing Virtual Kubernetes Clusters

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook