Not a separate resource: fields on Pod/Deployment template
Key fields
Field
Scope
Effect
runAsNonRoot: true
Pod & Container
Fail if image runs as root (0)
runAsUser: 1001
Pod & Container
Run as specific UID
runAsGroup
Pod & Container
Group for process
fsGroup
Pod
volume ownership
allowPrivilegeEscalation: false
Container
Block privilege escalation
privileged: false
Container
No host-level privileges
readOnlyRootFilesystem: true
Container
Root FS read-only (Notice smallcase for system)
capabilities.add / capabilities.drop
Container
Linux capabilities (e.g. drop: [ALL]), Can only be configured at container level
# Pod Configurationspec:securityContext:runAsNonRoot:truefsGroup:2000containers:-name: app
securityContext:allowPrivilegeEscalation:falsecapabilities:drop:[ALL]readOnlyRootFilesystem:true