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 setting and it’s a must to entry it from the Gateway; i.e., multicluster, multi-cloud state of affairs.) On this article, we’ll showcase use the Gateway API spec to configure gateways for multicluster setup.
Multicluster Kubernetes Gateway Demo Overview
We have now two clusters: one in EKS (main) 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 main 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 main cluster. - After the deployments, we’ll confirm that the Gateway within the main 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 Purposes 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
Be aware that service assets must be deployed in each clusters for this to work. That’s the reason I deployed the echoserver-service
within the main 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 Assets and Confirm Multicluster Communication
Apply the gateway useful resource within the main/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 main cluster for the helloworld
software, which listens on path /hey:
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/hey
You’ll be able to see that the request is served by each the helloworld-v1
and helloworld-v2
which can be deployed within the main and secondary clusters, respectively.
Now, allow us to deploy the HTTPRoute for echoserver within the main 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.