ConfigMap Cache Use Cases and Troubleshooting¶
Real-world examples of ConfigMap volume mount pattern with performance results and troubleshooting guide.
Performance Wins
Argo Workflows repository mappings: 2 seconds → 200ms per workflow. Zero API calls. 100+ workflows per day. Pattern works at scale.
Use Cases¶
1. Argo Workflows: Repository Mappings¶
Scenario: Multi-repo CI/CD needs to map repo names to namespaces and artifact paths.
Without ConfigMap:
- 100+ workflow executions per day
- Each makes 2 or 3 API calls to read ConfigMaps
- 200 to 300 API requests per day
- Rate limit warnings in logs
With Volume Mount:
- ConfigMap mounted at
/cache - Each workflow reads file with
jq - Zero API calls
- Sub-millisecond lookups
Performance: 2 seconds → 200ms per workflow.
2. Kubernetes Jobs: Configuration Lookups¶
Scenario: Batch jobs need environment-specific configuration (database URLs, API endpoints).
ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: env-config
data:
environments.json: |\
{
"dev": {"db_url": "postgres://dev-db:5432", "api": "https://dev-api.example.com"},
"staging": {"db_url": "postgres://staging-db:5432", "api": "https://staging-api.example.com"},
"prod": {"db_url": "postgres://prod-db:5432", "api": "https://prod-api.example.com"}
}
Job Script:
ENV="${ENVIRONMENT:-dev}"
DB_URL=$(jq -r --arg env "$ENV" '.[$env].db_url' /config/environments.json)
API_URL=$(jq -r --arg env "$ENV" '.[$env].api' /config/environments.json)
echo "Connecting to $DB_URL"
3. CronJobs: Static Reference Data¶
Scenario: Scheduled job needs product catalogs, pricing tiers, or category mappings.
Benefit: Reference data loaded once per execution from file, not fetched repeatedly from API.
Troubleshooting¶
ConfigMap Not Mounted¶
Symptom: cat: /cache/mappings.json: No such file or directory
Cause: Volume not mounted or wrong mount path
Fix: Verify volumeMounts matches volumes name and mountPath exists.
Stale Data After ConfigMap Update¶
Symptom: Pod/Workflow still reading old data after ConfigMap update
Cause: Pods cache ConfigMap content
Fix:
- Deployments:
kubectl rollout restart deployment/my-app - Workflows: Data refreshes on next execution (no action needed)
- Jobs: Delete and recreate job
ConfigMap Too Large¶
Symptom: ConfigMap create fails with "too large" error
Cause: ConfigMaps limited to 1MB
Fix:
- Split into multiple ConfigMaps
- Use external storage (S3, PersistentVolume) for large datasets
- Compress data (base64-encoded gzip)
Related Patterns¶
- ConfigMap Cache Pattern - Main overview
- Implementation - How to create and mount ConfigMaps
- Refresh Strategies - How to update cache data
Argo Workflows drop from 2 seconds to 200ms. Kubernetes Jobs eliminate API calls. CronJobs cache reference data. Pattern works at scale. Troubleshoot mounting issues. Handle stale data. Split large datasets. ConfigMap cache wins.