Istio ... why?

Looking at post history in r/kubernetes it seems like Istio is all the rage in recent months - yet another 'getting started with Istio' blog post gets linked pretty much every week. But why would I actually need istio in kubernetes? Lets start with supposed upsides:

  • service discovery - kubernetes does that OOTB with DNS or env variables
  • load balancing - handled by kubernetes services
  • traffic shaping - ok, could be useful for canary deployments. Without istio I can only direct percentage of traffic based on number of pods
  • security - it is a different approach than mTLS, but I can use network policies instead
  • distributed tracing - it is useful I guess, but not really something unique to Istio. I am currently using Spring Boot + Sleuth, which is quite painless to set up

Now disadvantages:

  • mixer, envoy, pilot, citadel, galley - that's a lot of moving parts. Which means that when stuff breaks I will have one more complicated system to debug
  • performance - according to istio docs, using envoy comes with extra 8-20ms (for 15-60 connections). Not a big deal for calling a slow webservice, but definitely a big deal if I wanted to use Istio for Redis access as well

It seems to me that Istio could be quite useful for EC2/GCE clusters, but in case of kubernetes it just replicates a lot of built-in functionality in a different way.

Posted Aug 15, 2019, 4:07 PM UTC

10128
quailtop•

The goal with all service meshes is always to separate network failures from application failures. This is why they gained traction in the first place, so you don't have to bake network-aware logic into an application and require applications to then be aware of how the rest of the cluster is orchestrated.

Unfortunately, Kubernetes by itself doesn't do a perfect job of isolating network failure from application failure. Take your own example of how Kubernetes native services discover each other, via DNS or env variables.

Env variables are static and baked into the container; if an upstream service changes its ClusterIp (happens a lot if you update Deployments), then your env variables no longer resolve correctly until you restart your service

Similarly, DNS in Kubernetes is very dumb - in a single cluster, you can get away with <service>.svc URLs, but when you have multi-cluster you now need to also specify the exact cluster in which your service is hosted in for DNS to resolve correctly, which you cannot discover upfront. (Also, K8s DNS relies on an ndots hack in /etc/resolv.conf in containers which means the .svc URL is actually recursively expanded by kube-dns/CoreDNS until it matches the FQDN for the service in the cluster, which can take upto 5 or more round-robin queries to resolve - just an interesting note if you ever have to resolve a performance issue with DNS as I have had to :))

Service meshes improve on this by:

a) registering an arbitrary number of hostnames for any service rather than just a single DNS entry you can't control,

b) identifying how much in-cluster traffic should go to which services, which is great for more than just canarying (sharding data across StatefulSets and routing to the correct shard comes to mind)

c) ensuring communication between services is abstracted out from the service itself. This is the big win, and it means you get logging, metrics, and tracing instrumentation for free, rather than relying on access logs as a proxy.

d) doing crazy things at the network level like circuit breaking, packet filtering, etc. for quicker time to repair.

The main reason people gravitate towards Istio is because it provides all of these and other benefits in one place. You can certainly build your own piecemeal solution to one problem at a time, but sooner or later you need a service mesh. There are other service meshes besides Istio; Istio just happens to be the service mesh du jour just like K8s is the orchestration platform du jour.

Some companies need it sooner than others depending on how many services they're running and how many clusters they're operating - if you're curious about whether you've hit that point, look at how many of your SLO/SLA violations across all applications can be attributed to applications losing connectivity with each other that isn't because of the application itself. If it accounts for at least a tenth, I'd say you've hit that point.

121
etzolin•

This is a great summary on why to use Istio!

8
thockink8s maintainer•

Lots of good answers here, I'll give my quick take, point by point.

​

> service discovery - kubernetes does that OOTB with DNS or env variables

Kubernetes support for services other than "pods in this kubernetes cluster" is relatively poor. There's no built-in multi-cluster capability (yet?) and the support for "external" services is barely mentionable (and I wrote a lot of it, so I am allowed to malign it :)

> load balancing - handled by kubernetes services

Kubernetes spreads load, but the "balancing" is not very intelligent. Service mesh (Istio included, but not exclusive) can do smarter LB with better feedback and balancing.

> security - it is a different approach than mTLS, but I can use network policies instead

NetworkPolicy only applies at L4. There's need for policies at L7 (e.g. a particular URL path). Kubernetes can not do that. Istio is designed to allow RBAC even bteween clusters or other services (e.g. rando legacy VM-running thing).

​

Now, for sure, there are downsides. Istio is not free, in that it brings cognitive burden and ops overhead and runtime overhead. I know the Envoy and Istio teams are busy optimizing the runtime overhead - nobody thinks 20ms is acceptable. Fortunately optimization is a pretty well understood domain. I know the Istio team in particular but even the larger Kubernetes ecosystem are looking at ways to make the cliff between "kubernetes does what I need" and "OMG I have to adopt a mesh" less steep. But we're not there yet.

​

If you have not yet hit the place where you think "gah, why can't I just ...", then you maybe don't need an L7 mesh yet.

22
hardwaresofton•

Check out linkerd -- it's more opt-in and use as you go. You could start with v1 (which is how everyone was solving this problem up until now) which is super battle tested, or go with their v2 solution which is more Istio-like and offers most if not all of the same features.

One of the core upsides that you missed in the list above was the advanced retry/circuit breaking semantics -- in the past this was primarily built into the applications via libraries, but the service mesh also makes it possible to write smaller dumber apps that just rely on the network for that.

No one needs istio, but if you want to find out which service (or infrastructure piece) in the chain is slowing down your request without code changes, services meshes (or any kind of proxy, even if it's per-node) is the way to do it that is reusable.

16
[deleted]•

[deleted]

7
[deleted]•

[deleted]

6
Dc_awyeah•

How many networks suffer that kind of outage these days? It sounds like you’re actually talking about network services mainly - ie DNS related things, which are resolution issues on a name service. Not packet routing and forwarding, which is what network issues are.

Having said that, your points are very interesting, thanks for the info

1
[deleted]•

[deleted]

4
Tacticus•

also the timeout and hedging capabilities.

1
Veevoh•

I feel the same. See many people on my periphery saying 'Oh, we NEED to use Istio' but no real justification. I just don't get it...

4
pointycube•

Unfortunately there's a lot of resume-driven cargoculting right now going on in the ops and platform spaces.

11
utkuozdemir•

I think it's the situation of the whole IT industry.

2
campee•

Resume-driven development

4†
faman00•

What problems is istio supposed to solve?

3
elr0nd_hubbard•

I've recently enjoyed using linkerd and gloo as a replacement for Istio. I found both independently much easier to set up (or remove, if needed) than Istio's convoluted installation and configuration process.

Most importantly, though, I'm confident that we can swap or drop components independently.... we don't have to buy into the entire Istio ecosystem, which you alluded to.

3
Dc_awyeah•

Does that result in less added latency? Or is it just dependent on which features you turn on?

1
elr0nd_hubbard•

Between internal services (where linkerd is handling things) we haven't measured any increased latency. That's partly because linkerd v2 made proxy performance a priority, and also partly because we installed linkerd in part to improve our latency measurements between services.

On the Ingress side, gloo is built on Envoy, so I'd expect the same latency cost there. That said, gloo is currently performing better for us (if only very slightly) than GKE's default Ingress, which we were using before. This is probably due to network bottlenecks elsewhere, but means that YMMV for gloo. If it turns out that gloo is a bottleneck in the future, though, it's nice to be able to remove it without losing linkerd.

1
axtran•

Check out HashiCorp Consul Connect for a simplified proxy and mesh option.

3
return_of_the_ring•

It provides a lot of Servicemesh coolness as detailed by others.

But, it comes with some performance issues like latency and increased memory consumption.

Each sidecar maintains information about all services in the Namespace. It adds about 2 to 3MB per service. Multiply this with the number of pods and you have something that is consuming GBs of memory in total.

Eg: If you have a 100 pods and therefore a 100 sidecars, and you have about 30 services (conservatively speaking), you are now in a situation where each sidecar is using about 90MB (30*3) of memory and they are using about 9GB (100*90) of memory in total just for maintaining service level information.

3
[deleted]•

[deleted]

1
IUseRhetoric•

service discovery, load balancing

Sure, if you have everything in the same kubernetes cluster you don't need these features from istio. However, if you start wanting to mesh your deployments with services outside the cluster, suddenly this becomes a useful feature.

security - it is a different approach than mTLS, but I can use network policies instead

Network policies don't provide pod to pod TLS. This is useful when you suspect that a malicious actor may be trying to capture your kubernetes internal traffic.

distributed tracing

Istio provides tracing at the network layer, not at the application layer. The two are complementary.

Another feature that you haven't mentioned is the ability to do cross-cluster meshing. This helps abstract tasks related to multiregion deployments.

Like others said, istio is not the only service mesh implementation, nor the fastest. But it is available out of the box on GKE, and its automatic sidecar injection feature means that deployments can be converted to it without much extra effort.

2
Dc_awyeah•

SDN and SDN like mesh services are interesting, but mainly so when there’s a chance of offloading the processing workload, to a smartNIC or something similar. I haven’t read a lot, but it looks like Istio is implemented as sidecars, so it would always have to stay within the usual processing architecture for the pod, rather than acting as a proxy for all pods on the host, which could conceivably be achieved as a single agent sitting in hardware.

I know Juniper’s Contrail can do some of this functionality, but maybe not as much of the actual k8s service as people need. Does anyone know of an agent based alternative for mesh services like Istio? Or any other way of offloading the work to remove the latency issues?

2
pathslog•

Like you said, too many moving parts. Not to mention, a complete move away from the native Ingress approach, diving into a very young code base which could be potentially riddled with security flaws. If you don't need all the extra features provided by Istio, I'd say keep whatever ingress controller you have now as long as you have a good grasp and understanding of how it works.

Nginx-ingress-controller goes a long way doing a very descent job exposing traditional services and applications.

2
teh-leet•

Envoy is ingress and you do not mention it, so performance disadvatnage doesn't count. Tbh Envoy is one the best options to choose as Ingress in Kubernetes overall, find some blog posts on performance overview.

Kubernetes doesn't have Kiali. I don't know if you have such control via network policies like you can have with Istio.

2
[deleted]•

[deleted]

1
sleepybrett•

default k8s loadbalancing is very dumb. Your only control is healthchecking, with a service mesh you can often load balance on things like latency, maybe one pod is on an overloaded node, just send it less traffic.

2
mistertribal•

If you don’t need a service mesh, really don’t use one. At a point there comes a need and you’ll know when you get there. They are complex and add another layer of abstraction, but are super useful at a certain scale.

1
notronswanson_•

We began using it to support grpc load balancing between all of our microservices

1
[deleted]•

[deleted]

-2†