Measuring the heat of your applications
Bolometer is a Kubernetes operator that captures Go pprof profiles when your applications run hot. Like a scientific bolometer that detects radiant heat, this operator measures your application's resource intensity and captures performance profiles when things heat up.
- Threshold-based Profiling: Automatically captures profiles when CPU or memory usage exceeds configured thresholds
- On-demand Profiling: Continuous profiling at configurable intervals (30-60 seconds)
- Multiple Profile Types: Supports heap, CPU, goroutine, and mutex profiles
- S3 Integration: Uploads profiles to S3 with structured naming and metadata
- IRSA Support: Uses IAM Roles for Service Accounts for secure AWS authentication
- Annotation-based: Target pods using
bolometer.io/enabled: "true"annotation - Cooldown Period: Prevents excessive profiling with configurable cooldown
- Label Selection: Filter target pods by namespace and labels
bolometer/
├── api/v1alpha1/ # API definitions
│ ├── groupversion_info.go # API group version info
│ ├── profilingconfig_types.go # ProfilingConfig CRD types
│ └── zz_generated.deepcopy.go # Generated deep copy methods
├── cmd/
│ └── main.go # Operator entry point
├── config/ # Kubernetes manifests
│ ├── crd/
│ │ └── bolometer.io_profilingconfigs.yaml # CRD definition
│ ├── manager/
│ │ ├── deployment.yaml # Operator deployment
│ │ └── kustomization.yaml # Kustomize config
│ ├── rbac/ # RBAC configurations
│ │ ├── role.yaml # ClusterRole
│ │ ├── role_binding.yaml # ClusterRoleBinding
│ │ └── service_account.yaml # ServiceAccount with IRSA
│ └── samples/ # Example ProfilingConfigs
│ ├── profiling_v1alpha1_profilingconfig.yaml
│ └── profiling_v1alpha1_ondemand.yaml
├── docs/
│ └── IRSA_SETUP.md # IRSA setup guide
├── examples/
│ ├── sample-app/ # Sample Go app with pprof
│ │ ├── Dockerfile
│ │ └── main.go
│ └── target-app.yaml # Sample deployment
├── helm/bolometer/ # Helm chart
│ ├── Chart.yaml
│ ├── values.yaml
│ └── templates/
│ ├── _helpers.tpl
│ ├── crd.yaml
│ ├── deployment.yaml
│ ├── namespace.yaml
│ ├── rbac.yaml
│ ├── service.yaml
│ └── serviceaccount.yaml
├── internal/
│ ├── controller/ # Controller logic
│ │ ├── pod_watcher.go # Pod tracking
│ │ └── profilingconfig_controller.go # Main reconciler
│ ├── metrics/ # Metrics collection
│ │ └── collector.go # Metrics-server client
│ ├── profiler/ # Profile capture
│ │ └── profiler.go # pprof client
│ └── uploader/ # S3 upload
│ └── s3.go # S3 client
├── Dockerfile # Operator container image
├── Makefile # Build automation
├── README.md # Main documentation
├── go.mod # Go dependencies
└── go.sum # Go checksums
The operator consists of:
Defines profiling behavior for target pods.
Key fields:
selector: Pod selection criteria (namespace, labels)thresholds: Resource thresholds (CPU, memory percentages)onDemand: Continuous profiling configurations3Config: S3 bucket and region settingsprofileTypes: Types of profiles to capture
ProfilingConfigReconciler - Main reconciliation loop
Responsibilities:
- Watch ProfilingConfig resources
- Discover and track annotated pods
- Manage monitoring goroutines
- Coordinate profiling operations
- Update status metrics
Tracks pods with profiling enabled.
Features:
- Lists pods by annotation and labels
- Maintains active pod tracking
- Manages cooldown periods
- Thread-safe pod map
Fetches pod metrics from metrics-server.
Capabilities:
- Query PodMetrics API
- Calculate CPU/memory usage percentages
- Compare against thresholds
- Detect abnormalities
Captures pprof profiles from target pods.
Features:
- Port-forward to pod's pprof endpoint
- Capture multiple profile types (heap, CPU, goroutine, mutex)
- Configurable pprof port via annotation
- Timeout and error handling
Uploads profiles to S3.
Features:
- AWS SDK v2 integration
- IRSA/IAM role authentication
- Structured S3 key naming
- Metadata tagging
- Retry logic
- Kubernetes 1.30+
- Go 1.23+ (for development)
- metrics-server installed in the cluster
- S3 bucket for profile storage
- IAM role with S3 write permissions (for IRSA)
Use the automated installation script with validation:
./install.shThe script will:
- ✅ Validate prerequisites (kubectl, cluster access, metrics-server)
- 📝 Prompt for configuration (S3 bucket, region, IAM role)
- 🚀 Install the operator components
- ✅ Validate the installation
For detailed installation options and troubleshooting, see Installation Guide.
- Install the operator:
helm install bolometer helm/bolometer \
--set serviceAccount.annotations."eks\.amazonaws\.com/role-arn"="arn:aws:iam::ACCOUNT_ID:role/bolometer-role" \
--namespace bolometer-system \
--create-namespace- Create a ProfilingConfig:
kubectl apply -f config/samples/profiling_v1alpha1_profilingconfig.yaml- Install CRDs and RBAC:
kubectl apply -f config/crd/
kubectl apply -f config/rbac/- Deploy the operator:
kubectl apply -f config/manager/Create an IAM role with the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::YOUR_BUCKET/profiles/*"
}
]
}Add trust relationship for the service account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::ACCOUNT_ID:oidc-provider/oidc.eks.REGION.amazonaws.com/id/OIDC_ID"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"oidc.eks.REGION.amazonaws.com/id/OIDC_ID:sub": "system:serviceaccount:bolometer-system:bolometer"
}
}
}
]
}Annotate your pods and expose pprof endpoints:
apiVersion: v1
kind: Pod
metadata:
name: my-go-app
annotations:
bolometer.io/enabled: "true"
bolometer.io/port: "6060" # Optional, defaults to 6060
spec:
containers:
- name: app
image: my-go-app:latestIn your Go application:
package main
import (
"log"
"net/http"
_ "net/http/pprof"
)
func main() {
// Start pprof server
go func() {
log.Println(http.ListenAndServe(":6060", nil))
}()
// Your application code
// ...
}bolometer.io/enabled: "true"- Enable profiling for podbolometer.io/port: "6060"- Custom pprof port (optional)
Create a ProfilingConfig to define profiling behavior:
apiVersion: bolometer.io/v1alpha1
kind: ProfilingConfig
metadata:
name: my-profiling-config
namespace: default
spec:
# Select pods to profile
selector:
namespace: default
labelSelector:
app: my-go-app
# Threshold configuration
thresholds:
cpuThresholdPercent: 80 # Trigger when CPU > 80%
memoryThresholdPercent: 90 # Trigger when Memory > 90%
checkIntervalSeconds: 30 # Check every 30 seconds
cooldownSeconds: 300 # Wait 5 minutes between profiles
# Optional: On-demand profiling
onDemand:
enabled: true
intervalSeconds: 35 # Profile every 35 seconds
# S3 configuration
s3Config:
bucket: my-profiling-bucket
prefix: profiles
region: us-west-2
# Profile types to capture
profileTypes:
- heap
- cpu
- goroutine
- mutexKey configurations:
serviceAccount.annotations- IRSA role ARNdefaultConfig.s3.bucket- S3 bucket namedefaultConfig.s3.region- AWS regiondefaultConfig.thresholds.*- Default thresholdsresources.*- Operator resource limits
Monitors pod metrics and captures profiles when thresholds are exceeded:
- Monitor pod metrics every
checkIntervalSeconds - When CPU or memory exceeds threshold:
- Capture all configured profile types (a type that fails doesn't stop the others)
- Upload to S3 with the threshold that was exceeded as the reason
(for example
CPU usage 95.00% exceeds threshold 80%) - Apply cooldown period
Continuously captures profiles at regular intervals:
- Captures profiles every
intervalSeconds(30-60 seconds) - Upload immediately after capture
- Independent of threshold checks
- Uploads with reason: "on-demand"
- Can run alongside threshold monitoring
Profiles are uploaded to S3 with structured naming organized by date and service:
s3://{bucket}/{prefix}/{date}/{service-name}/{timestamp}-{pod-name}-{profile-type}.pprof
Where:
date: YYYY-MM-DD format (e.g., 2024-01-15)service-name: Extracted from pod labels or metadatatimestamp: YYYYMMDD-HHmmss formatpod-name: The pod the profile was captured from, so replicas profiled at the same moment don't overwrite each other
Example:
s3://my-bucket/profiles/2024-01-15/my-app/20240115-120000-my-app-7d8f9c5b6d-xyz456-heap.pprof
s3://my-bucket/profiles/2024-01-15/my-app/20240115-120000-my-app-7d8f9c5b6d-xyz456-cpu.pprof
s3://my-bucket/profiles/2024-01-15/my-app/20240115-120000-my-app-7d8f9c5b6d-abc123-heap.pprof
See docs/S3_STRUCTURE.md for details, including how to parse filenames.
Service name is extracted from (in order of preference):
app.kubernetes.io/namelabel (recommended)applabel (common convention)k8s-applabel- Owner reference name (Deployment, StatefulSet, etc.)
- Pod name prefix (fallback)
Metadata tags include:
- pod-name
- pod-namespace
- profile-type
- reason (the threshold that was exceeded, or
on-demand) - timestamp
- pod labels
The operator requires:
- Read pods (get, list, watch)
- Create port-forward (pods/portforward)
- Read metrics (metrics.k8s.io)
- Manage ProfilingConfigs (all verbs)
- Create events
sigs.k8s.io/controller-runtime- Controller frameworkk8s.io/client-go- Kubernetes clientk8s.io/metrics- Metrics API clientgithub.com/aws/aws-sdk-go-v2- AWS SDKk8s.io/api- Kubernetes API types
- metrics-server - Required for pod metrics
- IRSA/IAM roles - Required for S3 access
# Install dependencies
make deps
# Format and vet
make fmt vet
# Build
make build
# Run locally (requires kubeconfig)
make runmake docker-build IMG=your-registry/bolometer:tag
make docker-push IMG=your-registry/bolometer:tag# Using kubectl
make install # Install CRDs
make deploy # Deploy operator
# Using Helm
make helm-installmake test- Deploy operator
- Deploy sample application with pprof
- Create ProfilingConfig
- Generate load
- Verify profiles in S3
The operator serves controller-runtime's standard Prometheus metrics on port
8080 (/metrics): reconcile counts, errors and durations, work queue depth,
and API client requests. It doesn't export profiling-specific metrics.
Profiling activity is reported per ProfilingConfig instead:
- Status:
activePods,totalProfiles(profiles captured),totalUploads(profiles stored in S3),lastProfileTime, and theReadycondition - Events:
InvalidConfig(Warning) andConfigValid(Normal)
kubectl get profilingconfig -A # active pods, profiles, uploads
kubectl describe profilingconfig <name> -n <namespace>Health checks:
- Liveness:
http://localhost:8081/healthz - Readiness:
http://localhost:8081/readyz
Structured logging with:
- Info: Normal operations
- Error: Failures and retries
- Debug: Detailed diagnostics
- Profiles not captured: Check pprof endpoint, annotations
- S3 upload fails: Verify IRSA, IAM permissions
- Metrics unavailable: Check metrics-server
- High CPU usage: Increase intervals, reduce profile types
If a ProfilingConfig is invalid (for example, s3Config.bucket or
s3Config.region is empty), the operator stops monitoring it. It doesn't keep
using the previous settings. The problem is reported in the Ready condition
and as a Warning event with reason InvalidConfig:
kubectl describe profilingconfig <name> -n <namespace>
kubectl get profilingconfig <name> -n <namespace> \
-o jsonpath='{.status.conditions[?(@.type=="Ready")]}'Once the spec is fixed, monitoring resumes, Ready returns to True, and a
Normal event with reason ConfigValid confirms the fix.
-
Check pod has the annotation:
kubectl get pod <pod-name> -o jsonpath='{.metadata.annotations}'
-
Verify pprof endpoint is accessible:
kubectl port-forward pod/<pod-name> 6060:6060 curl http://localhost:6060/debug/pprof/
-
Check ProfilingConfig status:
kubectl get profilingconfig <name> -o yaml
-
Verify IRSA annotation on service account:
kubectl get sa bolometer -n bolometer-system -o yaml
-
Check operator logs:
kubectl logs -n bolometer-system -l app=bolometer
-
Verify IAM role has S3 permissions
-
Check metrics-server is running:
kubectl get deployment metrics-server -n kube-system
-
Test metrics API:
kubectl top pods
# Check operator logs
kubectl logs -n bolometer-system -l app=bolometer -f
# Check ProfilingConfig status
kubectl get profilingconfig -A
kubectl describe profilingconfig <name> -n <namespace>
# Check metrics
kubectl top pods
# Test pprof endpoint
kubectl port-forward <pod> 6060:6060
curl http://localhost:6060/debug/pprof/- IRSA: Use IAM roles instead of static credentials
- RBAC: Least privilege permissions
- Pod Security: Non-root user, dropped capabilities
- S3 Encryption: Enable bucket encryption
- Network Policies: Restrict operator egress
- Cooldown Period: Prevent excessive profiling
- Check Interval: Balance between responsiveness and overhead
- Profile Types: More types = more overhead
- Concurrent Profiling: One pod at a time per config
- Resource Limits: Set appropriate operator limits
- S3 Lifecycle: Auto-delete old profiles
- Intelligent Tiering: Move to cheaper storage
- Profile Frequency: Adjust intervals based on needs
- Selective Profiling: Profile only critical pods
See config/samples/ for example configurations:
profiling_v1alpha1_profilingconfig.yaml: Basic threshold-based profilingprofiling_v1alpha1_ondemand.yaml: On-demand continuous profiling
Potential improvements:
- Support for other languages (Python, Java, Node.js)
- Profile comparison and analysis
- Alerting integration
- Web UI for profile visualization
- Automatic anomaly detection with ML
- Profile streaming instead of batch upload
- Support for other storage backends (GCS, Azure Blob)
- CPU flame graph generation
- Memory leak detection
- Integration with observability platforms
Contributions are welcome! Please ensure:
- Code passes
make fmtandmake vet - Tests are included for new features
- Documentation is updated
- Run
make fmt vet testbefore submitting - Sign commits
Apache 2.0
For issues and questions, please open a GitHub issue.