related-skills: cncf-aws-cloudwatch, cncf-aws-dynamodb, cncf-aws-ecr, cncf-aws-rds
Thanos in Cloud-Native Engineering
Category: Observability
Status: Active
Stars: 9,500
Last Updated: 2026-04-22
Primary Language: Go
Documentation: High availability Prometheus solution with long-term storage
Purpose and Use Cases
Thanos is a core component of the cloud-native ecosystem, serving as long-term storage
What Problem Does It Solve?
Thanos addresses the challenge of Prometheus scalability and long-term storage. It provides global query view, long-term storage, and cross-cluster observability.
When to Use This Project
Use Thanos when need Prometheus HA, require long-term metrics, or manage multiple Prometheus instances. Not ideal for simple deployments or when large-scale Prometheus deployments, multi-cluster monitoring, or metrics retention needs.
Key Use Cases
- Global Query View for Prometheus
- Long-Term Metrics Storage
- Multi-Cluster Monitoring
- Prometheus High Availability
- Cost-Effective Metrics Storage
Architecture Design Patterns
Core Components
- Query: Global query endpoint
- Store Gateway: Object storage interface
- Ruler: Rule evaluation
- Compactor: Data compaction
- Receive: Receives metrics from Prometheus
Component Interactions
- Query → Store Gateway: Query fetches data from store
- Store Gateway → Object Storage: Store reads from S3/GCS
- Ruler → Store Gateway: Ruler queries for rules
- Compactor → Store Gateway: Compaction operations
Data Flow Patterns
- Metric Ingestion: Prometheus →Receive →Store Gateway →Object Storage
- Query Processing: Query → Store Gateway → Object Storage → Result
- Rule Evaluation: Ruler evaluates → Store Gateway → Alert
- Compaction: Compactor reads → Compacts → Writes back
Design Principles
- Prometheus Compatible: Full Prometheus API compatibility
- Horizontal Scalability: Scale horizontally
- Cost Efficiency: Use cheap object storage
- High Availability: HA for Prometheus metrics
Integration Approaches
Integration with Other CNCF Projects
- Prometheus: Source of metrics
- Kubernetes: Deployment platform
- S3/GCS: Object storage backend
- Grafana: Visualization
API Patterns
- Thanos Query API: Global query endpoint
- Store API: Store Gateway API
- Ruler API: Rule evaluation API
- Receive API: Receive API for Prometheus
Configuration Patterns
- Query Config: Query component config
- Store Config: Store Gateway config
- Ruler Config: Rule evaluation config
- Compactor Config: Compaction config
Extension Mechanisms
- Custom Storage: Add storage backends
- Custom Query Functions: Add query functions
- Custom Rulers: Custom rule evaluation
Common Pitfalls and How to Avoid Them
Misconfigurations
- Object Storage Costs: High storage costs
- How to Avoid: Configure compaction, use appropriate storage class
- Data Ingestion: Data not reaching store
- How to Avoid: Check Prometheus config, verify receive endpoint
Performance Issues
- Store Gateway Memory: High memory usage
- How to Avoid: Configure cache limits, tune store gateway
- Rule Evaluation: Rules not evaluated
- How to Avoid: Check ruler connectivity, verify rule files
Operational Challenges
- Version Compatibility: Version mismatch
- How to Avoid: Use compatible versions, check release notes
- Timestamp Issues: Timestamp synchronization
- How to Avoid: Use NTP, sync clocks across components
Security Pitfalls
Coding Practices
Idiomatic Configuration
- Sidecar Deployment: Deploy sidecar with Prometheus
- Query Optimization: Optimize query patterns
- Rule Management: Manage rules through Ruler
API Usage Patterns
- thanos query: Query API endpoint
- thanos store: Store Gateway CLI
- thanos ruler: Rule evaluation CLI
- kubectl apply: Apply configurations
Observability Best Practices
- Thanos Metrics: Monitor Thanos components
- Query Metrics: Track query performance
- Storage Metrics: Monitor storage usage
Testing Strategies
- Integration Tests: Test query integration
- Performance Tests: Validate query performance
- Failover Tests: Test component failure
Development Workflow
- Local Development: Use docker-compose
- Debug Commands: Check component logs
- Test Environment: Set up test deployment
- CI/CD Integration: Automate testing
- Monitoring Setup: Configure observability
- Documentation: Maintain docs
Fundamentals
Essential Concepts
- Thanos Query: Global query endpoint
- Store Gateway: Object storage interface
- Query Frontend: Query caching layer
- Ruler: Rule evaluation
- Compactor: Data compaction
- Receive: Metrics receiver
- Sidecar: Prometheus sidecar
- Bucket: Object storage bucket
Terminology Glossary
- Store API: Thanos store interface
- Query API: Global query API
- Compaction: Data compaction process
- Sidecar: Prometheus sidecar
- Bucket: Object storage bucket
Data Models and Types
- Block: Time-series data block
- Index: Data index
- Metadata: Block metadata
- Chunk: Compressed data chunks
Lifecycle Management
- Component Startup: Component starts → Connects → Ready
- Data Ingestion: Prometheus → Sidecar → Store → Object Storage
- Query Processing: Request → Query → Store → Result
- Compaction Process: Read blocks → Compact → Write new block
State Management
- Query State: Healthy or degraded
- Store State: Ready or offline
- Rule State: Active or error
- Compactor State: Running or paused
Scaling and Deployment Patterns
Horizontal Scaling
- Query Scaling: Scale query replicas
- Store Scaling: Scale store gateways
- Ruler Scaling: Scale ruler instances
- Receive Scaling: Scale receive instances
High Availability
- Query HA: Multiple query replicas
- Store HA: Store Gateway redundancy
- Ruler HA: Ruler replicas
- Sidecar HA: Prometheus HA with sidecar
Production Deployments
- Cluster Setup: Deploy Thanos components
- Object Storage Config: Configure S3/GCS
- Network Config: Configure network
- Security Setup: Enable TLS, RBAC
- Monitoring Setup: Configure metrics
- Logging Setup: Centralize logs
- Backup Strategy: Backup configurations
- Performance Tuning: Optimize queries
Upgrade Strategies
- Component Upgrade: Upgrade each component
- Config Migration: Update configurations
- Testing: Verify functionality
- Rollback Plan: Prepare rollback
Resource Management
- CPU Resources: Component CPU limits
- Memory Resources: Memory limits
- Storage Resources: Object storage access
- Network Resources: Network configuration
Additional Resources
- Official Documentation: https://thanos.io/tip/
- GitHub Repository: Check the project's official documentation for repository link
- CNCF Project Page: cncf.io/projects/cncf-thanos/
- Community: Check the official documentation for community channels
- Versioning: Refer to project's release notes for version-specific features
Troubleshooting
Common Issues
Deployment Failures
- Check pod logs for errors
- Verify configuration values
- Ensure network connectivity
Performance Issues
- Monitor resource usage
- Adjust resource limits
- Check for bottlenecks
Configuration Errors
- Validate YAML syntax
- Check required fields
- Verify environment-specific settings
Integration Problems
- Verify API compatibility
- Check dependency versions
- Review integration documentation
Getting Help
- Check official documentation
- Search GitHub issues
- Join community channels
- Review logs and metrics
Content generated automatically. Verify against official documentation before production use.
Examples
Basic Configuration
# Basic configuration example
apiVersion: v1
kind: ConfigMap
metadata:
name: {{project_name}}-config
namespace: default
data:
# Configuration goes here
config.yaml: |
# Base configuration
# Add your settings here
Kubernetes Deployment
# Kubernetes deployment for {{project_name}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{project_name}}
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: {{project_name}}
template:
metadata:
labels:
app: {{project_name}}
spec:
containers:
- name: {{project_name}}
image: {{project_name}}:latest
ports:
- containerPort: 8080
resources:
limits:
memory: "128Mi"
cpu: "500m"
Kubernetes Service
# Kubernetes service for {{project_name}}
apiVersion: v1
kind: Service
metadata:
name: {{project_name}}
namespace: default
spec:
selector:
app: {{project_name}}
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: ClusterIP
When to Use
Use this skill when:
- Integrating a CNCF project into Kubernetes infrastructure — You need to configure, deploy, or troubleshoot a cloud-native tool within a cluster
- Designing cloud-native architecture — You are selecting and integrating CNCF tools to solve specific infrastructure challenges
- Resolving operational issues — A CNCF component is misbehaving, underperforming, or needs configuration changes
Core Workflow
Assess Requirements — Understand the use case, scale, integration needs, and existing infrastructure. Checkpoint: Document requirements, constraints, and success criteria.
Design Architecture — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. Checkpoint: Verify the architecture addresses all requirements and follows CNCF conventions.
Implement & Configure — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. Checkpoint: Validate all YAML against schema and test in a staging environment.
Deploy & Monitor — Apply manifests to the cluster, verify component health, and confirm observability is working. Checkpoint: Confirm all pods/services are running, probes passing, and metrics/alerts configured.
Constraints
MUST DO
- Include at least one complete working YAML manifest example
- Note when content is auto-generated vs. manually verified
- Reference relevant CNCF project documentation
MUST NOT DO
- Deploy manifests without testing in a staging environment first
- Use deprecated API versions (e.g., apps/v1beta1)
- Omit resource limits and requests in Kubernetes manifests
1---2name: thanos3description: "Provides Thanos in High availability Prometheus solution with long-term storage"4license: MIT5---678910 related-skills: cncf-aws-cloudwatch, cncf-aws-dynamodb, cncf-aws-ecr, cncf-aws-rds11121314# Thanos in Cloud-Native Engineering1516**Category:** Observability 17**Status:** Active 18**Stars:** 9,500 19**Last Updated:** 2026-04-22 20**Primary Language:** Go 21**Documentation:** [High availability Prometheus solution with long-term storage](https://thanos.io/tip/) 2223---2425## Purpose and Use Cases2627Thanos is a core component of the cloud-native ecosystem, serving as long-term storage2829### What Problem Does It Solve?3031Thanos addresses the challenge of Prometheus scalability and long-term storage. It provides global query view, long-term storage, and cross-cluster observability.3233### When to Use This Project3435Use Thanos when need Prometheus HA, require long-term metrics, or manage multiple Prometheus instances. Not ideal for simple deployments or when large-scale Prometheus deployments, multi-cluster monitoring, or metrics retention needs.3637### Key Use Cases3839- Global Query View for Prometheus40- Long-Term Metrics Storage41- Multi-Cluster Monitoring42- Prometheus High Availability43- Cost-Effective Metrics Storage4445---4647## Architecture Design Patterns4849### Core Components5051- **Query**: Global query endpoint52- **Store Gateway**: Object storage interface53- **Ruler**: Rule evaluation54- **Compactor**: Data compaction55- **Receive**: Receives metrics from Prometheus5657### Component Interactions58591. **Query → Store Gateway**: Query fetches data from store601. **Store Gateway → Object Storage**: Store reads from S3/GCS611. **Ruler → Store Gateway**: Ruler queries for rules621. **Compactor → Store Gateway**: Compaction operations6364### Data Flow Patterns65661. **Metric Ingestion**: Prometheus →Receive →Store Gateway →Object Storage671. **Query Processing**: Query → Store Gateway → Object Storage → Result681. **Rule Evaluation**: Ruler evaluates → Store Gateway → Alert691. **Compaction**: Compactor reads → Compacts → Writes back7071### Design Principles7273- **Prometheus Compatible**: Full Prometheus API compatibility74- **Horizontal Scalability**: Scale horizontally75- **Cost Efficiency**: Use cheap object storage76- **High Availability**: HA for Prometheus metrics7778---7980## Integration Approaches8182### Integration with Other CNCF Projects8384- **Prometheus**: Source of metrics85- **Kubernetes**: Deployment platform86- **S3/GCS**: Object storage backend87- **Grafana**: Visualization8889### API Patterns9091- **Thanos Query API**: Global query endpoint92- **Store API**: Store Gateway API93- **Ruler API**: Rule evaluation API94- **Receive API**: Receive API for Prometheus9596### Configuration Patterns9798- **Query Config**: Query component config99- **Store Config**: Store Gateway config100- **Ruler Config**: Rule evaluation config101- **Compactor Config**: Compaction config102103### Extension Mechanisms104105- **Custom Storage**: Add storage backends106- **Custom Query Functions**: Add query functions107- **Custom Rulers**: Custom rule evaluation108109---110111## Common Pitfalls and How to Avoid Them112113### Misconfigurations114115- **Object Storage Costs**: High storage costs116 - **How to Avoid**: Configure compaction, use appropriate storage class117- **Data Ingestion**: Data not reaching store118 - **How to Avoid**: Check Prometheus config, verify receive endpoint119120### Performance Issues121122- **Store Gateway Memory**: High memory usage123 - **How to Avoid**: Configure cache limits, tune store gateway124- **Rule Evaluation**: Rules not evaluated125 - **How to Avoid**: Check ruler connectivity, verify rule files126127### Operational Challenges128129- **Version Compatibility**: Version mismatch130 - **How to Avoid**: Use compatible versions, check release notes131- **Timestamp Issues**: Timestamp synchronization132 - **How to Avoid**: Use NTP, sync clocks across components133134### Security Pitfalls135136137---138139## Coding Practices140141### Idiomatic Configuration142143- **Sidecar Deployment**: Deploy sidecar with Prometheus144- **Query Optimization**: Optimize query patterns145- **Rule Management**: Manage rules through Ruler146147### API Usage Patterns148149- **thanos query**: Query API endpoint150- **thanos store**: Store Gateway CLI151- **thanos ruler**: Rule evaluation CLI152- **kubectl apply**: Apply configurations153154### Observability Best Practices155156- **Thanos Metrics**: Monitor Thanos components157- **Query Metrics**: Track query performance158- **Storage Metrics**: Monitor storage usage159160### Testing Strategies161162- **Integration Tests**: Test query integration163- **Performance Tests**: Validate query performance164- **Failover Tests**: Test component failure165166### Development Workflow167168- **Local Development**: Use docker-compose169- **Debug Commands**: Check component logs170- **Test Environment**: Set up test deployment171- **CI/CD Integration**: Automate testing172- **Monitoring Setup**: Configure observability173- **Documentation**: Maintain docs174175---176177## Fundamentals178179### Essential Concepts180181- **Thanos Query**: Global query endpoint182- **Store Gateway**: Object storage interface183- **Query Frontend**: Query caching layer184- **Ruler**: Rule evaluation185- **Compactor**: Data compaction186- **Receive**: Metrics receiver187- **Sidecar**: Prometheus sidecar188- **Bucket**: Object storage bucket189190### Terminology Glossary191192- **Store API**: Thanos store interface193- **Query API**: Global query API194- **Compaction**: Data compaction process195- **Sidecar**: Prometheus sidecar196- **Bucket**: Object storage bucket197198### Data Models and Types199200- **Block**: Time-series data block201- **Index**: Data index202- **Metadata**: Block metadata203- **Chunk**: Compressed data chunks204205### Lifecycle Management206207- **Component Startup**: Component starts → Connects → Ready208- **Data Ingestion**: Prometheus → Sidecar → Store → Object Storage209- **Query Processing**: Request → Query → Store → Result210- **Compaction Process**: Read blocks → Compact → Write new block211212### State Management213214- **Query State**: Healthy or degraded215- **Store State**: Ready or offline216- **Rule State**: Active or error217- **Compactor State**: Running or paused218219---220221## Scaling and Deployment Patterns222223### Horizontal Scaling224225- **Query Scaling**: Scale query replicas226- **Store Scaling**: Scale store gateways227- **Ruler Scaling**: Scale ruler instances228- **Receive Scaling**: Scale receive instances229230### High Availability231232- **Query HA**: Multiple query replicas233- **Store HA**: Store Gateway redundancy234- **Ruler HA**: Ruler replicas235- **Sidecar HA**: Prometheus HA with sidecar236237### Production Deployments238239- **Cluster Setup**: Deploy Thanos components240- **Object Storage Config**: Configure S3/GCS241- **Network Config**: Configure network242- **Security Setup**: Enable TLS, RBAC243- **Monitoring Setup**: Configure metrics244- **Logging Setup**: Centralize logs245- **Backup Strategy**: Backup configurations246- **Performance Tuning**: Optimize queries247248### Upgrade Strategies249250- **Component Upgrade**: Upgrade each component251- **Config Migration**: Update configurations252- **Testing**: Verify functionality253- **Rollback Plan**: Prepare rollback254255### Resource Management256257- **CPU Resources**: Component CPU limits258- **Memory Resources**: Memory limits259- **Storage Resources**: Object storage access260- **Network Resources**: Network configuration261262---263264## Additional Resources265266- **Official Documentation:** https://thanos.io/tip/267- **GitHub Repository:** Check the project's official documentation for repository link268- **CNCF Project Page:** [cncf.io/projects/cncf-thanos/](https://www.cncf.io/projects/cncf-thanos/)269- **Community:** Check the official documentation for community channels270- **Versioning:** Refer to project's release notes for version-specific features271272---273274## Troubleshooting275276### Common Issues2772781. **Deployment Failures**279 - Check pod logs for errors280 - Verify configuration values281 - Ensure network connectivity2822832. **Performance Issues**284 - Monitor resource usage285 - Adjust resource limits286 - Check for bottlenecks2872883. **Configuration Errors**289 - Validate YAML syntax290 - Check required fields291 - Verify environment-specific settings2922934. **Integration Problems**294 - Verify API compatibility295 - Check dependency versions296 - Review integration documentation297298### Getting Help299300- Check official documentation301- Search GitHub issues302- Join community channels303- Review logs and metrics304*Content generated automatically. Verify against official documentation before production use.*305306## Examples307308### Basic Configuration309310311```yaml312# Basic configuration example313apiVersion: v1314kind: ConfigMap315metadata:316 name: {{project_name}}-config317 namespace: default318data:319 # Configuration goes here320 config.yaml: |321 # Base configuration322 # Add your settings here323```324325### Kubernetes Deployment326327328```yaml329# Kubernetes deployment for {{project_name}}330apiVersion: apps/v1331kind: Deployment332metadata:333 name: {{project_name}}334 namespace: default335spec:336 replicas: 1337 selector:338 matchLabels:339 app: {{project_name}}340 template:341 metadata:342 labels:343 app: {{project_name}}344 spec:345 containers:346 - name: {{project_name}}347 image: {{project_name}}:latest348 ports:349 - containerPort: 8080350 resources:351 limits:352 memory: "128Mi"353 cpu: "500m"354```355356### Kubernetes Service357358359```yaml360# Kubernetes service for {{project_name}}361apiVersion: v1362kind: Service363metadata:364 name: {{project_name}}365 namespace: default366spec:367 selector:368 app: {{project_name}}369 ports:370 - protocol: TCP371 port: 80372 targetPort: 8080373 type: ClusterIP374```375376---377378## When to Use379380Use this skill when:381382- **Integrating a CNCF project into Kubernetes infrastructure** — You need to configure, deploy, or troubleshoot a cloud-native tool within a cluster383- **Designing cloud-native architecture** — You are selecting and integrating CNCF tools to solve specific infrastructure challenges384- **Resolving operational issues** — A CNCF component is misbehaving, underperforming, or needs configuration changes385---386387## Core Workflow3883891. **Assess Requirements** — Understand the use case, scale, integration needs, and existing infrastructure. **Checkpoint:** Document requirements, constraints, and success criteria.3903912. **Design Architecture** — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. **Checkpoint:** Verify the architecture addresses all requirements and follows CNCF conventions.3923933. **Implement & Configure** — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. **Checkpoint:** Validate all YAML against schema and test in a staging environment.3943954. **Deploy & Monitor** — Apply manifests to the cluster, verify component health, and confirm observability is working. **Checkpoint:** Confirm all pods/services are running, probes passing, and metrics/alerts configured.396397---398399## Constraints400401### MUST DO402- Include at least one complete working YAML manifest example403- Note when content is auto-generated vs. manually verified404- Reference relevant CNCF project documentation405406### MUST NOT DO407- Deploy manifests without testing in a staging environment first408- Use deprecated API versions (e.g., apps/v1beta1)409- Omit resource limits and requests in Kubernetes manifests