Database Troubleshooting
Testing & Qualitydatabase-troubleshootingDatabase Troubleshooting is an Agent Skill for testing & quality published in the HolmesGPT/holmesgpt repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Database Connection Troubleshooting
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/HolmesGPT/holmesgpt/blob/HEAD/tests/llm/fixtures/test_ask_holmes/94_skill_transparency/database-troubleshooting/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/database-troubleshooting, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Database Connection Troubleshooting
Overview
This runbook helps diagnose database connection timeout issues in Kubernetes applications.
Investigation Steps
1. Check Application Status
Verify the application pods are running and review recent events:
kubectl get pods -n {namespace} -l app={app_name}
kubectl describe pod -n {namespace} -l app={app_name}
2. Review Application Logs
Look for connection errors and timeout patterns:
kubectl logs -n {namespace} -l app={app_name} --tail=50 | grep -E "(timeout|connection|ERROR)"
3. Verify Database Service
Check if the database service exists and has endpoints:
kubectl get svc -n {namespace} | grep -E "(postgres|mysql|database)"
kubectl get endpoints -n {namespace} | grep -E "(postgres|mysql|database)"
4. Test Network Connectivity
Test connectivity from application pod to database:
kubectl exec -n {namespace} $(kubectl get pod -n {namespace} -l app={app_name} -o jsonpath="{.items[0].metadata.name}") -- nc -zv {db_host} {db_port}
5. Check Database Health
Connect to database and check its status:
# For PostgreSQL
kubectl exec -n {namespace} {db_pod} -- psql -U postgres -c "SELECT 1"
# Check active connections
kubectl exec -n {namespace} {db_pod} -- psql -U postgres -c "SELECT count(*) FROM pg_stat_activity"
6. Review Connection Pool Configuration
Check application's database connection pool settings:
kubectl get deployment -n {namespace} {app_name} -o yaml | grep -A10 "env:"
Common Issues
- No Database Endpoints: Database service has no backing pods
- Connection Pool Exhaustion: All connections in use, increase pool size
- Network Policy: Check if NetworkPolicies block database access
- DNS Resolution: Verify database hostname resolves correctly
- Database Overload: Too many connections, database not responding