Why Use Istio with Pulsar
Deploying Pulsar with Istio provides:- Enhanced Security: Automatic mTLS encryption for service-to-service communication
- Traffic Management: Advanced routing, load balancing, and traffic control
- Observability: Built-in metrics, logging, and distributed tracing
- External Access: Unified ingress gateway for all protocols (Pulsar, Kafka, MQTT, AMQP)
- Policy Enforcement: Fine-grained authorization policies
Prerequisites
Istio Requirements
-
Istio Installation: Istio installed in your Kubernetes cluster
- Tested with Istio 1.24.2 and earlier versions
- Use the default revision or adjust according to your Istio setup
- Default trust domain is
cluster.local, adjust if needed
-
Istio Ingress Gateway: Must be installed and configured
- Service type must be
LoadBalancer - Required port mappings:
443->8443: HTTP/HTTPS6651->6651: Pulsar with TLS9093->9093: Kafka with TLS5671->5671: AMQP with TLS8883->8883: MQTT with TLS
- Service type must be
TLS Certificate
- A TLS certificate secret exists in the Istio Ingress Gateway namespace
- Covers your endpoint domain (e.g.,
pulsar.example.com) - Covers per-broker domains (e.g.,
pb0-pulsar.example.com,pb1-pulsar.example.com, etc.) - Alternative: A wildcard certificate is used (e.g.,
*.example.com)
DNS Configuration
- DNS records point to the Ingress Gateway LoadBalancer IP
- Main endpoint:
pulsar.example.com - Per-broker endpoints:
pb0-pulsar.example.com,pb1-pulsar.example.com, up topb${replicas-1}-pulsar.example.com - Alternative: Wildcard DNS
*.example.comis configured
If the StreamNative Operator is not Istio sidecar injected, configure the
cloud.streamnative.io/ignore-leader-check: "true" annotation on the ZooKeeperCluster resource.Deploy Pulsar Cluster
For a complete working example, see the Pulsar with Istio example in the StreamNative Private Cloud repository.Istio-Specific Configuration
Add the following Istio configurations to your Pulsar components:PulsarCoordinator
Configure the Istio revision and trust domain for the cluster:ZooKeeperCluster
Enable Istio with mTLS:If the StreamNative Operator is not Istio sidecar injected, add this annotation:
BookKeeperCluster
Enable Istio with mTLS:PulsarBroker
Enable Istio with mTLS and Gateway configuration for external access:spec.istio.enabled: Enables Istio integrationspec.istio.mtls.mode: mTLS mode (strict,permissive, ornone)spec.istio.revision: Istio revision to usespec.istio.gateway.selector: Label selector for the Istio Ingress Gatewayspec.istio.gateway.tls.certSecretName: Name of the TLS certificate secretspec.istio.gateway.tls.mode: TLS mode (simplefor standard TLS)spec.config.advertisedDomain: Domain for external accessspec.config.serviceURLGenerationPolicy: Set toOrdinalPrefixfor per-broker routing
Verify Deployment
Check Pod Status
Verify that all pods are running with Istio sidecars (2/2 containers):Get Service Endpoints
Get the service endpoints from the PulsarBroker status:- Admin:
http://private-cloud-broker.pulsar.svc.cluster.local:8080 - Pulsar:
pulsar://private-cloud-broker.pulsar.svc.cluster.local:6650
- Admin:
https://pulsar.example.com - Pulsar TLS:
pulsar+ssl://pulsar.example.com:6651
Test Connectivity
Test Within Kubernetes Cluster
Test Pulsar using the toolset created by the StreamNative Operator or any Istio-injected pod:Test Outside Kubernetes Cluster
Test Pulsar using TLS from outside the cluster:Enable Protocol Handlers
After deploying the base Pulsar cluster with Istio, you can enable additional protocol handlers:- Configure Kafka Protocol - Enable Kafka protocol support
- Configure MQTT Protocol - Enable MQTT protocol support
- Configure AMQP Protocol - Enable AMQP 0-9-1 protocol support