- Altinity ClickHouse Operator: Enterprise-grade ClickHouse management for Kubernetes
- ClickHouse Keeper: Distributed coordination service (replaces ZooKeeper)
- ClickHouse Cluster: High-availability database cluster for trace storage
- S3-Compatible Storage: Object storage for ClickHouse data persistence
Important Setup Notes
The configuration examples in this guide are for reference only. Because each organization’s Kubernetes environment is unique, your self-hosted instance will likely require you to adjust:- Security & Compliance: Security contexts,
runAsUser/fsGroupvalues, and other security settings according to your organization’s security policies and Kubernetes/OpenShift requirements. - Resource Sizing: The resource allocations shown are starting points. Consult with your W&B Solutions Architect team for proper sizing based on your expected trace volume and performance requirements.
- Infrastructure Specifics: Update storage classes, node selectors, and other infrastructure-specific settings to match your environment.
Architecture
Prerequisites
Self-managed Weave instances require the following resources:- Kubernetes Cluster: Version 1.29+
- Kubernetes Nodes: Multi-node cluster (minimum 3 nodes recommended for high availability)
- Storage Class: A working StorageClass for persistent volumes (e.g.,
gp3,standard,nfs-csi) - S3 Bucket: Pre-configured S3 or S3-compatible bucket with appropriate access permissions
- W&B Platform: Already installed and running (see W&B Self-Managed Deployment Guide)
- W&B License: Weave-enabled license from W&B Support
Required Tools
To set up your instance, you need the following tools:kubectlconfigured with cluster accesshelmv3.0+- AWS credentials (if using S3) or access to S3-compatible storage
Network Requirements
Your Kubernetes cluster requires the following network setup:- Pods in the
clickhousenamespace must communicate with pods in thewandbnamespace - ClickHouse nodes must communicate with each other on ports 8123, 9000, 9009, and 2181
Deploy your self-managed Weave instance
Step 1: Deploy Altinity ClickHouse Operator
The Altinity ClickHouse Operator manages ClickHouse installations in Kubernetes.1.1 Add the Altinity Helm repository
1.2 Create the operator configuration
Create a file namedch-operator.yaml:
containerSecurityContext values shown here work for most Kubernetes distributions. For OpenShift, you may need to adjust runAsUser and fsGroup to match your project’s assigned UID range.
1.3 Install the operator
1.4 Verify the operator installation
Step 2: Prepare S3 Storage
ClickHouse requires S3 or S3-compatible storage for data persistence.2.1 Create an S3 bucket
Create an S3 bucket in your AWS account or S3-compatible storage provider:2.2 Configure S3 credentials
You have two options for providing S3 access credentials:Option A: Using AWS IAM Roles (IRSA - Recommended for AWS)
If your Kubernetes nodes have an IAM role with S3 access, ClickHouse can use the EC2 instance metadata:Option B: Using Access Keys
If you prefer using static credentials, create a Kubernetes secret:Step 3: Deploy ClickHouse Keeper
ClickHouse Keeper provides the coordination system for data replication and distributed DDL queries execution.3.1 Create the Keeper configuration
Create a file namedch-keeper.yaml:
- StorageClass: Update
storageClassName: gp3to match your cluster’s available StorageClass - Security Context: Adjust
runAsUser,fsGroupvalues to comply with your organization’s security policies - Anti-Affinity: Customize or remove the
affinitysection based on your cluster topology and HA requirements - Resources: The CPU/memory values are examples - consult with W&B Solutions Architects for proper sizing
- Naming: If you change
metadata.nameorconfiguration.clusters[0].name, you must update the Keeper hostnames in ch-server.yaml (Step 4) to match
3.2 Deploy ClickHouse Keeper
Step 4: Deploy ClickHouse Cluster
Now deploy the ClickHouse server cluster that will store Weave trace data.4.1 Create the ClickHouse server configuration
Create a file namedch-server.yaml:
- StorageClass: Update
storageClassName: gp3to match your cluster’s StorageClass - S3 Endpoint: Replace
YOUR-BUCKET-NAMEandYOUR-REGIONwith your actual values - Cache Size: The
<max_size>40Gi</max_size>must be smaller than the persistent volume size (50Gi) - Security Context: Adjust
runAsUser,fsGroup, and other security settings to match your organization’s policies - Resource Allocation: The CPU/memory values are examples only - consult with your W&B Solutions Architect for proper sizing based on your expected trace volume
- Anti-Affinity Rules: Customize or remove based on your cluster topology and high-availability needs
- Keeper Hostnames: The Keeper node hostnames must match your Keeper deployment naming from Step 3 (see “Understanding Keeper Naming” below)
- Cluster Naming: The cluster name
weaveclustercan be changed, but it must match theWF_CLICKHOUSE_REPLICATED_CLUSTERvalue in Step 5 - Credentials:
- For IRSA: Keep
<use_environment_credentials>true</use_environment_credentials>or access your secrets keys mapped to environment variables.
- For IRSA: Keep
4.2 Update S3 configuration
Edit thestorage_configuration.xml section in ch-server.yaml:
Example for AWS S3:
4.3 Configure credentials (Option B only)
If using Option B (Access Keys) from Step 2, ensure theenv section in ch-server.yaml references the secret:
env section.
4.4 Understanding Keeper Naming
The Keeper node hostnames in thezookeeper.nodes section follow a specific pattern based on your Keeper deployment from Step 3:
Hostname Pattern: chk-{installation-name}-{cluster-name}-{cluster-index}-{replica-index}.{namespace}.svc.cluster.local
Where:
chk= ClickHouseKeeperInstallation prefix (fixed){installation-name}= Themetadata.namefrom ch-keeper.yaml (e.g.,wandb){cluster-name}= Theconfiguration.clusters[0].namefrom ch-keeper.yaml (e.g.,keeper){cluster-index}= Cluster index, typically0for single cluster{replica-index}= Replica number:0,1,2for 3 replicas{namespace}= Kubernetes namespace (e.g.,clickhouse)
metadata.name: myweave):
clusters[0].name: coordination):
The Keeper hostnames in
ch-server.yaml must exactly match the actual service names created by the Keeper deployment, or ClickHouse servers will fail to connect to the coordination service.4.5 Deploy ClickHouse cluster
4.6 Verify ClickHouse deployment
Step 5: Enable Weave in W&B Platform
Now configure the W&B Platform to use the ClickHouse cluster for Weave traces.5.1 Gather ClickHouse connection information
You’ll need:- Host:
clickhouse-wandb.clickhouse.svc.cluster.local - Port:
8123 - User:
weave(as configured in ch-server.yaml) - Password:
weave123(as configured in ch-server.yaml) - Database:
weave(will be created automatically) - Cluster Name:
weavecluster(as configured in ch-server.yaml)
clickhouse-{installation-name}.{namespace}.svc.cluster.local
5.2 Update W&B Custom Resource
Edit your W&B Platform Custom Resource (CR) to add Weave configuration:clickhouse.replicated: true- Required when using 3 replicasWF_CLICKHOUSE_REPLICATED: "true"- Required for replicated setupWF_CLICKHOUSE_REPLICATED_CLUSTER: "weavecluster"- Must match the cluster name in ch-server.yaml
Security contexts, resource allocations, and other Kubernetes-specific configurations shown above are reference examples. Customize them according to your organization’s requirements and consult with your W&B Solutions Architect team for proper resource sizing.
5.3 Apply the updated configuration
5.4 Verify Weave Trace deployment
Step 6: Initialize Weave Database
The weave-trace service will automatically create the required database schema on first startup.6.1 Monitor database migration
6.2 Verify database creation
Step 7: Verify Weave is Enabled
7.1 Access W&B Console
Navigate to your W&B instance URL in a web browser.7.2 Check Weave license status
In the W&B Console:- Go to Top Right Menu → Organization Dashboard
- Verify that Weave access is enabled
7.3 Test Weave functionality
Create a simple Python test to verify Weave is working:Troubleshooting
ClickHouse Keeper Issues
Problem: Keeper pods stuck inPending state
Solution: Check multiple possible causes:
- PVC and StorageClass issues:
- Anti-affinity and node availability:
- Anti-affinity requires 3 separate nodes, but cluster has fewer nodes
- Nodes don’t have sufficient CPU/memory to meet pod requests
- Node taints preventing pod scheduling
- Remove or adjust anti-affinity rules if you have fewer than 3 nodes
- Use
preferredDuringSchedulingIgnoredDuringExecutioninstead ofrequiredDuringSchedulingIgnoredDuringExecutionfor softer anti-affinity - Reduce resource requests if nodes are constrained
- Add more nodes to your cluster
Problem: Keeper pods in
CrashLoopBackOff
Solution: Check logs and verify configuration:
- Incorrect security context (check runAsUser, fsGroup)
- Volume permission issues
- Port conflicts
- Configuration errors in ch-keeper.yaml
ClickHouse Server Issues
Problem: ClickHouse cannot connect to S3 Solution: Verify S3 credentials and permissions:Problem: ClickHouse cannot connect to Keeper Solution: Verify Keeper endpoints and naming:
Weave Trace Issues
Problem:weave-trace pod fails to start
Solution: Check ClickHouse connectivity:
Problem: Weave not showing as enabled in Console Solution: Verify configuration:
-
Check license includes Weave:
-
Ensure
weave-trace.enabled: trueandclickhouse.replicated: trueare set in wandb-cr.yaml -
Check W&B operator logs:
Problem: Database migration fails Solution: Check cluster name matches: The
WF_CLICKHOUSE_REPLICATED_CLUSTER environment variable must match the cluster name in ch-server.yaml:
Resource Requirements
Minimum Production Setup
Suitable for: Development, testing, or low-volume production environments
Recommended Production Setup
For production workloads with high trace volume:
Suitable for: High-volume production environments
For ultra-high volume deployments, contact your W&B Solutions Architect team for custom sizing recommendations based on your specific trace volume and performance requirements.
Advanced Configuration
This section covers customization options for self-managed Weave deployments, including scaling ClickHouse capacity through vertical scaling or horizontal scaling, updating ClickHouse versions by modifying image tags in both keeper and server configurations, and monitoring ClickHouse health. We recommend consulting with your W&B Solutions Architect team when making advanced changes to your instance to ensure they align with your performance and reliability requirements.Scaling ClickHouse
To increase ClickHouse capacity, you can:-
Vertical Scaling: Increases resources per pod (simpler approach)
Recommendation: Monitor actual resource usage and scale accordingly. For ultra-high volume deployments, contact your W&B Solutions Architect team.
-
Horizontal Scaling: Adds more replicas (requires careful planning)
- Increasing replicas requires data rebalancing
- Consult ClickHouse’s documentation for shard management
- Contact a W&B Solutions Architect before implementing horizontal scaling in production
Using Different ClickHouse Versions
To use a different ClickHouse version, update the image tag in both ch-keeper.yaml and ch-server.yaml:Monitoring ClickHouse
Access ClickHouse system tables for monitoring:Backup and Recovery
ClickHouse data is stored in S3, providing inherent backup capabilities through S3 versioning and bucket replication features. For backup strategies specific to your deployment, consult with your W&B Solutions Architect team and refer to the ClickHouse backup documentation.Security Considerations
- Credentials: Store ClickHouse passwords in Kubernetes secrets, not plain text
- Network Policies: Consider implementing NetworkPolicies to restrict ClickHouse access
- RBAC: Ensure service accounts have minimal required permissions
- S3 Bucket: Enable encryption at rest and restrict bucket access to necessary IAM roles
- **TLS ** (Optional): For production, enable TLS for ClickHouse client connections
Upgrading
Upgrading ClickHouse Operator
Upgrading ClickHouse Server
Update the image version inch-server.yaml and apply:
Upgrading Weave Trace
Update the image tag inwandb-cr.yaml and apply:
Additional Resources
- Altinity ClickHouse Operator Documentation
- ClickHouse Documentation
- W&B Weave Documentation
- ClickHouse S3 Storage Configuration
Support
For production deployments or issues:- W&B Support:
support@wandb.com - Solutions Architects: For ultra-high volume deployments, custom sizing, and deployment planning
- Include in support requests:
- Logs from weave-trace, ClickHouse pods, and operator
- W&B version, ClickHouse version, Kubernetes version
- Cluster information and trace volume
FAQ
Q: Can I use a single ClickHouse replica instead of 3? A: Yes, but it’s not recommended for production. UpdatereplicasCount: 1 in ch-server.yaml and set clickhouse.replicated: false in wandb-cr.yaml.
Q: Can I use another database instead of ClickHouse?
A: No, Weave Trace requires ClickHouse for its high-performance columnar storage capabilities.
Q: How much S3 storage will I need?
A: S3 storage requirements depend on your trace volume, retention period, and data compression. Monitor your actual usage after deployment and adjust accordingly. ClickHouse’s columnar format provides excellent compression for trace data.
Q: Do I need to configure the database name in ClickHouse?
A: No, the weave database will be created automatically by the weave-trace service during initial startup.
Q: What if my cluster name is not weavecluster?
A: You must set the WF_CLICKHOUSE_REPLICATED_CLUSTER environment variable to match your cluster name, otherwise database migrations will fail.
Q: Should I use the exact security contexts shown in the examples?
A: No. The security contexts (runAsUser, fsGroup, etc.) provided in this guide are reference examples. You must adjust them to comply with your organization’s security policies, especially for OpenShift clusters which have specific UID/GID range requirements.
Q: How do I know if I’ve sized my ClickHouse cluster correctly?
A: Contact your W&B Solutions Architect team with your expected trace volume and usage patterns. They will provide specific sizing recommendations. Monitor your deployment’s resource usage and adjust as needed.
Q: Can I customize the naming conventions used in the examples?
A: Yes, but you must maintain consistency across all components:
- ClickHouse Keeper names → Must match the Keeper node hostnames in ch-server.yaml’s
zookeeper.nodessection - ClickHouse cluster name (
weavecluster) → Must matchWF_CLICKHOUSE_REPLICATED_CLUSTERin wandb-cr.yaml - ClickHouse installation name → Affects the service hostname used by weave-trace