Istio's Networking API Explained [Video]
Istio service mesh's version 1.0 comes with a networking API. Learn what it can do and how it's components work together.
Join the DZone community and get the full member experience.Join For Free
1.0 comes with a networking API that comprises a lot of features and covers a variety of scenarios. The networking API has evolved in the last couple of months and might not be self-explanatory, right away. What are the concepts and building blocks of this API, and how do we use the individual Istio resource types in order to route traffic through our service mesh?
Although the documentation provides a huge amount of helpful information, I wanted to describe and explain the traffic routing in my own words. I had to struggle quite a bit to grasp what the concepts and motivations are, and especially how to apply the individual building blocks.
The following video aims to explain what the concepts of Istio’s networking (
v3alpha) API are, and how the building blocks are typically applied. It shows a visual model of the individual components in a service mesh that hopefully helps you in understanding and using Istio.
When to Use Which
Virtual services: To route traffic for a service that is part of the mesh to a specific destination, or subsets thereof, and/or to annotate HTTP (default) routes with certain behavior, such as timeouts.
Destination rules: To set policies on routed traffic, such as TLS settings, outlier detection, or load balancer settings, and/or to define subsets of services that are part of the mesh.
Service entries: To add additional services to Istio’s internal service registry, which is required to route traffic to external services. The added services can be enhanced with virtual services and destination rules.
Gateways (ingress): To route ingress traffic into the service mesh. The gateway needs to be bound to a virtual service which defines where the ingress traffic will be routed to.
Gateways (egress): To define a single point of exit where all egress traffic that leaves the mesh can be routed through. May be required for scenarios where only particular nodes can or should access external networks.
Insights & "Gotchas"
A few of my own insights that you might want to take into account once you start using Istio’s networking features. Some of them sound obvious but might contain a “gotcha” effect.
- Virtual services, as well as destination rules, don’t have to match platform (Kubernetes) services 1:1.
- HTTP and HTTPS/TLS is tread differently, especially in regards to routing rules and other “enhancements,” mostly due to the encrypted nature of the traffic. E.g.
- HTTPS traffic needs to be routed via TLS rules (using port & SNI), not HTTP rules.
- Resiliency features are only available for HTTP rules.
- Monitoring also displays either unencrypted HTTP traffic or just TCP, respectively. The latter naturally contains less information.
- To make use of all routing features, it makes sense to use unencrypted HTTP inside the service mesh.
- Istio’s optional mTLS still ensures that mesh-internal traffic is encrypted without requiring application-level HTTPS/TLS.
- Egress traffic can be encrypted via TLS once it leaves the mesh (see TLS origination).
- No external traffic is allowed to (undefined) services outside the mesh per default. Service entries are required.
- Ingress or egress gateway can be responsible for multiple platform (Kubernetes) services but needs to be bound to a single virtual service definition.
- Multiple ingress gateways can be deployed that use the same port number with different hostnames if the port name (label) differs.
- It’s possible to control or “enhance” egress traffic via both virtual services or destination rules that are defined for the external hostnames.
- Traffic to hosts specified in service entries can be re-routed to internal services.
- External service entries are monitored as individual services, as long as the entry isn’t redirected to another, internal service.
- Istio doesn’t perform DNS resolution, however, proxies will route traffic according to hostnames.
- Istio proxies regard hostnames as well as SNI names and can re-route traffic to internal or external services.
- It might make sense to define external services via platform (Kubernetes) external services, to resolve external service names via DNS. Especially TCP hostnames are typically resolved by the application.
I hope this clarifies Istio’s networking features a bit more. I’d be happy to receive your feedback!
Published at DZone with permission of Sebastian Daschner, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.