Skip to main content

Deployment Issues Prevention Guide

Last Updated: 2025-11-02 Applies To: All deployment types (Docker, GKE, EKS, AKS, Rancher, on-premises Kubernetes)

Overview

This document catalogues all deployment issues encountered and provides universal prevention strategies to ensure they never occur again, regardless of deployment platform.

Issue Catalog

Issue #1: Docker Editable Install Incompatibility

Commit: Introduced in a0ba7a1 (Oct 31), Fixed in 3833ae6 (Nov 2) Platform: Universal (all Docker-based deployments) Severity: Critical (prevents container startup) Problem:
Root Cause: Editable install (-e) creates .pth pointer files in site-packages that reference /app/src/. When only site-packages is copied (not the full venv), the pointers break. Prevention:
  1. Never use editable install in multi-stage Docker builds
  2. Use regular install: uv pip install --no-deps .
  3. Add validation check:
Automated Check: Add to CI/CD:

Issue #2: Cloud SQL shared_buffers Configuration

Commit: Fixed in 9a7b84f (Nov 2) Platform: GCP Cloud SQL, AWS RDS, Azure Database for PostgreSQL Severity: Critical (prevents database creation) Problem:
Root Cause: Each cloud provider has specific memory configuration requirements based on instance size. Prevention:
  1. Calculate from RAM: shared_buffers = RAM * 0.25 / 8KB
    • 4GB RAM → 1GB * 0.25 = 256MB → 256MB / 8KB = 32768 pages → TOO LOW
    • Recommendation: Use 512MB for 4GB RAM → 65536 pages
  2. Provider-specific validation:
Automated Check:

Issue #3: VPC Peering for Private Services

Commit: Fixed in 616f81b (Nov 2) Platform: GCP, AWS, Azure private cloud services Severity: Critical (prevents private resource creation) Problem:
Root Cause: Private Cloud SQL/RDS/managed database instances require VPC peering to be established before creation. Prevention:
  1. Always configure VPC peering BEFORE creating managed services
GCP:
AWS:
Azure:
Automated Validation:

Issue #4: Pod Security Context Missing

Commit: Fixed in previous session Platform: Universal (all Kubernetes platforms with Pod Security Standards) Severity: High (pods fail admission) Problem:
Root Cause: GKE Autopilot, EKS Fargate, and clusters with Pod Security Standards enforce security contexts on ALL containers (including init containers). Prevention:
  1. Always define security context for ALL containers:
  1. Pod-level security context:
Automated Validation:

Issue #5: RBAC Resources Not Needed

Commit: Fixed in b97567c (Nov 2) Platform: Universal (all Kubernetes platforms) Severity: Medium (requires elevated permissions, violates least privilege) Problem:
Root Cause: Boilerplate RBAC resources copied from examples when application doesn’t actually use the Kubernetes API. Prevention:
  1. Audit RBAC necessity:
  1. Keep ONLY ServiceAccount with workload identity:
  1. Use External Secrets Operator instead of in-cluster RBAC for secret access
Automated Check:

Issue #6: kubectl Client-Side vs Server-Side Validation

Commit: Documented in EKS/AKS guide Platform: Universal (all Kubernetes platforms) Severity: High (false validation success) Problem:
Root Cause: Client-side validation only knows built-in Kubernetes resources, not CRDs from operators (External Secrets, Cert-Manager, etc.). Prevention:
  1. Always use server-side validation:
  1. Verify CRDs exist first:
Universal CI/CD Pattern:

Issue #7: Namespace Creation Timing

Commit: Documented in EKS/AKS guide Platform: Universal (all Kubernetes platforms) Severity: Medium (prevents rollback, complicates validation) Problem:
Root Cause: If deployment fails, namespace doesn’t exist for rollback. Validation also fails without namespace. Prevention:
  1. Create namespace BEFORE validation:
  1. Make namespace creation idempotent (using --dry-run=client | kubectl apply)

Issue #8: Environment Variable value/valueFrom Conflict

Commit: Documented in EKS/AKS guide Platform: Universal (all Kustomize deployments) Severity: High (invalid Kubernetes manifest) Problem:
Root Cause: Kustomize merges arrays by appending, creating a field with both value and valueFrom (invalid). Prevention:
  1. Patch ConfigMap data, not Deployment env:
  1. Use strategic merge patch for env array replacement:
Automated Check:

Universal Prevention Checklist

Use this checklist for ALL new deployment configurations:

✅ Docker Configuration

  • Use regular install, NOT editable (-e) in multi-stage builds
  • Validate package import after build
  • Use distroless or minimal base images
  • Test image locally before CI/CD

✅ Managed Database Configuration

  • Calculate shared_buffers from instance RAM (25% of RAM)
  • Validate configuration against provider limits
  • Configure VPC peering/subnet groups BEFORE creation
  • Test configuration with smallest instance size first

✅ Kubernetes Manifests

  • Security contexts on ALL containers (main + init + sidecar)
  • Pod-level security context with seccomp profile
  • Explicit resource requests/limits (min 500m CPU for safety)
  • Remove unused RBAC resources (audit with code search)
  • Use ConfigMap patches for env var overrides
  • Strategic merge patches for namespace resources

✅ CI/CD Workflows

  • Server-side kubectl validation (--dry-run=server)
  • Create namespace before validation
  • Verify CRDs exist before validation
  • Validate security contexts in manifests
  • Check for env value/valueFrom conflicts
  • Validate RBAC necessity

✅ Infrastructure Setup

  • VPC peering configured before managed services
  • Database configuration validated before creation
  • Secrets exist before deployment
  • Network connectivity tested

Platform-Specific Quick Reference

GCP / GKE

Minimum CPU: 500m with pod anti-affinity, 250m without Workload Identity: iam.gke.io/gcp-service-account Managed Database: Cloud SQL (requires VPC peering) Validation: Server-side dry-run

AWS / EKS

Minimum CPU: 250m (Fargate), flexible (EC2) Workload Identity: eks.amazonaws.com/role-arn (IRSA) Managed Database: RDS (requires DB subnet group) Validation: Server-side dry-run

Azure / AKS

Minimum CPU: Flexible (check node pool quotas) Workload Identity: azure.workload.identity/client-id Managed Database: Azure Database (requires service endpoint) Validation: Server-side dry-run

Rancher / On-Premises

Minimum CPU: Depends on cluster configuration Workload Identity: Platform-specific or service account tokens Managed Database: Self-hosted PostgreSQL Validation: Server-side dry-run

Automated Validation Script

Create .github/workflows/validate-deployment.yaml:

Testing Methodology

Pre-Deployment Testing

Post-Deployment Validation


Conclusion

By following this prevention guide and implementing the automated validation checks, all 8 critical deployment issues are prevented across:
  • ✅ Docker builds (all platforms)
  • ✅ GCP (GKE, Cloud SQL, VPC)
  • ✅ AWS (EKS, RDS, VPC)
  • ✅ Azure (AKS, Azure Database, VNet)
  • ✅ Rancher / On-Premises Kubernetes
  • ✅ Any Kubernetes platform with Pod Security Standards
Key Takeaways:
  1. Always use server-side kubectl validation
  2. Never use editable install in multi-stage Docker builds
  3. Configure VPC peering before creating managed databases
  4. Security contexts required on ALL containers
  5. Remove unused RBAC resources
  6. Calculate database shared_buffers from instance RAM
  7. Create namespaces before validation
  8. Patch ConfigMaps, not Deployment env arrays
Next Steps:
  • Implement automated validation workflow
  • Add validation to existing CI/CD pipelines
  • Test on fresh environments to verify prevention
  • Update deployment documentation with checklist