Skip to Content
Hands-On Microservices with Kubernetes
book

Hands-On Microservices with Kubernetes

by Gigi Sayfan
July 2019
Intermediate to advanced
502 pages
14h
English
Packt Publishing
Content preview from Hands-On Microservices with Kubernetes

Routing traffic to internal microservices

The main job of the API gateway service is to implement the API gateway pattern we discussed in Chapter 2, Getting Started with Microservices. For example, here is how it routes the get links requests to the proper method of the link microservice.

The Link class is derived from the Resource base class. It gets the host and port from the environment and constructs the base URL.

The get() method is called when a GET request for the links endpoint comes in. It extracts the username from the GitHub token in the _get_user() function and parses the query part of the request URL for the other parameter. Then, it makes its own request to the link manager service:

class Link(Resource): host = os.environ.get('LINK_MANAGER_SERVICE_HOST', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Microservices

Kubernetes Microservices

Richard Chesterwood
Cloud Native DevOps with Kubernetes

Cloud Native DevOps with Kubernetes

John Arundel, Justin Domingus
Microservices: Up and Running

Microservices: Up and Running

Ronnie Mitra, Irakli Nadareishvili

Publisher Resources

ISBN: 9781789805468Supplemental Content