Service mesh

What OpenShift Service Mesh adds beyond tracing: mTLS between pods, a few traffic rules, and the Kiali view of who calls whom.

Updated CompTech Team

A service mesh is a proxy next to each pod, plus a control plane that configures the proxies. On OpenShift that product is OpenShift Service Mesh, built on Istio. The proxy sees every HTTP call the pod makes inside the mesh. From that it can encrypt the call, retry it, record a span, and draw a map. It cannot see a call the application makes to a database by a protocol it does not parse, and it cannot fix a handler that is wrong.

Tracing without a mesh is OpenTelemetry. You do not have to pick only one. The mesh is the right tool for uniform mTLS and for a service that you cannot rebuild. The SDK is the right tool for a span around a block of code. Running both without a plan produces two traces for one request. Pick the mesh as the trace source for ingress, or the SDK, and propagate traceparent so they join.

What you install

An administrator installs the Service Mesh operator and creates the control plane in istio-system. Service Mesh 3 follows upstream Istio more closely than Service Mesh 2 did. The objects you will edit, PeerAuthentication and VirtualService, are Istio APIs and are the same idea on both lines. Membership differs: Service Mesh 2 uses a member roll or the istio-injection=enabled label, Service Mesh 3 uses the Sail operator's Istio resource and a namespace label the version's docs name. Follow the matrix for the OpenShift version, then confirm a proxy is actually on the pod:

oc get pods -n payments -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].name}{"\n"}{end}'

A meshed pod has a container beside the application, typically istio-proxy. A pod without it is not in the mesh, whatever the namespace label says. Restart the Deployment after labelling. Existing pods do not gain a proxy in place.

The control plane is a cluster-wide privilege. Treat istio-system like an operator namespace: few people, no application Deployments, backups of the custom resources in Git.

mTLS

Inside the mesh, turn mutual TLS on for the namespace so pod-to-pod traffic is authenticated as a workload identity, not merely as "something on the network".

apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
  name: default
  namespace: payments
spec:
  mtls:
    mode: STRICT

STRICT refuses plain traffic. Apply it after every client of these pods is meshed, including the smoke-test runner and the ingress gateway. A health check from a kubelet is not a meshed client. Probes that fail after you flip STRICT are probes that bypassed the proxy. The usual fix is to let probes hit the application port directly, which Istio's annotation sidecar.istio.io/rewriteAppHTTPProbers does on current versions, or to exclude the probe path. Read the pod events before you flip the namespace back to PERMISSIVE and forget it. PERMISSIVE accepts both and is a migration mode, not the steady state.

mTLS does not replace a NetworkPolicy. A proxy that is allowed to talk to every other proxy will do so. The security overview keeps the allow-list. The mesh adds identity on the flows you allowed.

A mesh certificate is not the Data Grid TLS certificate and not the Route certificate. Three layers, three purposes: the Route terminates the user, the mesh authenticates the pod, the data service authenticates the query. Turning one of them off because "we have the mesh" leaves a path the mesh does not cover. Redis on 6379 is one such path unless you have a policy and the TLS from the Redis security lab.

A retry, and when not to

apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: catalog
  namespace: payments
spec:
  hosts:
    - catalog
  http:
    - route:
        - destination:
            host: catalog
      retries:
        attempts: 2
        perTryTimeout: 2s
      timeout: 5s

Two retries on a GET to Catalog are reasonable. The same retries on a POST that creates an order will create three orders unless the handler is idempotent. The assert for that is in Application testing. Set the retry on the safe methods. Leave POST alone until the handler uses an idempotency key.

timeout on the mesh and a timeout in the HTTP client are both real. The shorter one wins, and a mesh timeout with no error handling in the application looks like a hung thread that suddenly fails. Set them on purpose and log which one fired.

The gateway

User traffic should enter through the mesh ingress gateway, not through a Route aimed at a pod that sometimes has a proxy and sometimes does not. The gateway is the place for the certificate the browser sees and for the timeout on the whole call. Routes behind it stay cluster-internal. Two doors, the Route and the gateway both published, will drift, and only one of them will have the policy you just wrote.

Confirm the path with one header:

curl -sSI https://orders.apps.example.com/health/ready | awk 'tolower($0) ~ /server:|x-envoy/'

An x-envoy header, or the access log on the gateway, means the request entered the mesh. A 200 with neither means the Route bypasses it, and STRICT mTLS is not on the path you think it is.

The map, and traces

Kiali, installed with the mesh, draws the graph of calls the proxies saw. Use it to answer "who calls this?" before you delete a Service. A service with no incoming edges is either unused or not meshed. Those are different findings.

The proxies emit spans. Send them to the same collector as the OpenTelemetry lab, so Grafana shows one tree. A mesh span named for the Service and an application span named for the route should share a trace id. If they do not, propagation between the proxy and the application is off. That setting is in the mesh's tracing extension, and it has to use W3C tracecontext if that is what the SDK uses.

A mesh does not metric your SQL. Keep the Data Grid and Redis exporters. The mesh graph will show Orders calling Data Grid only when that call goes through the proxy on a port Istio is configured to treat as HTTP or as a raw TCP connection. TCP edges have no status code. Do not expect a 500 on a Hot Rod connection in Kiali.

Two sites

A mesh per cluster, with a shared trust domain, is what lets a failover target present the same identity story. The OpenShift AI DC/DR labs include a multi-cluster mesh note. Do not stretch one control plane across a WAN and call it resilience. Each site should keep serving if the other site's control plane is gone.

What's next

This is the last observability lab. The set is Tracing, OpenTelemetry, and this page. Who is allowed to change a PeerAuthentication is a question for Security. A retry that doubled a write is a failed test, not a mesh mystery.