Created
June 16, 2021 02:21
-
-
Save onefoursix/3b393f8b5305381a9efeda5c03e145b8 to your computer and use it in GitHub Desktop.
Pod Security Policy for Minikube
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: privileged | |
annotations: | |
seccomp.security.alpha.kubernetes.io/allowedProfileNames: "*" | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
spec: | |
privileged: true | |
allowPrivilegeEscalation: true | |
allowedCapabilities: | |
- "*" | |
volumes: | |
- "*" | |
hostNetwork: true | |
hostPorts: | |
- min: 0 | |
max: 65535 | |
hostIPC: true | |
hostPID: true | |
runAsUser: | |
rule: 'MustRunAsNonRoot' | |
seLinux: | |
rule: 'RunAsAny' | |
supplementalGroups: | |
rule: 'RunAsAny' | |
fsGroup: | |
rule: 'RunAsAny' | |
--- | |
apiVersion: policy/v1beta1 | |
kind: PodSecurityPolicy | |
metadata: | |
name: restricted | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
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: | |
# Forbid adding the root group. | |
- min: 1 | |
max: 65535 | |
fsGroup: | |
rule: 'MustRunAs' | |
ranges: | |
# Forbid adding the root group. | |
- min: 1 | |
max: 65535 | |
readOnlyRootFilesystem: false | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: psp:privileged | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
rules: | |
- apiGroups: ['policy'] | |
resources: ['podsecuritypolicies'] | |
verbs: ['use'] | |
resourceNames: | |
- privileged | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: psp:restricted | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
rules: | |
- apiGroups: ['policy'] | |
resources: ['podsecuritypolicies'] | |
verbs: ['use'] | |
resourceNames: | |
- restricted | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: default:restricted | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: psp:restricted | |
subjects: | |
- kind: Group | |
name: system:authenticated | |
apiGroup: rbac.authorization.k8s.io | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: RoleBinding | |
metadata: | |
name: default:privileged | |
namespace: kube-system | |
labels: | |
addonmanager.kubernetes.io/mode: EnsureExists | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: psp:privileged | |
subjects: | |
- kind: Group | |
name: system:masters | |
apiGroup: rbac.authorization.k8s.io | |
- kind: Group | |
name: system:nodes | |
apiGroup: rbac.authorization.k8s.io | |
- kind: Group | |
name: system:serviceaccounts:kube-system | |
apiGroup: rbac.authorization.k8s.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment