Stage 9, Part 5 of 9, Cluster Extensibility (CRDs, Controllers, Operators)
Text
PART 5: ARCHITECTURE & STRATEGY
20. When to Build an Operator
Decision Framework
| Factor | Build Operator | Use Alternative |
| Complex stateful app | ✅ | — |
| Multi-step workflows | ✅ | — |
| Auto-remediation | ✅ | — |
| Simple stateless app | ❌ | Deployment |
| One-time setup | ❌ | Job |
| Configuration only | ❌ | ConfigMap + Reloader |
| Scheduled tasks | ❌ | CronJob |
The Operator Anti-Pattern
Operators carry real engineering costs in implementation, testing, maintenance, and a significantly expanded blast radius when things go wrong.
| Anti-Pattern | Why It's Bad |
| Operator for everything | Overhead, complexity |
| No testing | Bugs in production |
| No observability | Can't debug |
| cluster-admin RBAC | Security risk |
| No leader election | Split brain |
21. Operator Security Architecture
Least Privilege RBAC
yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: webapp-operator
rules:
- apiGroups: ["example.com"]
resources: ["webapps"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
Security Checklist
| Practice | Why |
| Least privilege RBAC | Minimize blast radius |
| Non-root container | Security |
| Read-only rootfs | Immutability |
| seccomp RuntimeDefault | Syscall filtering |
| NetworkPolicy | Restrict traffic |
| Webhook TLS | Encrypted communication |
22. Compliance & Security for Extensibility
| Framework | Requirement |
| PCI-DSS | RBAC, audit logs, no privileged |
| HIPAA | Audit trails, access controls |
| SOC2 | Change management, monitoring |
| FedRAMP | FIPS 140-2, STIG |
1:1 copy of the class Google Doc, code in code blocks.