liveBook · Manning

Sidecar process

As explained in Google Anthos in Action

A sidecar is a container deployed alongside a main container in the same Pod to provide supporting functionality such as proxying.

A sidecar is a container that runs alongside a main container in the same Kubernetes Pod. It adds supporting functionality without requiring changes to the main application. Common uses include logging, monitoring, backups, and service-mesh proxying. section 3.2.6

In a service mesh, a sidecar proxy handles a microservice’s inbound and outbound traffic separately from its application logic. Because traffic passes through the proxy, it can provide metrics and logs to a central control plane. Istio uses Envoy sidecars; istiod supplies their configuration and supports certificate management for secure service-to-service communication. section 4.2 section 4.3.1

Enable automatic injection for a namespace

For an Anthos Service Mesh managed release, run `kubectl label namespace NAMESPACE istio.io/rev=asm-managed --overwrite`, replacing `NAMESPACE` with the application namespace. Injection occurs when Pods are created, so restart existing Deployments with `kubectl rollout restart deployment -n YOUR_NAMESPACE`. Then run `kubectl get pod -n YOUR_NAMESPACE`; a workload showing `2/2` in READY has its main container and sidecar running. Manual injection by editing Pod manifests is another option. Check the injector configuration: the described default webhook configuration uses the `istio-injection=enabled` namespace label. section 4.5.1

Use a shared Pod when the supporting container should follow the main workload’s lifecycle. Pod-level actions affect both containers: scaling a Pod that contains a web server and database scales both. Put components needing independent scaling in separate Pods. A proxyless service-mesh approach is also available where an application can send telemetry directly to the control plane. section 3.2.6 section 4.2

How Google Anthos in Action covers it

How deep it goes
Defines the pattern, explains proxy responsibilities, and gives injection and verification steps; does not show a complete sidecar manifest.
Examples
Uses logging and backup sidecars, a web-server/database scaling contrast, and namespace-labeling and Pod-readiness commands.
What it assumes
Assumes working familiarity with Kubernetes Pods, namespaces, and Deployments while defining what a sidecar does.
What you can do after
Operate/configure it by enabling Anthos Service Mesh injection, restarting workloads, and checking that Pods contain both containers.
How it connects
Connects Kubernetes Pods and scaling with service meshes, Envoy, traffic management, telemetry, and certificate management.

Also explained in

Compare how 11 books explain sidecar process →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.