Troubleshooting: Integration Patterns
Common issues and solutions for integration patterns in Lab 07.
Authentication Integration
OAuth2 Proxy
Redirect URI Mismatch
Problem: OAuth provider rejects redirect URI
Symptoms:
- Error: "redirect_uri_mismatch"
- Authentication fails after OAuth provider login
Solution:
- Check redirect URI in OAuth app matches exactly:
- Protocol (http vs https)
- Domain
- Path (
/oauth2/callback)
- Update OAuth app configuration
- Restart OAuth2 Proxy
Prevention:
- Use consistent domain configuration
- Document redirect URI requirements
Cookie Issues
Problem: Users keep getting redirected to login
Symptoms:
- Users authenticated but redirected to login
- Session not persisting
Solution:
- Check cookie domain matches your domain
- Ensure cookie secret is set correctly
- Check cookie secure flag (should be true for HTTPS)
- Verify cookie samesite setting
Debug:
# Check OAuth2 Proxy logs
kubectl logs -n oauth-proxy deployment/oauth2-proxy
# Check cookie settings in config
kubectl get configmap oauth2-proxy-config -n oauth-proxy -o yamlToken Validation Failed
Problem: OAuth tokens not validating
Symptoms:
- Authentication succeeds but access denied
- Token validation errors in logs
Solution:
- Verify token issuer matches configuration
- Check token expiration
- Validate token signature
- Ensure correct OAuth provider configuration
SAML
Assertion Not Accepted
Problem: SAML assertion rejected
Symptoms:
- SAML response received but not accepted
- Authentication fails after IdP login
Solution:
- Verify certificate matches IdP
- Check entity IDs match
- Validate assertion signature
- Check assertion expiration
- Verify ACS URL is correct
Debug:
- Check SAML response in browser developer tools
- Validate SAML assertion format
- Check application logs
Redirect Loop
Problem: Infinite redirect between app and IdP
Symptoms:
- Continuous redirects
- Never reaches authenticated state
Solution:
- Verify SAML response is being processed
- Check session creation
- Validate assertion format
- Ensure application handles SAML response correctly
LDAP/AD
Connection Refused
Problem: Cannot connect to LDAP server
Symptoms:
- Connection timeout
- "Connection refused" errors
Solution:
- Check server accessibility:bash
telnet ldap-server 389 - Verify port (389 for LDAP, 636 for LDAPS)
- Check firewall rules
- Verify network connectivity
Authentication Failed
Problem: LDAP bind fails
Symptoms:
- "Invalid credentials" errors
- User not found
Solution:
- Verify bind DN is correct
- Check password is correct
- Verify user exists in LDAP
- Validate search filter
- Check user permissions
Debug:
# Test LDAP connection
ldapsearch -H ldap://ldap-server -x -D "bind-dn" -w "password" -b "base-dn" "(uid=testuser)"Database Integration
Cloud SQL Proxy
Connection Refused
Problem: Cannot connect to Cloud SQL
Symptoms:
- Connection timeout
- "Connection refused" errors
Solution:
- Check Cloud SQL instance is running:bash
gcloud sql instances describe INSTANCE_NAME - Verify connection name is correct:
PROJECT_ID:REGION:INSTANCE_NAME - Check service account has permissions:bash
gcloud projects get-iam-policy PROJECT_ID \ --flatten="bindings[].members" \ --filter="bindings.members:serviceAccount:cloud-sql-proxy@*" - Verify Workload Identity is configured
- Check proxy pod logs:bash
kubectl logs -n database deployment/cloud-sql-proxy
Authentication Failed
Problem: IAM authentication fails
Symptoms:
- "Permission denied" errors
- Authentication errors
Solution:
- Verify service account has
cloudsql.clientrole - Check Workload Identity binding:bash
gcloud iam service-accounts get-iam-policy \ cloud-sql-proxy@PROJECT_ID.iam.gserviceaccount.com - Verify service account annotation in pod spec
- Check proxy pod service account
Connection Pool Exhausted
Problem: Too many connections
Symptoms:
- "Too many connections" errors
- Connection wait times
Solution:
- Increase connection pool size
- Reduce connection lifetime
- Check for connection leaks
- Monitor connection usage
External Database
Connection Timeout
Problem: Cannot connect to external database
Symptoms:
- Connection timeout
- Network unreachable
Solution:
- Check network connectivity:bash
kubectl run -it --rm debug --image=busybox --restart=Never -- \ telnet database-host 5432 - Verify firewall rules
- Check DNS resolution
- Verify VPN status (if applicable)
- Check database is accessible from GKE nodes
SSL/TLS Errors
Problem: SSL certificate validation fails
Symptoms:
- "Certificate verify failed" errors
- SSL handshake errors
Solution:
- Verify certificate is valid
- Check certificate chain is complete
- Validate SSL mode matches database configuration
- Consider using
verify-caorrequiremode
API Gateway
Kong
502 Bad Gateway
Problem: Kong cannot reach backend
Symptoms:
- 502 errors from Kong
- Backend unreachable
Solution:
- Verify backend service is running:bash
kubectl get svc -n argo - Check backend URL in Kong config
- Verify network connectivity from Kong to backend
- Check backend service endpoints
Debug:
# Check Kong logs
kubectl logs -n kong deployment/kong
# Test backend directly
kubectl port-forward -n argo svc/argo-workflows-server 2746:2746
curl http://localhost:2746Rate Limiting Not Working
Problem: Rate limits not enforced
Symptoms:
- Requests exceed rate limit
- No rate limit errors
Solution:
- Verify rate limiting plugin is enabled
- Check plugin configuration
- Verify plugin is applied to correct route
- Check Kong admin API for plugin status
GCP API Gateway
502 Bad Gateway
Problem: API Gateway cannot reach backend
Symptoms:
- 502 errors from API Gateway
- Backend unreachable
Solution:
- Verify backend service is accessible
- Check service account has permissions
- Verify backend URL in API config
- Check backend service health
Authentication Failed
Problem: API key or JWT validation fails
Symptoms:
- 401 Unauthorized errors
- Authentication errors
Solution:
- Verify API key is valid (if using)
- Check JWT token is valid (if using)
- Validate security definitions in API config
- Check token issuer and audience
Service Mesh
Istio
Sidecar Not Injected
Problem: Pod doesn't have Envoy sidecar
Symptoms:
- Pod running but no sidecar
- Traffic not going through mesh
Solution:
- Verify namespace has injection enabled:bash
kubectl get namespace default -o jsonpath='{.metadata.labels.istio-injection}' - Enable injection:bash
kubectl label namespace default istio-injection=enabled - Restart pods to get sidecar
- Check Istio control plane is running
mTLS Handshake Failed
Problem: Services cannot communicate with mTLS
Symptoms:
- Connection errors between services
- mTLS handshake failures
Solution:
- Verify PeerAuthentication policy
- Check mTLS mode (STRICT, PERMISSIVE, DISABLE)
- Verify certificates are valid
- Check service mesh configuration
General Troubleshooting
Check Pod Logs
# Get pod logs
kubectl logs -n NAMESPACE deployment/DEPLOYMENT_NAME
# Follow logs
kubectl logs -f -n NAMESPACE deployment/DEPLOYMENT_NAME
# Get logs from all pods
kubectl logs -n NAMESPACE -l app=APP_NAMECheck Pod Status
# Get pod status
kubectl get pods -n NAMESPACE
# Describe pod
kubectl describe pod -n NAMESPACE POD_NAME
# Get pod events
kubectl get events -n NAMESPACE --sort-by='.lastTimestamp'Check Service Status
# Get services
kubectl get svc -n NAMESPACE
# Describe service
kubectl describe svc -n NAMESPACE SERVICE_NAME
# Get endpoints
kubectl get endpoints -n NAMESPACE SERVICE_NAMENetwork Debugging
# Test connectivity from pod
kubectl run -it --rm debug --image=busybox --restart=Never -- \
wget -O- http://service.namespace.svc.cluster.local
# Check DNS resolution
kubectl run -it --rm debug --image=busybox --restart=Never -- \
nslookup service.namespace.svc.cluster.localCheck Configuration
# Get ConfigMap
kubectl get configmap -n NAMESPACE CONFIGMAP_NAME -o yaml
# Get Secret (base64 encoded)
kubectl get secret -n NAMESPACE SECRET_NAME -o yaml
# Decode secret
kubectl get secret -n NAMESPACE SECRET_NAME -o jsonpath='{.data.key}' | base64 -dGetting Help
If you're stuck:
- Check the specific integration pattern README
- Review architecture documentation
- Check application logs
- Verify configuration matches examples
- Test connectivity manually
- Review GCP/cloud provider documentation