Datacenter Based Routing
As we cater to enterprise needs, high-availability of our application is mandatory and it’s no more good to have features. We need high-availability for AppViewX microservices and MongoDB. The application is based on microservice architecture and the calls to the services are routed via gateway component. The gateway component supports a concept called strict datacenter based routing. When the gateway component is enabled with strict datacenter based routing mode, then the calls to a particular service has to be routed to the datacenter where it’s provisioned.
To achieve high-availability of application and strict datacenter routing, we used Kubernetes namespace object as a solution. Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces. A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace.
We used namespace and pod affinity/anti-affinity to spin the pods in the configured datacenter. The gateway routing table is configured with the fully-qualified domain of the service running in different datacenter with their respective namespace as DNS. This way the gateway component was able to talk to the service hosted in particular datacenter when strict data routing is enabled.