PART 5: ARCHITECTURE & STRATEGY
22. Storage Architecture Patterns
Pattern 1: Simple (Single AZ)
text
┌─────────────────────────────────────────────────────────────┐
│ Single AZ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Pod │ │ Pod │ │ Pod │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ └────────────────┴────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ EBS/PD │ │
│ │ (RWO) │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
Use case: Dev, single-region.
Pattern 2: Multi-AZ (HA)
text
┌─────────────────────────────────────────────────────────────┐
│ Multi-AZ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ AZ-a │ │ AZ-b │ │ AZ-c │ │
│ │ Pod │ │ Pod │ │ Pod │ │
│ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ EBS │ │ EBS │ │ EBS │ │
│ └───────────┘ └───────────┘ └───────────┘ │
└─────────────────────────────────────────────────────────────┘
Use case: Production HA.
Pattern 3: Replicated Storage (Ceph)
text
┌─────────────────────────────────────────────────────────────┐
│ Replicated Storage (Ceph) │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Node 1 │ │ Node 2 │ │ Node 3 │ │
│ │ OSD │ │ OSD │ │ OSD │ │
│ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ │
│ │ │ │ │
│ └──────────────────┴──────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ RBD/CephFS │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
Use case: On-prem, high availability.
23. Disaster Recovery for Stateful Workloads
DR Strategies
| Strategy | RPO | RTO | Cost |
| Backup/Restore | Hours | Hours | $ |
| Snapshot | Minutes | Minutes | $$ |
| Replication | Seconds | Minutes | $$$ |
| Active-Active | Zero | Zero | $$$$ |
Velero for Backup
Velero is the standard tool for Kubernetes backup and restore.
bash
# Install Velero
velero install \
--provider aws \
--bucket my-backup-bucket \
--secret-file ./credentials-velero \
--use-volume-snapshots=true
# Create a backup
velero backup create my-backup --include-namespaces production
# Restore
velero restore create --from-backup my-backup
Velero with CSI Snapshots
Velero can use CSI snapshots for volume backup.
yaml
apiVersion: velero.io/v1
kind: Backup
metadata:
name: my-backup
spec:
includedNamespaces:
- production
snapshotVolumes: true
volumeSnapshotLocations:
- my-snapshot-location
Backup Best Practices
| Practice | Why |
| Back up regularly | RPO |
| Test restores | Verify backups work |
| Store offsite | Protect against site failure |
| Encrypt backups | Security |
| Automate | Consistency |
24. Compliance & Security for Storage
| Framework | Storage Requirement |
| PCI-DSS | Encryption at rest, access controls |
| HIPAA | Encryption, audit trails |
| SOC2 | Change management, monitoring |
| GDPR | Data residency, right to erasure |
| FedRAMP | FIPS 140-2 encryption |
Encryption
| Layer | How |
| At rest | Storage encryption (EBS, PD, Azure Disk) |
| In transit | TLS for network storage |
| Kubernetes Secrets | etcd encryption |
Encryption at Rest Example
yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: encrypted
provisioner: ebs.csi.aws.com
parameters:
encrypted: "true"
kmsKeyId: "arn:aws:kms:us-east-1:123456789:key/abc"
1:1 copy of the class Google Doc, code in code blocks.