# Should grant access to very few pods, i.e. kube-system system pods and possibly CNI pods apiVersion: policy/v1beta1 kind: PodSecurityPolicy metadata: annotations: # See https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccomp seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' name: privileged spec: allowedCapabilities: - '*' allowPrivilegeEscalation: true fsGroup: rule: 'RunAsAny' hostIPC: true hostNetwork: true hostPID: true hostPorts: - min: 0 max: 65535 privileged: true readOnlyRootFilesystem: false runAsUser: rule: 'RunAsAny' seLinux: rule: 'RunAsAny' supplementalGroups: rule: 'RunAsAny' volumes: - '*' --- # Cluster role which grants access to the privileged pod security policy apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: privileged-psp rules: - apiGroups: - policy resourceNames: - privileged resources: - podsecuritypolicies verbs: - use --- # Role binding for kube-system - allow nodes and kube-system service accounts - should take care of CNI i.e. flannel running in the kube-system namespace # Assumes access to the kube-system is restricted apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: kube-system-psp namespace: kube-system roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: privileged-psp subjects: # For the kubeadm kube-system nodes - apiGroup: rbac.authorization.k8s.io kind: Group name: system:nodes # For all service accounts in the kube-system namespace - apiGroup: rbac.authorization.k8s.io kind: Group name: system:serviceaccounts:kube-system