46
CHAPTER 3 | Architecting container and microservice-based applications
Azure API Management
Azure API Management
(as shown in Figure 4-14) not only solves your API Gateway needs but
pro
vides features like gathering insights from your APIs. If you’re using an
API management solution,
an API Gateway is only a component within that full API management solution.
Figure 4-14. Using Azure API Management for your API Gateway
Azure API Management solves both your API Gateway and Management needs like logging, security,
metering, etc. In this case, when using a product like Azure API Management,
the fact that you might
have a single API Gateway is not so risky because these kinds of API G
ateways are “thinner”, meaning
that you don’t implement custom C# code that could evolve towards a monolithic component.
The API Gateway products usually act like a reverse proxy for ingress communication, where you can
also filter the APIs from the internal microservices plus apply authorization to the published APIs in
this single tier.
The insights available from an API Management system help you get an understanding of how your
APIs are being used and how they are performing. They do this activity by letting you view near real-
time analytics reports and identifying trends that might impact your business. Plus,
you can have logs
about request and response activity for further online and offline analysis.
With Azure API Management, you can secure your APIs using a key, a token, and IP filtering. These
features let you enforce flexible and fine-grained quotas and rate limits, modify the shape and
behavior of your APIs using policies, and improve performance with response caching.
In this guide and the reference sample application (eShopOnContainers), the architecture is limited to
a simpler and custom-made containerized architecture in order to focus on plain containers without
47
CHAPTER 3 | Architecting container and microservice-based applications
using PaaS products like Azure API Management. But for large microservice-based applications that
are deployed into Microsoft Azure, we encourage you to evaluate Azure API
Management as the base
for your API Gateways in production.
Ocelot
Ocelot
is a lightweight API Gateway, recommended for simpler approaches. Ocelot is an Open Source
.NET Core-based API Gateway especially made for microservices architectures that need unified points
of entry into their systems. It’s lightweight, fast, and scalabl
e and provides routing and authentication
among many other features.
The main reason to choose Ocelot for the
eShopOnContainers reference application 2.0
is because
Ocelot is a .NET Core lightweight API Gateway that you can deploy
into the same application
deployment environment where you’re deploying your microservices/containers, such as a Docker
Host, Kubernetes, etc. And since it
’s based on .NET Core, it’s cross
-platform allowing you to deploy on
Linux or Windows.
The previous diagrams showing custom API Gateways running in containers are precisely how you can
also run Ocelot in a container and microservice-based application.
In addition, there are many other products in the market
offering API Gateways features, such as
Apigee, Kong, MuleSoft, WSO2, and other products like Linkerd and Istio for service mesh ingress
controller features.
After the initial architecture and patterns explanation sections, the next sections explain how to
implement
API Gateways with
Ocelot
.
Dostları ilə paylaş: