Overview
Rancher includes a telemetry system that collects anonymized usage data and cluster statistics. This data helps improve Rancher by providing insights into how it’s used, cluster sizes, and common configurations. The telemetry system is designed with privacy in mind and does not collect sensitive information.Telemetry Architecture
Components
The telemetry system consists of several key components:TelemetryGatherer
Collects telemetry data from Rancher and managed clusters:- Aggregates cluster information
- Collects node statistics
- Gathers feature flag usage
- Tracks Rancher version information
TelemetryExporterManager
Manages telemetry exporters and collection intervals:- Registers telemetry exporters
- Schedules periodic data collection
- Manages exporter lifecycle (start/stop)
- Handles multiple exporters simultaneously
TelemetryExporter
Exports collected telemetry data to destinations:- Collects data using TelemetryGatherer
- Formats data for export
- Stores or transmits telemetry data
- Handles errors and retries
Telemetry Namespace
Telemetry components run in a dedicated namespace:- Namespace: cattle-telemetry-system (source:pkg/telemetry/consts/consts.go:4)
- Isolated from application workloads
- Contains telemetry secrets and configuration
Data Collection
What Data is Collected
The telemetry system collects the following types of information:Rancher Version Information
Cluster Management Data
Cluster Statistics
Node Information
System Information
Compute Resources
Node Roles
Nodes are categorized by role:Data Collection Implementation
The telemetry gatherer collects data from:- Cluster Cache: Retrieves cluster information (source:pkg/telemetry/telemetry.go:282-283)
- Node Cache: Collects node statistics (source:pkg/telemetry/telemetry.go:296-298)
- Local Cluster: Identifies and processes local cluster separately (source:pkg/telemetry/telemetry.go:299-302)
- Managed Clusters: Aggregates data from downstream clusters (source:pkg/telemetry/telemetry.go:304-312)
Telemetry Export
Export Manager
The telemetry export manager handles periodic data collection:Exporter Registration
Register exporters with retry intervals:- Unique exporter IDs
- Configurable retry intervals
- Duplicate registration prevention
Exporter Lifecycle
Starting Exporters
- Sets initialization information (UUIDs, versions)
- Starts background collection tasks
- Schedules periodic exports
Stopping Exporters
Exporter Status
Check exporter status:Secret-Based Export
Secret Exporter
The secret exporter stores telemetry data in Kubernetes secrets:Secret Structure
Telemetry data is stored in a secret:Secret Updates
The exporter creates or updates the secret:- Collects telemetry data
- Generates payload (JSON format)
- Encodes as base64
- Creates secret if it doesn’t exist
- Updates existing secret with new data
- Handles conflicts with retry logic
Telemetry API
Gathering Telemetry
Collect telemetry data programmatically:- Rancher version information
- Cluster counts and statistics
- Node information per cluster
- Compute resource totals
Initialization
Initialize telemetry gatherer:- Cluster cache for cluster information
- Node cache for node statistics
Setting Initialization Info
Provide Rancher instance information:- Cluster UUID
- Server URL
- Installation UUID
- Rancher version
- Git hash
Resource Computation
CPU Cores Calculation
- Handles fractional CPUs (e.g., 500m = 0.5 cores)
- Returns integer core count
- Reports errors for invalid formats
- ErrNoCPUReported: No CPU information available (source:pkg/telemetry/telemetry.go:33)
- ErrCpuCoresFormat: Invalid CPU format (source:pkg/telemetry/telemetry.go:34)
Memory Calculation
- Handles various units (Ki, Mi, Gi, etc.)
- Returns total bytes
- Reports errors for invalid formats
- ErrNoMemReported: No memory information available (source:pkg/telemetry/telemetry.go:35)
- ErrMemBytesFormat: Invalid memory format (source:pkg/telemetry/telemetry.go:36)
Privacy Considerations
Data Anonymization
The telemetry system is designed to protect privacy:- No Personal Information: Does not collect user names, passwords, or personal data
- Anonymized IDs: Uses UUIDs instead of identifiable information
- Aggregate Statistics: Collects counts and totals, not individual resources
- No Application Data: Does not collect workload configurations or application secrets
- Optional Collection: Telemetry can be disabled if needed
What is NOT Collected
- User credentials or tokens
- Application configurations
- Kubernetes secrets or ConfigMaps
- API payloads or request data
- Log contents
- Workload names or labels
- Custom resource definitions
- Network configurations
Data Usage
Collected telemetry data is used for:- Understanding feature adoption
- Identifying common cluster configurations
- Prioritizing bug fixes and improvements
- Planning capacity and scaling features
- Improving documentation and user experience
Feature Flags and Telemetry
Feature Flag Collection
Telemetry includes enabled feature flags:- Which features are commonly enabled
- Feature adoption rates
- Compatibility requirements
- Feature flag effectiveness
SCC Registration
Rancher includes Support Customer Center (SCC) integration:SCC Payload Generation
- Cluster information
- Node statistics
- Version information
- Usage metrics
Secret Annotations
SCC-related secrets are annotated:Troubleshooting
Verifying Telemetry Collection
Check telemetry system status:Common Issues
Telemetry Not Collecting
- Verify telemetry components are running
- Check exporter registration and status
- Review telemetry manager logs
- Ensure cluster and node caches are populated
Missing Data
- Verify cluster cache contains all clusters
- Check node cache for node information
- Ensure initialization info is set
- Review error logs for collection failures
Secret Update Failures
- Check RBAC permissions for secret access
- Verify namespace exists
- Review controller logs for errors
- Check for resource conflicts
Debug Commands
Disabling Telemetry
While not explicitly shown in the code analyzed, telemetry can typically be disabled through:- Environment variables on Rancher server
- Configuration settings in Rancher UI
- Helm chart values during installation
- Feature flags (if applicable)
Best Practices
For Rancher Administrators
- Understand what data is being collected
- Review privacy policies and compliance requirements
- Configure telemetry according to organizational policies
- Monitor telemetry system resource usage
- Keep telemetry components updated
For Development and Testing
- Use telemetry data to understand usage patterns
- Test feature flags with telemetry collection
- Verify telemetry doesn’t impact performance
- Ensure telemetry works in air-gapped environments (if applicable)
Next Steps
- Review Monitoring for operational metrics
- Understand feature flag system in Rancher
- Configure cluster and node information collection
- Set up SCC registration for support (Rancher Prime)