Last active
February 20, 2019 18:12
-
-
Save amimof/414e9608785e8162b0084712c441a12f to your computer and use it in GitHub Desktop.
A Kubernetes manifest for PodSecurityPolicy. Creates two policies; restricted and privileged where restricted is applied to system:authenticated. AppArmor required on the node hosts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: policy/v1beta1 | |
kind: PodSecurityPolicy | |
metadata: | |
name: restricted | |
annotations: | |
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default' | |
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default' | |
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default' | |
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default' | |
spec: | |
privileged: false | |
allowPrivilegeEscalation: false | |
requiredDropCapabilities: | |
- ALL | |
volumes: | |
- 'configMap' | |
- 'emptyDir' | |
- 'projected' | |
- 'secret' | |
- 'downwardAPI' | |
- 'persistentVolumeClaim' | |
hostNetwork: false | |
hostIPC: false | |
hostPID: false | |
runAsUser: | |
rule: 'MustRunAsNonRoot' | |
seLinux: | |
rule: 'RunAsAny' | |
supplementalGroups: | |
rule: 'MustRunAs' | |
ranges: | |
- min: 1 | |
max: 65535 | |
fsGroup: | |
rule: 'MustRunAs' | |
ranges: | |
- min: 1 | |
max: 65535 | |
readOnlyRootFilesystem: false | |
--- | |
apiVersion: policy/v1beta1 | |
kind: PodSecurityPolicy | |
metadata: | |
name: privileged | |
annotations: | |
seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' | |
spec: | |
privileged: true | |
allowPrivilegeEscalation: true | |
allowedCapabilities: | |
- '*' | |
volumes: | |
- '*' | |
hostNetwork: true | |
hostPorts: | |
- min: 0 | |
max: 65535 | |
hostIPC: true | |
hostPID: true | |
runAsUser: | |
rule: 'RunAsAny' | |
seLinux: | |
rule: 'RunAsAny' | |
supplementalGroups: | |
rule: 'RunAsAny' | |
fsGroup: | |
rule: 'RunAsAny' | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: psp:restricted | |
rules: | |
- apiGroups: | |
- extensions | |
resourceNames: | |
- restricted | |
resources: | |
- podsecuritypolicies | |
verbs: | |
- use | |
--- | |
kind: ClusterRoleBinding | |
apiVersion: rbac.authorization.k8s.io/v1 | |
metadata: | |
name: psp:restricted | |
subjects: | |
- kind: Group | |
name: system:authenticated | |
apiGroup: rbac.authorization.k8s.io | |
roleRef: | |
kind: ClusterRole | |
name: psp:restricted | |
apiGroup: rbac.authorization.k8s.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment