Skip to content
tezvyn:

Service Mesh Authorization: A Bouncer for Your Microservices

Source: istio.ioMediumHow cards are made

Service Mesh Authorization: A Bouncer for Your Microservices

A service mesh authorization policy is a bouncer for your microservices. It moves access control from your app to the mesh, checking service identity and request details like HTTP method and path. Use it for fine-grained, Zero Trust security.

Why it exists

In microservice architectures, traditional IP-based firewalls are ineffective because service instances are ephemeral and IPs change constantly. Authorization policies solve this by enabling access control based on strong, cryptographic service identities rather than network locations. This decouples security rules from application code.

The mental model

Think of it as a bouncer at a club's VIP room door. A Kubernetes NetworkPolicy is like the front door guard checking if you're on the building's guest list (can this IP talk to that IP?). An AuthorizationPolicy is the bouncer inside who inspects your ID (service identity, JWT), asks what you want (HTTP method and path), and checks if you have permission for that specific action.

How it works

You define an AuthorizationPolicy resource in Kubernetes. This policy selects a target workload (e.g., the payments-api service) and specifies rules. The rules define who is allowed or denied access (from), what operations they can perform (to), and under what conditions (when). The service mesh's sidecar proxy (like Envoy) intercepts every request to the workload and enforces these rules before the request ever reaches your application.

When to use it

Use it to enforce Zero Trust security between services. It's ideal for fine-grained control, like allowing GET but not POST requests from a specific service, or restricting access to /admin endpoints to only requests carrying a JWT with an admin: true claim. This is the tool for securing service-to-service communication.

When not to use it

Don't use it for basic L3/L4 network segmentation; a standard Kubernetes NetworkPolicy is simpler and more appropriate for blocking traffic between pods based on IP or port. Also, it's not for application-level authorization, like checking if a user has permission to edit a specific document they own. That logic belongs in your application.

One canonical example

A common pattern is to create a default "deny-all" policy for a namespace. Then, you add a second policy that explicitly allows the ingress-gateway to send GET requests to the /products path of the product-catalog service, and another policy allowing the checkout service to call any path on the inventory service. This "deny by default, allow by exception" model is a core Zero Trust principle.

Interview question

A development team needs to secure communication between microservices, ensuring only specific services can perform certain actions (e.g., GET vs. POST) on particular API endpoints. Which security mechanism is best suited for this requirement?

  • a.Embedding authorization logic directly within each microservice's application code.
  • b.Implementing a Kubernetes NetworkPolicy to restrict traffic between pods based on IP addresses.
  • c.Deploying a traditional perimeter firewall to filter incoming and outgoing traffic at the cluster boundary.
  • d.Utilizing a service mesh AuthorizationPolicy to define rules based on service identity and request attributes.Correct
Why?

A service mesh AuthorizationPolicy is specifically designed for fine-grained control over service-to-service communication, allowing rules based on service identity, HTTP methods, and paths. While embedding authorization logic in application code (Option A) is possible, the card emphasizes that AuthorizationPolicies decouple security rules from the application, making Option D the best fit for the described need.

Just read this? Test yourself on what you have been reading.

Read the original → istio.io

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles