Published on 00/00/0000
Last updated on 00/00/0000
Published on 00/00/0000
Last updated on 00/00/0000
Share
Share
IN-DEPTH TECH
14 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.
Sidecar
custom resourceSidecar describes the configuration of the sidecar proxy that mediates inbound and outbound communication to the workload instance it is attached to. By default, Istio will program all sidecar proxies in the mesh with the necessary configuration required to reach every workload instance in the mesh, as well as accept traffic on all the ports associated with the workload. The Sidecar configuration provides a way to fine tune the set of ports, protocols that the proxy will accept when forwarding traffic to and from the workload. In addition, it is possible to restrict the set of services that the proxy can reach when forwarding outbound traffic from workload instances.Without any use of this custom resource, Pilot automatically sends the same configuration to the proxies, that contains information about every workload instance in the mesh. The Sidecar resource can be used to fine-tune the Envoy config for a set of workloads. This seems like a very advanced use-case, but - although it isn't highlighted - the last sentence of the definition makes a huge difference. It is about restricting the sidecar to reach services other than the ones configured here. This feature is quite easy to configure, and has two large benefits:
Cloud Provider | Distribution | Master node | Worker nodes |
---|---|---|---|
Amazon | PKE - single master | 1 x c5.xlarge | 10 x c5.xlarge (spot) |
The demoapp is a sample microservice application that's part of Backyards. It consists of 7 different microservices, and can be used to easily test and benchmark Istio features.Using the CLI, installing this app is as easy as running this command for every different namespace:
backyards demoapp --demo-namespace backyards-demo-N install
Using horizontal pod autoscalers, each demoapp was configured to have at most 15 pods, so in total there were 70 different services and 150 pods in the benchmark cluster.
Because each demoapp communicates only internally within the namespace (and to istio-telemetry), it means that using namespace isolation with Sidecar custom resources, the configuration that's sent to each Istio proxy contains only ~10% of the original configuration entries. It could be made even smaller by isolating workloads with only their specific service targets, but we felt that namespace isolation would be enough for the benchmark.
First, we've measured the idle resource consumption of the sidecars with and without isolation, then did a load test to see how things change.
The load was generated using Bombardier, a simple HTTP benchmarking tool, written in Go. It was started in a pod in the backyards-system namespace. During a 30 minutes load test, the cluster was handling around 2,5K requests per second.
Prometheus and Grafana dashboards were configured through Pipeline's integrated monitoring feature, that made the setup a "few-clicks process". If you are interested to read more about Pipeline's integrated cluster services, follow this link.
Avg. mem. usage of sidecars (total) | Avg. mem. usage / sidecar | |
---|---|---|
150 pods, no load, no isolation | 8.51GB | 54.6MB |
150 pods, no load, w/ isolation | 5.22GB | 34.7MB |
150 pods, w/ load, no isolation | 10.38GB | 61.0MB |
150 pods, w/ load, w/ isolation | 7.09GB | 42.1MB |
kind: Sidecar
metadata:
name: default
namespace: backyards-demo
spec:
egress:
- hosts:
- ./*
- istio-system/*
There's no workload label selector in this config, so it will be applied to all proxies in the namespace. The hosts section restricts outbound traffic to all services in the current and istio-system namespaces.
To configure sidecars only for specific workloads, we must add a workload selector:
kind: Sidecar
metadata:
name: default
namespace: backyards-demo
spec:
workloadSelector:
labels:
app: payments
version: v1
egress:
- hosts:
- ./notifications.backyards-demo.svc.cluster.local
- istio-system/*
If a namespace and a workload level Sidecar resource is also present, preference will be given to the resource with a workload selector. We've also changed the hosts section: instead of allowing outbound traffic to every service in the namespace, it allows traffic to the notifications service only.
To learn more about the Sidecar resource, read the reference in the Istio docs.
To see how easy it is to get started with Backyards, check out the docs.These examples work out of the box with the demo application packaged with Backyards (now Cisco Service Mesh Manager). Change the service name and namespace to match your service. To see the currently applied sidecar config for a particular service, use the sidecar-proxy egress get command. First, let's check if there are any egress rules set for the backyards-demo namespace. The command has a workload switch that accepts a workload in namespace/name format. If name is *, namespace level rules are listed.
> backyards sidecar-proxy egress get --workload backyards-demo/*
Sidecar egress rules for backyards-demo/*
Sidecar Hosts Bind Port Capture Mode
backyards-demo/default [./* istio-system/*] -
There is one Sidecar resource, called default and an egress isolation rule already present in the namespace. This is because the default installation of the demoapp already created it to advertise best practices.
Let's check the results for a specific workload (analytics-v1) as well:
> backyards sidecar-proxy egress get --workload backyards-demo/analytics-v1
Sidecar egress rules for backyards-demo/*
Sidecar Hosts Bind Port Capture Mode
backyards-demo/default [./* istio-system/*] -
The result is the same as before. If a namespace and a workload level Sidecar resource is also present, preference will be given to the resource with a workload selector. For now, there's no workload level selector, so Backyards will show the currently applied namespace level resource.
Let's create a new outbound traffic rule with egress set. It will restrict traffic for the analytics-v1 workload to the istio-system namespace only, because this workload doesn't have any other outbound connections.
> backyards sp egress set --workload backyards-demo/analytics-v1 --hosts "istio-system/*"
INFO[0002] sidecar egress for backyards-demo/analytics-v1 set successfully
Sidecar egress rules for backyards-demo/analytics-v1
Sidecar Hosts Bind Port Capture Mode
backyards-demo/backyards-demo-yvsj2 [istio-system/*] -
Now if you check the analytics-v1 workload again, it will show the newly created, workload-level config.
> backyards sidecar-proxy egress get --workload backyards-demo/analytics-v1
Sidecar egress rules for backyards-demo/analytics-v1
Sidecar Hosts Bind Port Capture Mode
backyards-demo/backyards-demo-yvsj2 [istio-system/*] -
To cleanup and delete the egress rules, use these commands:
> backyards sidecar-proxy egress delete backyards-demo/analytics-v1
> backyards sidecar-proxy egress delete backyards-demo/*
Tip: all CLI commands and switches have short names, check the CLI docs to get to know them.
> backyards sidecar-proxy egress recommend --workload backyards-demo/payments-v1
Recommended egress rules for backyards-demo/payments-v1
Hosts Bind Port Capture Mode
[./notifications.backyards-demo.svc.cluster.local istio-system/istio-telemetry.istio-system.svc.cluster.local] -
Adding the --apply switch will automatically apply the recommendations to the selected workload or namespace.
> backyards sidecar-proxy egress recommend --workload backyards-demo/payments-v1 --apply
INFO[0002] sidecar egress for backyards-demo/payments-v1 set successfully
Sidecar egress rules for backyards-demo/payments-v1
Sidecar Hosts Bind Port Capture Mode
backyards-demo/backyards-demo-yvsj2 [./notifications.backyards-demo.svc.cluster.local istio-system/istio-telemetry.istio-system.svc.cluster.local] -
Using */* for the workload switch and --apply will automatically restrict every Envoy proxy's outbound listeners.
The proxy configuration feature will be available in the next Backyards release. We're working hard to push it out until the end of the year. If you can't wait for that, join our backyards channel on the Banzai Cloud community Slack, and ask for a dev release to try it!
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.