For MeshIdentity to work, meshServices.mode: Exclusive must be set on the Mesh resource. This value is already configured in the demo Mesh.
The roles are divided as follows:
-
MeshIdentity declares which identity provider the data planes should use and how.
- Spire issues the identity and manages the trust.
This is why you create a MeshIdentity to configure the data planes and specify that Spire manages the identity.
To issue identities in a mesh using Spire, create this resource:
echo "apiVersion: kuma.io/v1alpha1
kind: MeshIdentity
metadata:
name: identity-spire
namespace: kong-mesh-system
labels:
kuma.io/mesh: default
kuma.io/origin: zone
spec:
selector:
dataplane:
matchLabels: {}
spiffeID:
trustDomain: default.default.mesh.local
path: '/ns/{{ .Namespace }}/sa/{{ .ServiceAccount }}'
provider:
type: Spire
spire: {}" | kubectl apply -f -
MeshIdentity uses selector to choose the data planes that receive identities. In this example, the selector issues identity to all data planes in the mesh.
spiffeID defines templates for workload SPIFFE IDs. The trust domain must match the trust domain you configured in Spire (default.default.mesh.local). The path template combines the namespace and service account. Example SPIFFE ID: spiffe://default.default.mesh.local/ns/kong-mesh-demo/sa/default.
The provider field contains identity provider-specific configuration. This guide uses the Spire provider.