Overview
MeshSync acts as a bridge between your Kubernetes clusters and Meshery, providing:- Real-time Discovery: Watches Kubernetes resources for ADDED, MODIFIED, and DELETED events
- Selective Monitoring: Configurable whitelist/blacklist for resource types
- Event Publishing: Publishes cluster state changes to NATS broker
- Multi-cluster Support: Independent MeshSync instance per cluster
- Low Overhead: Efficient resource watching with minimal cluster impact
Architecture
Deployment
MeshSync is deployed by the Meshery Operator based on theMeshSync CRD:
Watch List Configuration
The watch-list ConfigMap defines which resources MeshSync monitors:Whitelist
Resources to actively watch:Blacklist
Resources to explicitly ignore:Resource Format
Resource identifiers follow the pattern:- Core resources:
pods.v1.,services.v1.,namespaces.v1. - Apps:
deployments.v1.apps,statefulsets.v1.apps - Networking:
ingresses.v1.networking.k8s.io - Custom:
virtualservices.v1beta1.networking.istio.io
Default Watch List
The default configuration watches:| Resource Type | API Group | Events |
|---|---|---|
| Namespaces | v1 | ADDED, MODIFIED, DELETED |
| Pods | v1 | ADDED, MODIFIED, DELETED |
| Services | v1 | ADDED, MODIFIED, DELETED |
| Deployments | apps/v1 | ADDED, MODIFIED, DELETED |
| StatefulSets | apps/v1 | ADDED, MODIFIED, DELETED |
| DaemonSets | apps/v1 | ADDED, MODIFIED, DELETED |
| ReplicaSets | apps/v1 | ADDED, MODIFIED, DELETED |
| ConfigMaps | v1 | ADDED, MODIFIED, DELETED |
| Secrets | v1 | ADDED, MODIFIED, DELETED |
| Ingresses | networking.k8s.io/v1 | ADDED, MODIFIED, DELETED |
| Endpoints | v1 | ADDED, MODIFIED, DELETED |
| PersistentVolumes | v1 | ADDED, MODIFIED, DELETED |
| PersistentVolumeClaims | v1 | ADDED, MODIFIED, DELETED |
| StorageClasses | storage.k8s.io/v1 | ADDED, MODIFIED, DELETED |
| Nodes | v1 | ADDED, MODIFIED, DELETED |
Event Structure
Events published to NATS follow this structure:Customizing Watch List
Via Helm Values
Via kubectl
Update the MeshSync CR:Adding Custom Resources
To watch custom CRDs:Broker Configuration
Native Broker
Use Broker CR in the same cluster:Custom/External Broker
Connect to external NATS server:Monitoring
Check MeshSync Status
Status Conditions
Metrics
MeshSync exposes Prometheus metrics:Troubleshooting
MeshSync Not Publishing Events
Missing Resource Events
High Memory Usage
Reduce watched resources:Connection Failures
Best Practices
-
Resource Selection:
- Only watch resources relevant to your use case
- Exclude high-churn resources (events, leases)
- Use blacklist for fine-grained control
-
Event Types:
- Watch ADDED and DELETED for inventory tracking
- Include MODIFIED only when state changes matter
- Exclude MODIFIED for static resources
-
Performance:
- Limit watched namespaces if possible
- Use label selectors in future versions
- Monitor resource consumption
-
Security:
- Grant minimal RBAC permissions
- Avoid watching sensitive secrets
- Use network policies to restrict broker access
Advanced Configuration
Multi-Cluster Setup
Deploy one MeshSync per cluster:Custom Deployment
Deploy MeshSync without operator:Next Steps
Meshery Broker
Learn about NATS event streaming
Operator Overview
Back to operator documentation