Overview
The Meshery Broker serves as a message bus for:- Event Distribution: Publishing cluster resource changes from MeshSync
- Real-time Updates: Delivering events to Meshery Server for processing
- Decoupling: Enabling independent operation of MeshSync and Meshery Server
- Scalability: Supporting multiple subscribers and publishers
- Reliability: Ensuring message delivery with NATS guarantees
Architecture
Deployment
The Broker is deployed by the Meshery Operator based on theBroker CRD:
Generated Resources
The operator creates:- Deployment: NATS server pod(s)
- Service: LoadBalancer exposing port 4222
- ConfigMap: NATS server configuration (optional)
Service Configuration
The Broker service is exposed via LoadBalancer:Service Types
LoadBalancer (default):- Provides external IP for out-of-cluster Meshery Server
- Required when Meshery Server runs outside Kubernetes
- Automatically provisioned by cloud providers (AWS ELB, GCP LB, etc.)
- Internal-only access
- Use when Meshery Server runs in same cluster
- More secure, no external exposure
- Exposes on node IP at static port
- Use when LoadBalancer unavailable (on-premises, minikube)
- Access via
<NodeIP>:<NodePort>
NATS Topics
Meshery uses predefined NATS topics for communication:meshery.meshsync.request
Purpose: Cluster state synchronization Publishers:- MeshSync instances (one per cluster)
- Meshery Server
meshery.broker
Purpose: General broker events and control messages Publishers:- Meshery Server
- Adapters
- MeshSync
- Adapters
- Adapter registration
- Health checks
- Control commands
Connection Examples
From MeshSync (In-cluster)
From Meshery Server (External)
With Authentication (Future)
Monitoring
Check Broker Status
Get External Endpoint
NATS Monitoring
NATS provides monitoring endpoints:varz: General server informationconnz: Connection detailssubsz: Subscription informationroutez: Route information (clustering)
Troubleshooting
Broker Not Starting
No External IP Assigned
For LoadBalancer services:- LoadBalancer automatically maps to localhost
- Use MetalLB or change to NodePort:
Connection Failures
Message Not Delivered
High Availability
Clustered NATS (Future)
For production deployments, configure NATS clustering:JetStream (Future)
Enable persistent message queuing:Security
Authentication
Configure NATS authentication:TLS Encryption
Enable TLS for broker connections:Network Policies
Restrict broker access:Performance Tuning
Resource Limits
NATS Configuration
Custom NATS server config:Best Practices
-
Deployment:
- Use LoadBalancer for external Meshery Server
- Use ClusterIP when Meshery runs in-cluster
- Enable monitoring endpoints
-
Security:
- Enable authentication in production
- Use TLS for external connections
- Apply network policies
-
Reliability:
- Deploy multiple replicas for HA
- Configure resource limits
- Monitor connection and subscription metrics
-
Performance:
- Tune max_payload for large cluster events
- Adjust max_connections based on cluster count
- Use JetStream for guaranteed delivery
Next Steps
MeshSync
Configure cluster discovery
Operator Overview
Back to operator documentation