Overview
Google Kubernetes Engine (GKE) is a managed Kubernetes service that provides enterprise-grade features including Autopilot mode, Workload Identity, and tight integration with Google Cloud services.This guide covers deploying to GKE with production-ready configuration including Workload Identity for secure service authentication, Cloud SQL for PostgreSQL, and Memorystore for Redis.
Prerequisites
- Google Cloud account with billing enabled
gcloudCLI installed and configuredkubectlinstalled- Project with required APIs enabled
Enable Required APIs
Create GKE Cluster
Autopilot Cluster (Recommended)
GKE Autopilot manages the cluster infrastructure for you:Standard Cluster
For more control over node configuration:Setup Workload Identity
Workload Identity allows pods to authenticate as Google Cloud service accounts:Cloud SQL for PostgreSQL
Create Cloud SQL Instance
Three databases required: Keycloak (identity), OpenFGA (authorization), and GDPR (compliance data storage per ADR-0041).
Initialize GDPR Schema
After creating the databases, initialize the GDPR schema:- user_profiles: User profile data (GDPR Article 15, 16, 17)
- user_preferences: User preferences (GDPR Article 16, 17)
- consent_records: Consent audit trail, 7-year retention (GDPR Article 21, Article 7)
- conversations: Conversation history, 90-day retention (GDPR Article 15, 20)
- audit_logs: Compliance audit trail, 7-year retention (HIPAA §164.316(b)(2)(i), SOC2 CC6.6)
Configure Cloud SQL Proxy
Option 1: Cloud SQL Auth Proxy SidecarMemorystore for Redis
Create Redis Instance
Configure Application
Secret Manager Integration
Store Secrets in Secret Manager
Use External Secrets Operator
Google Container Registry (GCR)
Build and Push Images
Artifact Registry (Recommended)
Load Balancer and Ingress
Install NGINX Ingress Controller
Configure Ingress
Google Cloud Load Balancer
For GCP-native load balancing:Monitoring with Cloud Operations
Enable Google Cloud Monitoring
Configure Pod Monitoring
Cloud Logging
Configure structured logging to Cloud Logging:Auto-Scaling
Horizontal Pod Autoscaler
Cluster Autoscaler
GKE Autopilot handles node scaling automatically. For Standard clusters:Complete Deployment
Cost Optimization
Use Autopilot Mode
Use Autopilot Mode
GKE Autopilot optimizes resource usage:
- Pay only for pod resources
- Automatic resource optimization
- No node management overhead
- Built-in security best practices
Enable Preemptible Nodes
Enable Preemptible Nodes
For non-production workloads:Use node affinity to schedule on preemptible nodes:
Right-Size Resources
Right-Size Resources
Use GKE usage metering to analyze resource usage:
Use Committed Use Discounts
Use Committed Use Discounts
For production workloads:
- 1-year commitment: 37% discount
- 3-year commitment: 55% discount
Security Best Practices
Enable Shielded Nodes
Enable Shielded Nodes
Network Policies
Network Policies
Troubleshooting
Cloud SQL connection fails
Cloud SQL connection fails
Check connectivity:
Workload Identity not working
Workload Identity not working
Verify setup:
Next Steps
EKS Deployment
Deploy to AWS EKS
AKS Deployment
Deploy to Azure AKS
Monitoring
Setup monitoring
Disaster Recovery
Backup and recovery
GKE Deployment Ready: Production-grade deployment on Google Kubernetes Engine!