Stage 4, Part 5 of 9, Workloads & Lifecycle Deep Dive
Text
PART 5: ARCHITECTURE & STRATEGY
23. Workload Patterns by Application Type
| Application Type | Workload | Replicas | Storage | Notes |
| Stateless web | Deployment | 3+ | None | PDB, probes, HPA |
| API service | Deployment | 3+ | None | Same |
| Database | StatefulSet | 1-3 | RWO | Anti-affinity, backups |
| Message queue | StatefulSet | 3+ | RWO | Cluster ID, no scale-to-0 |
| Cache | StatefulSet | 3+ | RWO | Memory-optimized nodes |
| Batch job | Job | N/A | Optional | Resource limits, backoff |
| Cron task | CronJob | N/A | Optional | Idempotent, timeouts |
| Node agent | DaemonSet | N/A | Host mount | Tolerations, resources |
| Log collector | DaemonSet | N/A | Host mount | Same |
24. Migration Strategies
VM to Kubernetes Migration
| Phase | Action |
| 1. Assess | Inventory VMs, dependencies |
| 2. Containerize | Build images, extract config |
| 3. Deploy stateless | Start with stateless services |
| 4. Migrate stateful | Use StatefulSets, external DBs |
| 5. Optimize | Right-size, autoscale, tune |
| 6. Decommission | Retire VMs |
The 12-Factor App Fit
| Factor | Kubernetes Support |
| Codebase | Container images |
| Dependencies | Container isolation |
| Config | ConfigMaps, Secrets |
| Backing services | Services, ExternalName |
| Build/release/run | CI/CD + image tags |
| Processes | Stateless containers |
| Port binding | Service abstraction |
| Concurrency | Horizontal scaling |
| Disposability | Graceful shutdown |
| Dev/prod parity | Same images everywhere |
| Logs | stdout/stderr |
| Admin processes | Jobs, CronJobs |
25. Compliance & Security for Workloads
| Framework | Workload Requirement |
| PCI-DSS | Non-root, read-only rootfs, PSS restricted |
| HIPAA | Encryption, audit, access controls |
| SOC2 | Change management, monitoring |
| FedRAMP | FIPS 140-2, PSS restricted |
Workload security checklist:
- □ Non-root user
- □ Read-only root filesystem
- □ Drop all capabilities
- □ seccomp RuntimeDefault
- □ Resource limits
- □ No privileged
- □ Image from trusted registry
- □ Image scanned
- □ NetworkPolicy applied
- □ Service account with minimal RBAC
1:1 copy of the class Google Doc, code in code blocks.