Stage 6, Part 3 of 9, RBAC, ServiceAccounts & Security
Text
PART 3: PRODUCTION FAILURE MODES
17. Top 10 Kubernetes Security Failures
#
Failure
Symptom
Root Cause
Fix
1
Over-privileged SA
Lateral movement
Broad RBAC
Least privilege
2
cluster-admin for humans
Full compromise
Convenience
OIDC + scoped RBAC
3
Secrets in Git
Credentials leaked
No secrets management
Sealed Secrets, SOPS
4
Privileged containers
Container escape
No PSS enforcement
PSA restricted
5
No NetworkPolicy
Lateral movement
Default allow-all
Default deny
6
Anonymous auth enabled
Unauthorized access
Default config
Disable
7
Webhook failurePolicy: Fail
Cluster outage
Webhook down
HA webhook
8
Unrotated certificates
Auth failures
No rotation
kubeadm certs renew
9
No audit logging
Can't investigate
Not configured
Enable audit logs
10
Image without signature verification
Backdoored image
No verifyImages
Kyverno verify
18. Security Incident Runbook
"Suspected RBAC Breach" — Step-by-Step
text
STEP 1: Identify the incident
# Alert source: audit logs, anomaly detection
# Verify legitimacy
STEP 2: Isolate the affected identity
# If ServiceAccount:
$ kubectl delete sa <sa-name> -n <namespace>
# If user:
# Revoke credentials at the IdP
STEP 3: Audit what the identity did
$ kubectl get events --field-selector reason=RBACDenied
# Or check audit logs
# Filter by the identity
STEP 4: Identify the breach vector
# Was the SA over-privileged?
$ kubectl get rolebindings,clusterrolebindings -A -o json | \
jq '.items[] | select(.subjects[]?.name=="<sa-name>")'
# Or for a user:
$ kubectl auth can-i --list --as=<user>
STEP 5: Check for lateral movement
# What else did the identity access?
# Check audit logs for all requests
STEP 6: Rotate compromised credentials
# Delete ServiceAccount and recreate
# Rotate any tokens
STEP 7: Fix the RBAC misconfiguration
# Remove over-privileged roles
# Apply least privilege
STEP 8: Post-incident
# Document
# Update policies
# Notify stakeholders
STEP 9: Escalate
# Security team, management
Indicators of Compromise (IoCs)
Indicator
Where to Look
Unexpected RBAC changes
Audit logs
Anomalous API access
Audit logs
New ServiceAccount created
Audit logs
ClusterRoleBinding created
Audit logs
Secrets accessed outside hours
Audit logs
Unexpected kubectl exec
Audit logs
New IAM role assumption
CloudTrail (AWS), Cloud Audit Logs (GCP)
19. Blast Radius Analysis
What Happens When Security Fails?
Component
Impact
Severity
cluster-admin compromised
Full cluster takeover
SEV-1
ServiceAccount compromised
Depends on RBAC
SEV-1 to SEV-3
Secret leaked
Depends on secret scope
SEV-1 to SEV-3
Privileged container escape
Node compromise
SEV-1
Image backdoor
Full service compromise
SEV-1
RBAC misconfiguration
Unintended access
SEV-2
Webhook down
Blocked admissions
SEV-2
Mitigation Strategies
Strategy
Implementation
Least privilege RBAC
Minimal permissions
OIDC for humans
Centralized identity
Pod Security Standards
Restricted enforcement
Network Policies
Default deny
Image signing
cosign + admission
Audit logging
Centralized SIEM
Secret management
Vault, External Secrets
Runtime security
Falco, Tetragon
1:1 copy of the class Google Doc, code in code blocks.