Advanced Scenarios
This guide covers advanced Mermin deployment scenarios including custom CNI configurations, multi-cluster deployments, high-availability setups, and performance tuning for high-throughput environments.
Custom CNI Configurations
Different Container Network Interfaces (CNIs) create different network interface patterns. Mermin must be configured to monitor the correct interfaces.
Cilium
Cilium uses cilium_* interfaces for pod networking:
discovery "instrument" {
# Capture both physical and Cilium interfaces
interfaces = ["eth*", "ens*", "cilium_*"]
}Considerations:
Cilium's eBPF datapath is separate from Mermin's monitoring
Monitor physical interfaces for inter-node traffic
Monitor
cilium_*for intra-node pod-to-pod trafficMay see duplicate flows for traffic that crosses nodes
Cilium-specific configuration:
discovery "instrument" {
# Physical interfaces for inter-node traffic
interfaces = ["eth*", "ens*"]
# Add Cilium interfaces only if you need intra-node visibility
# interfaces = ["eth*", "ens*", "cilium_*"]
}
# Cilium uses its own NetworkPolicies
discovery "informer" "k8s" {
selectors = [
{ kind = "CiliumNetworkPolicy" },
{ kind = "Pod" },
{ kind = "Service" },
# ... other resources
]
}Calico
Calico uses cali* interfaces for pod networking:
Considerations:
Calico interfaces are
califxxxxxxxxformatMonitor physical interfaces for most traffic
Add
cali*for intra-node pod-to-pod visibilityBe aware of potential flow duplication
Flannel
Flannel uses CNI bridge interfaces:
Weave Net
Weave Net uses weave interface:
Canal (Flannel + Calico)
Canal combines Flannel for networking and Calico for policies:
Multi-Cluster Deployments
For observability across multiple Kubernetes clusters:
Strategy 1: Cluster-Specific OTLP Endpoints
Deploy Mermin in each cluster with cluster-specific configuration:
Cluster 1 (us-west):
Cluster 2 (eu-west):
Strategy 2: Central OTLP Collector
All clusters send to a central collector:
Strategy 3: Hierarchical Collectors
Regional collectors aggregate to central collector:
Each cluster points to its regional collector, which aggregates and forwards to central.
High-Availability Configurations
OTLP Collector Redundancy
Configure multiple OTLP endpoints for failover:
For true HA, deploy multiple OpenTelemetry Collectors behind a load balancer:
Mermin Agent Resilience
Mermin agents are resilient by design:
DaemonSet: Automatically restarts failed pods
Node-local: Failure of one agent doesn't affect others
Stateless: No data loss on restart (flows are regenerated)
Queue-based: Buffers flows during temporary collector outages
Configure aggressive restart policy:
Resource Tuning for High-Throughput Environments
High-Traffic Configuration
For environments with very high network traffic (> 10,000 flows/second), such as public ingress nodes or edge deployments:
Resource allocation:
Low-Latency Configuration
For environments requiring low export latency:
Memory-Constrained Environments
For nodes with limited memory:
Resource limits:
Network Interface Selection Strategies
Inter-Node Traffic Only (Default)
Capture only traffic crossing node boundaries:
Advantages:
No flow duplication
Lower resource usage
Clearer network topology
Limitations:
Misses pod-to-pod traffic on same node
Misses loopback traffic
Complete Visibility (All Traffic)
Capture all traffic including intra-node:
Advantages:
Complete network visibility
Captures all pod-to-pod traffic
Limitations:
Flow duplication for inter-node traffic
Higher resource usage
Requires deduplication in backend
Selective Monitoring
Monitor specific interface patterns:
Dynamic Interface Discovery
Use glob patterns that adapt to host configuration:
Performance Monitoring and Tuning
Metrics to Monitor
Expose Mermin metrics to Prometheus:
See Application Metrics for complete metrics documentation and Prometheus query examples.
Key metrics to monitor:
mermin_flow_spans_created_total- Total flow spans createdmermin_packets_total- Total packets processedmermin_flow_events_total{status="dropped_backpressure"}- Events dropped due to overloadmermin_export_flow_spans_total{exporter_type="otlp",status="error"}- OTLP export failuresmermin_flow_spans_active_total- Current number of active flows
Tuning Guidelines
If you see packet drops:
Increase
pipeline.base_capacityIncrease
pipeline.worker_countAdd more CPU resources
Reduce monitored interfaces
If you see high memory usage:
Decrease flow timeouts
Increase export frequency
Add flow filters to reduce processed flows
Add more memory resources
If you see export errors:
Check collector connectivity
Increase
max_queue_sizeIncrease
max_export_timeoutCheck collector capacity
Security Hardening
Network Policies
Restrict Mermin's network access:
Pod Security Standards
Apply Pod Security Standards:
Note: Mermin requires privileged policy due to eBPF requirements.
Secrets Management
Use Kubernetes secrets for sensitive configuration:
Mount secrets in pods:
Reference in HCL:
Next Steps
Configuration Reference: Deep dive into all configuration options
Filtering: Configure flow filters for security and performance
Observability Backends: Send Flow Traces to your observability backend
Troubleshooting Performance: Diagnose and resolve performance issues
Last updated