Kubernetes Gateway API is the brand new specification launched by CNCF to standardize the Kubernetes Ingress visitors. Now, what if a service is configured as Excessive Availability (HA)? (Say it’s in a special cloud atmosphere and it’s important to entry it from the Gateway; i.e., multicluster, multi-cloud situation.) On this article, we are going to showcase how you can use the Gateway API spec to configure gateways for multicluster setup.
Multicluster Kubernetes Gateway Demo Overview
We now have two clusters: one in EKS (major) and the opposite in GKE (distant). I’ve deployed Istio in each the clusters and the setup is primary-remote Istio set up. Istio is used because the controller to implement the Gateway API assets.
Right here’s what I’m going to do:
- Within the major cluster/EKS, deploy the
helloworld-v1
deployment,helloworld
service, andechoserver
service. - Within the distant cluster/GKE, deploy
helloworld-v2
deployment,helloworld
service,echoserver
deployment, andechoserver
service. - Deploy the Kubernetes Gateway API assets —
Gateway
andHTTPRoutes
— within the major cluster. - After the deployments, we are going to confirm that the Gateway within the major cluster/EKS can entry the companies within the distant cluster/GKE, as proven within the picture beneath:
Multicluster, multi-cloud Gateway with K8s Gateway API demo setup
Deploy the Functions and Providers in Clusters
Deploy helloworld-service in each the first and distant clusters:
kubectl -f apply helloworld-service.yaml --context=eks-cluster
kubectl -f apply helloworld-service.yaml --context=gke-cluster
kubectl -f apply helloworld-deployment-v1.yaml --context=eks-cluster
kubectl -f apply helloworld-deployment-v2.yaml --context=gke-cluster
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
Word that service assets should be deployed in each clusters for this to work. That’s the reason I deployed the echoserver-service
within the major cluster/EKS though the deployment is just within the distant cluster/GKE.
Now, allow us to confirm the deployments in each the first and secondary clusters:
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
The first cluster has the helloworld-v1
pod working, whereas the distant cluster has each helloworld-v2
and echoserver
pods working efficiently:
Deploy K8s Gateway API Sources and Confirm Multicluster Communication
Apply the gateway useful resource within the major/EKS cluster:
kubectl apply -f gateway-api-gateway.yaml --context=eks-cluster
The Gateway makes use of Istio because the controller and is deployed within the istio-ingress
namespace.
Deploy HTTPRoute within the major cluster for the helloworld
software, which listens on path /good day:
kubectl apply -f helloworld-httproute.yaml --context=eks-cluster
Now, allow us to confirm multicluster communication by curling the helloworld
software; however first, we have to get the Gateway IP:
kubectl get svc -n istio-ingress --context=eks-cluster
Confirm multicluster communication:
curl your_gateway_external_ip/good day
You possibly can see that the request is served by each the helloworld-v1
and helloworld-v2
which can be deployed within the major and secondary clusters, respectively.
Now, allow us to deploy the HTTPRoute for echoserver within the major cluster, which listens on / :
kubectl apply -f echoserver-httproute.yaml --context=eks-cluster
Confirm if the Gateway is ready to entry echoserver
deployed within the distant cluster:
curl your_gateway_external_ip
The Gateway is ready to get a response from echoserver
deployed within the distant cluster efficiently. And that’s the finish of the demo.