Reputation: 11
We all know the use of ingress in a kubernetes cluster as a solution for path/context/url based routing for multiple services hosted on a kubernetes cluster. However, my requirement is a bit different. I have 2 clusters - EU n US regions hosted. Both these clusters host different set of applications app1, app2 in US cluster while app3 n app4 in EU cluster. Now i require an ingress type router sitting outside my clusters that i have a common entry point for all the applications ie www.example.com/us for US clusters and www.example.com/eu for EU clusters. And then the corresponding ingress on each cluster will route based on app OR www.example.com/app1, /app2, /app3 etc based on applications which is routed to correct cluster and then ingress fwds to correct service in that cluster.
I have my custom domain www.example.com, but what is the solution or product i use in my network layer to implement this context/path based routing to the 2 clusters? DNS team said it cant be achieved at DNS level, and other load balancers follow round robin etc types algos which need all 4 apps on both the clusters but that is not a feasible solution for me. Can anyone suggest what to do here? My kubernetes clusters are in IBM Cloud. I cant have redundant services but need common entry point for both the clusters.
Upvotes: 0
Views: 314
Reputation: 181
You can have a look at the IBM Cloud API Gateway service.
For this example I was logged in to cloud.ibm.com with my IBM ID, all steps were done within the UI. I have created an instance of the API Gateway service with the Lite plan (free of charge).
To give it a try go to IBM Cloud API Gateway, choose a meaningful name for your instance of the API Gateway service and hit the "Create" button.
As a next step find the button "Create API Proxy", hit it and in the next screen choose a name for your API, for instance USA, specify the base path /us and copy the URL of your US based application.
Repeat this step and choose a different name (for instance EU), this time specify the base path /eu and copy the URL of your EU based application.
Now you have a setup that is very close to what you have been looking for. Both API Proxies share the same default domain and the requests for path '/us' are routed to the US based application and the requests for path '/eu' are routed to the EU based application.
To replace the default domain with your custom domain you need to navigate to "API Management" -> "Custom Domains" and provide the details.
I hope this helps. I tried the setup with an IBM Cloud Cloud Foundry sample app as the application for EU and an IBM Cloud Code Engine application as the US based app and for this simple test everything worked as expected with the default domain of my API Gateway instance.
Please comment if this also works in your case where your apps are running on Kubernetes cluster within IBM Cloud.
Upvotes: 1