Skip to content

Instantly share code, notes, and snippets.

@developer-guy
Forked from shazadbrohi/restricted-psp.yaml
Created November 4, 2020 07:53
Show Gist options
  • Save developer-guy/4dd08831833bdb1d0bb816e555e9525d to your computer and use it in GitHub Desktop.
Save developer-guy/4dd08831833bdb1d0bb816e555e9525d to your computer and use it in GitHub Desktop.
A restricted pod security policy
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: my-restricted-psp
spec:
privileged: false
# Required to prevent escalations to root.
allowPrivilegeEscalation: false
# Allow core volume types.
volumes:
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
- 'nfs'
- 'persistentVolumeClaim'
- 'awsElasticBlockStore'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
# Require the container to run without root privileges.
rule: 'RunAsAny'
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment