Published on 00/00/0000
Last updated on 00/00/0000
Published on 00/00/0000
Last updated on 00/00/0000
Share
Share
11 min read
Share
Want to know more? Get in touch with us, or delve into the details of the latest release. Or just take a look at some of the Istio features that Backyards automates and simplifies for you, and which we've already blogged about.Service interruptions caused by outages can have severe business consequences, so it's important that we build, run and test resilient systems. Resiliency can be implemented and tested at multiple levels, from the bottom infrastructure layer all the way to the application. While building our container management platform, Pipeline, implementing that type of comprehensive resiliency was one our key considerations. In this post we'll take a deep-dive into the fault injection feature of Istio (and the Banzai Cloud Istio operator), and how users of our automated service mesh - Backyards (now Cisco Service Mesh Manager) - can use it simply and effectively. Note that Backyards (now Cisco Service Mesh Manager), while being integrated into Pipeline, is also available as a standalone product: and features a practical, easy-to-use management UI, CLI and GraphQL API built on top of our Istio operator.
Some of the related Backyards features we have already blogged about are:In this post, we'll be focusing on Istio's fault injection feature.
compile-time injection
(modifying the source code of the software) or with runtime injection
, in which software triggers cause faults during specific scenarios.
To protect a system from cascading failures caused by slow response or failing services, it's good practice to use circuit breakers.
fault
field under an HTTP route of the VirtualService
Istio custom resource. Faults include aborting HTTP requests from a downstream service, and/or delaying the proxying of requests. A fault rule must have
either a delay or abort (or both).
Delay can delay requests before forwarding, emulating various failures such as network issues, an overloaded upstream service, etc.
Abort can abort HTTP request attempts and return error codes to a downstream service, giving the impression that the upstream service is faulty.
Delay and abort faults are independent of one another, even if both are set to occur simultaneously.Let's take a look at an example
VirtualService
:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews-route
spec:
hosts:
- reviews.prod.svc.cluster.local
http:
- match:
- sourceLabels:
env: prod
route:
- destination:
host: reviews.prod.svc.cluster.local
subset: v1
fault:
abort:
percentage:
value: 10
httpStatus: 503
delay:
percentage:
value: 40
fixedDelay: 5s
When this service is called, 10% of the calls will return 503 responses and 40% will experience a five second delay before they send a response.
Under the hood this feature uses Envoy's fault injection feature.
VirtualService
resource to modify fault injection configurations. Instead, you can achieve the same result via a convenient UI, or, if you prefer, through the Backyards CLI command line tool.
The above is just one example of Backyards' HTTP routing features. There are lots more!On top of this, you can see visualizations of, and live dashboards for, your services and requests, so it's easy for you to tell what's going on.
I created a Kubernetes cluster on GKE via the free developer version of the Pipeline platform. If you'd like to do likewise, go ahead and create your cluster on any of the five cloud providers we support, or on-premise, using Pipeline. Otherwise bring your own Kubernetes cluster.
KUBECONFIG
must be set for your cluster):
❯ backyards install -a --run-demo
This command first installs Istio with our open-source Istio operator, then installs Backyards itself, as well as a demo application for demonstration purposes. After the installation of each component has finished, the Backyards UI will automatically open and send some traffic to the demo application. By issuing this one simple command you can watch Backyards start a brand new Istio cluster in just a few minutes! Give it a try!
You can do all these steps in a sequential order, as well. Backyards requires an Istio cluster - if you don't have one, you can install Istio withThe demo application contains several microservice deploments to be able to show and try the various features of the Backyards product. To test how the system behaves.backyards istio install
. Once you have Istio installed, you can install Backyards withbackyards install
. Finally, you can deploy the demo application withbackyards demoapp install
. Tip: Backyards is a core component of the Pipeline platform. Try the hosted developer version, here: https://try.pipeline.banzai.cloud/ (Service Mesh tab).
❯ backyards routing fault-injection set backyards-demo/payments -m any
? Percentage of requests on which the delay will be injected 0
? Add a fixed delay before forwarding the request. Format: 1h/1m/1s/1ms. MUST be >1ms. 5s
? Percentage of requests on which the abort will be injected 100
? HTTP status code to use to abort the HTTP request 503
INFO[0016] fault injection for backyards-demo/payments set successfully
Fault injection settings for backyards-demo/payments
Matches Delay percentage Fixed delay Abort percentage Abort http status code
any - - 100 503
Send a load to the demo application with the following command:
❯ backyards demoapp load
As shown below, payments will behave erroneously and start throwing 503 errors.
❯ backyards routing fault-injection delete backyards-demo/payments -m any
Fault injection settings for backyards-demo/payments
Matches Delay percentage Fixed delay Abort percentage Abort http status code
any - - 100 503
? Do you want to DELETE the fault injection? Yes
INFO[0005] fault injection set to backyards-demo/payments successfully deleted
❯ backyards routing fault-injection set backyards-demo/payments -m any
? Percentage of requests on which the delay will be injected 100
? Add a fixed delay before forwarding the request. Format: 1h/1m/1s/1ms. MUST be >1ms. 5s
? Percentage of requests on which the abort will be injected 0
? HTTP status code to use to abort the HTTP request 503
INFO[0007] fault injection for backyards-demo/payments set successfully
Fault injection settings for backyards-demo/payments
Matches Delay percentage Fixed delay Abort percentage Abort http status code
any 100 4s 0 503
To protect the system from cascading failures caused by slowly responding or failing services, it is also a good practice to use circuit breakers.
retry policy
and timeout
in Istio also can be set in a VirtualService
resource.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: payments
spec:
hosts:
- payments
http:
- route:
- destination:
host: payments
retries:
attempts: 3
perTryTimeout: 2s
timeout: 10s
The configuration above specifies a 10 second timeout for calls to payments
service and also configures a maximum of 3 retries to connect to this service after an initial call failure, each with a 2 second timeout.
Under the hood this feature uses the automatic retries feature of Envoy.
❯ backyards routing route set backyards-demo/bookings -m any --retry-on 5xx --retry-attempts 5
INFO[0001] routing for backyards-demo/bookings set successfully
Settings for backyards-demo/bookings
Matches Routes Redirect Timeout Retry
any 100% bookings - - 5x (2s ptt) on 5xx
payments
service to 5 seconds:
❯ backyards routing route set backyards-demo/bookings -m any -t 5s
INFO[0002] routing for backyards-demo/bookings set successfully
Settings for backyards-demo/bookings
Matches Routes Redirect Timeout Retry
any 100% bookings - 5s -
❯ backyards uninstall -a
With Backyards, you don't necessarily need to be familiar with Istio's Custom Resources, and don't have to edit them manually to set fault injection rules, retry policies or timeouts. Instead, you can easily configure these rules from a convenient UI or with the Backyards CLI command line tool. You can then check the visualized traffic flow to make sure that the rules and your services are working as expected.
Get emerging insights on emerging technology straight to your inbox.
Outshift is leading the way in building an open, interoperable, agent-first, quantum-safe infrastructure for the future of artificial intelligence.
* No email required
The Shift is Outshift’s exclusive newsletter.
Get the latest news and updates on generative AI, quantum computing, and other groundbreaking innovations shaping the future of technology.