By default, the network is insecure and not encrypted. We can change this with Kong Mesh by enabling
the Mutual TLS policy to provision a Certificate Authority (CA) that
will automatically assign TLS certificates to our services (more specifically to the injected data plane proxies running
alongside the services).
We can enable Mutual TLS with a builtin
CA backend by executing:
echo "apiVersion: kuma.io/v1alpha1
kind: Mesh
metadata:
name: default
spec:
meshServices:
mode: Exclusive
mtls:
enabledBackend: ca-1
backends:
- name: ca-1
type: builtin" | kubectl apply -f -
The traffic is now encrypted and secure. Kong Mesh does not define default traffic permissions, which
means that no traffic will flow with mTLS enabled until we define a proper MeshTrafficPermission
policy.
For now, the demo application won’t work.
You can verify this by clicking the increment button again and seeing the error message in the browser.
We can allow the traffic from the demo-app
to redis
by applying the following MeshTrafficPermission
:
echo "apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
namespace: kuma-demo
name: redis
spec:
targetRef:
kind: Dataplane
labels:
app: redis
from:
- targetRef:
kind: MeshSubset
tags:
kuma.io/service: demo-app_kuma-demo_svc_5000
default:
action: Allow" | kubectl apply -f -
You can click the increment button, the application should function once again.
However, the traffic to redis
from any other service than demo-app
is not allowed.