The Two Most Important Challenges With an API Gateway When Adopting Kubernetes
When integrating an API gateway, you must consider how to scale management and accommodate a broad range of architectures.
Join the DZone community and get the full member experience.Join For Free
Building applications using the microservices pattern and deploying these services onto Kubernetes has become the de facto approach for running cloud-native applications today. In a microservice architecture, a single application is decomposed into multiple microservices. Each microservice is owned by a small team that is empowered and responsible to make the right decisions for the specific microservice.
You may also like: Adopting Kubernetes? Here's What You Should Definitely Not Do
This responsibility typically extends from the edge of the system where the user requests arrive, right the way through to the service's business logic and down into the associated messaging and data store schema.
When integrating an API gateway with a microservices-based application running on Kubernetes, you must consider two primary challenges:
- How to scale the management of 100s of services and the associated APIs.
- How the gateway can support a broad range of microservice architectures, protocols, and configuration that typically spans the entire edge stack.
The API Gateway: A Focal Point with Microservices
The Edge and Kubernetes Ingress
An API gateway is at the core of how APIs are managed, secured, and presented. It is deployed as a software component (or series of components) on virtual machines or within Kubernetes and acts as the single entry point into a system. The primary responsibility of an API gateway is to enable multiple APIs, microservices, and backend systems to be accessed reliably and safely by users.
Microservices and Kubernetes provide implementation flexibility. For example, one team may elect to expose a container-based microservice at the edge of the system (the boundary between the internal services and end-users) as a set of REST APIs over HTTP.
Another team may choose Protobufs and gRPC. A team with real-time streaming requirements may expose their microservice over WebSocket APIs. Any API gateway deployed within Kubernetes must support all of these protocols.
Each team is not only free to make these choices, but they are also responsible for the consequences; this often translates into "you build it, you run it". Although not every organization subscribes completely to this way of working, every microservice team needs to be able to understand, diagnose, and configure all aspects of the handling of each service and each user's request into the application.
The diversity of runtime requirements related to applications and APIs means that each team will be working with all layers within the edge stack, for example, the dynamic request handling, the WAF, and any caching implementation.
The development paradigm of microservices — independent, empowered, and responsible teams — creates a new set of challenges for microservice teams working with API Gateways, Kubernetes ingress and the edge.
In this article, we identify two important challenges for the edge: managing independent microservices and having access to a comprehensive edge stack.
Challenge #1: Scaling Edge Management
The Challenges of Managing the Edge Increase With the Number of Microservices Deployed
In a microservices architecture, engineers will be managing many more services and applications. Each team needs to be able to manage their services independently, for releases to be decoupled from other teams' schedules.
The traditional approach to exposing applications at the edge is typically done through centralized operations or platform team; however, a single ops team cannot scale to handle the volume of changes that are necessary when an organization has hundreds of microservices.
Typical changes that require modification of configuration at the edge:
- The new version of a service being deployed.
- Modifying endpoints, routing instructions, or the associated backend services.
- Changes to authentication and authorization services.
- Modification of nonfunctional requirements, such as rate-limiting, timeouts, retries patterns, and circuit-breaking.
- User testing of new functionality, for example, enabling a feature for a small subset of beta test users.
Adopting a microservices-based architecture will result in a significant rise in the number of releases. This increase only magnifies the edge management challenges and increases the strain on a centralized approach to operation.
Challenge #2: Supporting a Diverse Range of Edge Requirements
Microservices Introduce Several New Concerns at the Edge
The microservice architecture enables architectural flexibility. Application developers take advantage of this flexibility to choose the programming language and architecture that best fits the specific requirements of the service.
The edge needs to support the broad spectrum of functionality that needs to be exposed to users, regardless of the architecture. This extends the traditional role of the API gateway, and some of the challenges related to the need for consolidated tooling at the edge include:
- The ability to adeptly route a wide variety of protocols. Common protocols include HTTP/1.1, HTTP/2, WebSockets, gRPC, gRPC-Web, and TCP.
- Provide the full aggregate set of edge capabilities needed by any specific service, ranging from traffic management to observability to authentication and beyond.
- Exposing these capabilities in a self-service model for application developers.
Encouraging a diversity of implementation within microservice teams allows engineers to choose the "right tool for the job"; however, the consolidation of the underlying platform offers many benefits. Rather than allowing developers to build bespoke implementations for additional protocol support or security handling, it is much more manageable and scalable to present them with a pre-approved "buffet" of options at the edge, so that they can pick and choose the most appropriate combination of functionality.
As organizations adopt Kubernetes and shift to a microservices-based architecture, a new set of challenges emerge at the boundary between end-users and the internal microservices. This "edge" of the system, and related technologies like an API gateway, are therefore a focal point when adopting microservices.
These new challenges at the edge are driven by the organizational model of microservices, where independent teams are empowered and responsible to make the right architectural and implementation decisions for a microservice.
Managing the edge of the system has always been complicated. Adding more services with a diversity of architectures only increases the demands on the edge. Platform teams must design, choose, and implement their API gateway and edge tooling accordingly.
Why the Adoption of Kubernetes Will Explode in 2018
The Top 3 Things Holding Back Your Kubernetes Strategy and How to Fix Them
Published at DZone with permission of Daniel Bryant, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Database Integration Tests With Spring Boot and Testcontainers
Observability Architecture: Financial Payments Introduction
Building a Flask Web Application With Docker: A Step-by-Step Guide