Skip to main content
This guide explains how to configure per-pod networking for PulsarBroker using networking.podService and advertisedListeners.

Overview

Two features work together to enable per-pod access:
FeaturePurpose
networking.podServiceCreates a dedicated Kubernetes Service for each broker pod
advertisedListenersConfigures brokers to advertise custom addresses to clients
Use cases:
  • Istio Federation / Multi-cluster communication
  • Direct pod access scenarios

Configuration

Example

apiVersion: pulsar.streamnative.io/v1alpha1
kind: PulsarBroker
metadata:
  name: pulsar
  namespace: pulsar
spec:
  # Enable per-pod services
  networking:
    podService:
      enabled: true
      type: ClusterIP
      annotations:
        example.com/pod-service: "true"

  # Use per-pod service DNS as advertised listener
  # Note: Use non-default port (6660) to avoid conflict with brokerServicePort (6650)
  advertisedListeners:
    - name: pod
      hostTemplate: "$(POD_NAME).pulsar.svc.cluster.local"
      protocols:
        pulsar:
          containerPort: 6660
          advertisedPort: 6660

Configuration Reference

networking.podService

FieldTypeDefaultDescription
enabledboolfalseEnable per-pod Service creation
typestringClusterIPService type: ClusterIP, LoadBalancer, or NodePort
annotationsmap{}Annotations to add to each pod Service

advertisedListeners

FieldTypeDescription
namestringUnique identifier for this listener
hostTemplatestringHostname template, supports $(POD_NAME) and $(POD_ID)
protocols.pulsar.containerPortintPort the broker container listens on
protocols.pulsar.advertisedPortintPort advertised to clients
Use a non-default port (e.g., 6660) to avoid conflict with the default brokerServicePort (6650).

Verify Configuration

Check Created Services

kubectl get svc -n pulsar | grep broker
Expected output:
pulsar-broker            ClusterIP   10.0.0.1   <none>   6650/TCP,8080/TCP
pulsar-broker-0          ClusterIP   10.0.0.2   <none>   6650/TCP,6660/TCP,8080/TCP
pulsar-broker-1          ClusterIP   10.0.0.3   <none>   6650/TCP,6660/TCP,8080/TCP

Verify Service Selector

kubectl get svc pulsar-broker-0 -n pulsar -o jsonpath='{.spec.selector}'
Expected: {"statefulset.kubernetes.io/pod-name":"pulsar-broker-0"}

Test Connectivity

kubectl run test-client --image=curlimages/curl:latest --rm -it --restart=Never -n pulsar -- \
  curl -s http://pulsar-broker-0:8080/admin/v2/brokers/healthcheck