/

Ambitwin · source-available, not open source · © 2026 Nicolò Ghignatti

Trust & Service Mesh

Keywords on this page
WordMeaningExample
Service meshA layer that secures traffic between services, outside their codeIstio
mTLSEncryption where both sides prove who they areBetween any two pods
Workload identityThe mesh’s proof of which service is callingchat’s account
ztunnelIstio’s per-node proxy, carries all trafficOne per node
Claims headerWho the person is, set by the edgex-gateway-claims
ForgeSend a made-up header to pose as someoneA fake admin claim

Who is trusted, by whom, and where that stops.


The idea: a hard shell

LayerQuestionWhere
EdgeIs this a real signed-in person?Istio gateway, once
MeshIs every hop encrypted, and from a real workload?ztunnel, PeerAuthentication: STRICT
ServiceMay this person, in this organization, do this?Cedar, inside the service
flowchart LR
    K["Keycloak"] --> G["claims-gateway: makes the internal JWT"]
    G --> B["Browser"]
    B --> E["Edge: checks JWT once"]
    E -- "x-gateway-claims" --> S["Service: reads header, runs Cedar"]
    S -- "same header, mTLS" --> S2["Next service"]

Why once: services hold no signing keys, and no request pays for checking twice.


What this does not stop

A workload already inside the cluster can call a service directly and send a forged header. mTLS proves the connection, not the content.

When this must change

This holds while one cluster serves one customer. With several tenants in one hosted cluster, one broken workload becomes a cross-tenant leak. Then each service needs its own ServiceAccount and an AuthorizationPolicy listing its callers, as agent has.


Open doors

PathWhy openWhat guards it
/gatewayclient has no token before signing inKeycloak
/telemetry/ingest, /collector, /observationsDevices have no personHMAC with the building’s key, in telemetry
/agentThe eval runner has its own tokenThe edge removes any x-gateway-claims, and the policy above
/grafanaIt has its own loginOnly that password
/The app itselfNothing needed

Why /agent strips the header: the door is open, so nobody checked that header. agent would believe a forged one.


Keys

BetweenKeyNote
Keycloak and claims-gatewayOIDCOnly claims-gateway talks to Keycloak
claims-gateway and the edgeRS256, public keys at JWKSOnly claims-gateway signs
Control plane servicesShared HMAC secretOne implementation, in auth-contracts
Devices and telemetryHMAC, derived per buildingRevoke by bumping an epoch. Separate key: this one leaves for customer sites

Why Istio, why ambient

Measured on a single dev node: Redis p50 stays under 5 ms inside the mesh.


Known traps

istiod cannot fetch JWKS from a STRICT pod

istiod is outside the mesh, so ztunnel refuses its plain request. jwksUri goes through the gateway’s own route instead.

Naming a JWT location replaces the defaults

fromHeaders or fromCookies on a jwtRule turns off Authorization: Bearer. List both: browsers use the cookie, others the header.

A wildcard misses the bare path

Istio’s /twin/* does not match /twin, but the route does. Every protected service is listed in both forms.

Keycloak ignores a changed realm file

--import-realm skips a realm that exists. After changing keycloak/realm-export.json, delete the keycloak_postgres_data volume and let it import again.


Local vs cluster

Same gated paths. Local only:

Simulators are never deployed to the cluster. They post to /telemetry/ingest like any device.


Before real production

The manifests give a working cluster. These inputs cannot live in the repository:

NeededToday
HTTPSThe gateway listens on plain :80
KeycloakNot in these manifests
Image access:latest with IfNotPresent. Use fixed tags
Real secretsscripts/k8s/k8s-secrets.sh makes dev ones
Model keyagent starts without OPENROUTER_API_KEY, then fails each request
Strong Grafana passwordIt is the only guard there