Stage 9, Part 5 of 9 · p. 78, Cluster Extensibility (CRDs, Controllers, Operators)

PART 5: ARCHITECTURE & STRATEGY

20. When to Build an Operator

Decision Framework

FactorBuild OperatorUse 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-PatternWhy It's Bad
Operator for everythingOverhead, complexity
No testingBugs in production
No observabilityCan't debug
cluster-admin RBACSecurity risk
No leader electionSplit 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

PracticeWhy
Least privilege RBACMinimize blast radius
Non-root containerSecurity
Read-only rootfsImmutability
seccomp RuntimeDefaultSyscall filtering
NetworkPolicyRestrict traffic
Webhook TLSEncrypted communication

22. Compliance & Security for Extensibility

FrameworkRequirement
PCI-DSSRBAC, audit logs, no privileged
HIPAAAudit trails, access controls
SOC2Change management, monitoring
FedRAMPFIPS 140-2, STIG

1:1 copy of the class Google Doc, code in code blocks.