Kubernetes Deployment
🏭 When to Use Kubernetes
Section titled “🏭 When to Use Kubernetes”Perfect For:
Section titled “Perfect For:”- Enterprise production - Millions of verifications/day
- High availability - 99.9% uptime requirements
- Auto-scaling - Handles traffic spikes automatically
- Multi-region - Global deployment across data centers
- Large teams - DevOps teams with Kubernetes expertise
Requirements:
Section titled “Requirements:”- Kubernetes cluster (AWS EKS, Google GKE, Azure AKS)
- DevOps team with Kubernetes experience
- Budget: $500-5000+/month (depending on scale)
🚀 Quick Deployment
Section titled “🚀 Quick Deployment”One-Command Setup
Section titled “One-Command Setup”# Deploy complete VoP stack to Kuberneteskubectl apply -f k8s/
# Check everything is runningkubectl get pods -n vop-system
# Expected output:# vop-service-xxx 1/1 Running 0 2m# vop-service-yyy 1/1 Running 0 2m# vop-service-zzz 1/1 Running 0 2m
Access Your Service
Section titled “Access Your Service”# Forward port to access locallykubectl port-forward svc/vop-service 8443:443 -n vop-system
# Service available at: https://localhost:8443
What You Get
Section titled “What You Get”🏗️ Enterprise Architecture
Section titled “🏗️ Enterprise Architecture”Internet → Load Balancer → Kubernetes Cluster ├── VoP Pods (3+ instances) ├── Database Cluster ├── Redis Cluster └── Monitoring Stack
📈 Enterprise Features
Section titled “📈 Enterprise Features”- High Availability - 99.9% uptime with multi-zone deployment
- Auto-scaling - Automatically adds/removes instances based on load
- Load Balancing - Distributes traffic across multiple instances
- Health Monitoring - Automatic restart of failed instances
- Rolling Updates - Zero-downtime deployments
- Resource Management - Efficient CPU and memory usage
🔒 Enterprise Security
Section titled “🔒 Enterprise Security”- Network isolation - Micro-segmentation between services
- Pod security policies - Container-level security controls
- RBAC - Role-based access control
- Secret management - Encrypted storage of certificates and keys
- Audit logging - Complete audit trail of all activities
Prerequisites Setup
Section titled “Prerequisites Setup”Install Required Tools
Section titled “Install Required Tools”# Install cert-manager (for SSL certificates)helm repo add jetstack https://charts.jetstack.iohelm install cert-manager jetstack/cert-manager \ --namespace cert-manager \ --create-namespace \ --set installCRDs=true
# Install NGINX Ingress (for load balancing)helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginxhelm install ingress-nginx ingress-nginx/ingress-nginx \ --namespace ingress-nginx \ --create-namespace
Configuration Overview
Section titled “Configuration Overview”📦 VoP Service Configuration
Section titled “📦 VoP Service Configuration”# 3 instances for high availabilityreplicas: 3
# Rolling updates with zero downtimestrategy: type: RollingUpdate maxSurge: 1 maxUnavailable: 0
# Resource limitsresources: requests: memory: "256Mi" cpu: "250m" limits: memory: "512Mi" cpu: "500m"
⚡ Auto-scaling Configuration
Section titled “⚡ Auto-scaling Configuration”# Horizontal Pod AutoscalerminReplicas: 3maxReplicas: 20targetCPUUtilizationPercentage: 70
# Scales up when CPU > 70%# Scales down when CPU < 70%
🔒 Security Configuration
Section titled “🔒 Security Configuration”# Run as non-root usersecurityContext: runAsNonRoot: true runAsUser: 1000 readOnlyRootFilesystem: true
# Drop all capabilitiescapabilities: drop: - ALL
Monitoring & Health Checks
Section titled “Monitoring & Health Checks”📊 Built-in Monitoring
Section titled “📊 Built-in Monitoring”# Check service healthkubectl get pods -n vop-system
# View service logskubectl logs -f deployment/vop-service -n vop-system
# Check resource usagekubectl top pods -n vop-system
# View service metricskubectl port-forward svc/vop-service 9090:9090 -n vop-system# Visit: http://localhost:9090/metrics
🚨 Automatic Alerts
Section titled “🚨 Automatic Alerts”- Service Down - Alert when any instance fails
- High Error Rate - Alert when error rate > 5%
- High CPU Usage - Alert when CPU > 80%
- Memory Usage - Alert when memory > 90%
- Response Time - Alert when response time > 1s
Deployment Commands
Section titled “Deployment Commands”Service Management
Section titled “Service Management”# Deploy VoP servicekubectl apply -f k8s/
# Update deployment (zero downtime)kubectl set image deployment/vop-service vop-service=vop-service:v2.0 -n vop-system
# Scale service manuallykubectl scale deployment vop-service --replicas=5 -n vop-system
# Check deployment statuskubectl rollout status deployment/vop-service -n vop-system
# Rollback if neededkubectl rollout undo deployment/vop-service -n vop-system
Monitoring Commands
Section titled “Monitoring Commands”# Check all serviceskubectl get all -n vop-system
# View recent eventskubectl get events -n vop-system --sort-by='.lastTimestamp'
# Check service endpointskubectl get endpoints -n vop-system
# Test connectivitykubectl run test --image=busybox -it --rm --restart=Never -- \ wget -qO- https://vop-service.vop-system.svc.cluster.local/health
Performance & Scaling
Section titled “Performance & Scaling”📈 Expected Performance
Section titled “📈 Expected Performance”- Response time: < 200ms average
- Throughput: Unlimited (auto-scaling)
- Uptime: 99.9% (with multi-zone deployment)
- Concurrent users: 10,000+ simultaneous connections
🔄 Auto-scaling Behavior
Section titled “🔄 Auto-scaling Behavior”Traffic Load → Instances → Response TimeLow (< 1000/min) → 3 pods → < 100msMedium (5000/min) → 6 pods → < 150msHigh (20000/min) → 15 pods → < 200msPeak (50000/min) → 20 pods → < 300ms
💰 Cost Optimization
Section titled “💰 Cost Optimization”# Set resource requests appropriatelyresources: requests: memory: "256Mi" # Start small cpu: "250m" # Scale up as needed limits: memory: "512Mi" # Prevent memory leaks cpu: "500m" # Limit CPU usage
Cloud Provider Setup
Section titled “Cloud Provider Setup”☁️ AWS EKS
Section titled “☁️ AWS EKS”# Create EKS clustereksctl create cluster --name vop-cluster --region us-west-2
# Deploy VoPkubectl apply -f k8s/
# Setup load balancerkubectl apply -f k8s/aws-loadbalancer.yaml
☁️ Google GKE
Section titled “☁️ Google GKE”# Create GKE clustergcloud container clusters create vop-cluster --zone us-central1-a
# Deploy VoPkubectl apply -f k8s/
# Setup ingresskubectl apply -f k8s/gcp-ingress.yaml
☁️ Azure AKS
Section titled “☁️ Azure AKS”# Create AKS clusteraz aks create --resource-group vop-rg --name vop-cluster
# Deploy VoPkubectl apply -f k8s/
# Setup ingresskubectl apply -f k8s/azure-ingress.yaml
Troubleshooting
Section titled “Troubleshooting”🚫 Pods Not Starting
Section titled “🚫 Pods Not Starting”# Check pod statuskubectl get pods -n vop-system
# Check pod detailskubectl describe pod <pod-name> -n vop-system
# Common issues:# - Image pull errors: Check image name and registry access# - Resource limits: Increase memory/CPU limits# - Config errors: Check ConfigMap and Secrets
🌐 Service Not Accessible
Section titled “🌐 Service Not Accessible”# Check servicekubectl get svc -n vop-system
# Check ingresskubectl get ingress -n vop-system
# Test internal connectivitykubectl run debug --image=busybox -it --rm --restart=Never -- \ wget -qO- http://vop-service.vop-system.svc.cluster.local:8443/health
📊 Performance Issues
Section titled “📊 Performance Issues”# Check resource usagekubectl top pods -n vop-system
# Check if auto-scaling is workingkubectl get hpa -n vop-system
# View detailed metricskubectl describe hpa vop-hpa -n vop-system
🔒 Certificate Issues
Section titled “🔒 Certificate Issues”# Check certificate statuskubectl get certificates -n vop-system
# Check cert-manager logskubectl logs -n cert-manager deployment/cert-manager
# Manually trigger certificate renewalkubectl delete certificate vop-tls-cert -n vop-system
Security Best Practices
Section titled “Security Best Practices”✅ Kubernetes Security Checklist
Section titled “✅ Kubernetes Security Checklist”- RBAC enabled - Role-based access control configured
- Network policies - Pod-to-pod communication restricted
- Pod security policies - Container security standards enforced
- Secrets management - Certificates stored in Kubernetes secrets
- Image scanning - Container images scanned for vulnerabilities
- Resource limits - CPU and memory limits set
- Non-root containers - All containers run as non-root users
- Read-only filesystem - Container filesystems are read-only
Migration from Docker
Section titled “Migration from Docker”🔄 Migration Strategy
Section titled “🔄 Migration Strategy”- Prepare Kubernetes cluster - Set up EKS/GKE/AKS
- Test deployment - Deploy to staging environment
- Migrate data - Export/import database and certificates
- Switch traffic - Update DNS to point to Kubernetes
- Monitor - Ensure everything works correctly
- Cleanup - Shut down old Docker environment
📋 Migration Checklist
Section titled “📋 Migration Checklist”- Kubernetes cluster ready - EKS/GKE/AKS configured
- VoP deployed to K8s - All services running
- Database migrated - Data exported/imported
- Certificates migrated - SSL certificates working
- DNS updated - Traffic routing to K8s
- Monitoring configured - Alerts and dashboards setup
- Load testing completed - Performance validated
- Rollback plan ready - Can revert if needed