Created
March 17, 2020 09:10
-
-
Save abhisek/b9acfdc0505905ffc4240841195326ee to your computer and use it in GitHub Desktop.
PodSecurityPolicy to Prevent hostPath Mount
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: developers-psp | |
spec: | |
privileged: false | |
allowPrivilegeEscalation: false | |
hostNetwork: false | |
hostPID: false | |
hostIPC: false | |
seLinux: { 'rule': 'RunAsAny' } | |
runAsUser: { 'rule': 'RunAsAny' } | |
fsGroup: { 'rule': 'RunAsAny' } | |
supplementalGroups: { 'rule': 'RunAsAny' } | |
volumes: | |
- 'emptyDir' | |
- 'configMap' | |
- 'secret' | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: developers-psp-role | |
rules: | |
- apiGroups: ['policy'] | |
resources: ['podsecuritypolicies'] | |
verbs: ['use'] | |
resourceNames: | |
- developers-psp | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: developers-sa-psp-binding | |
roleRef: | |
kind: ClusterRole | |
name: developers-psp-role | |
apiGroup: rbac.authorization.k8s.io | |
subjects: | |
- kind: ServiceAccount | |
name: developer-sa | |
namespace: developers | |
- kind: ServiceAccount | |
name: default | |
namespace: developers | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment