Skip to content

Instantly share code, notes, and snippets.

@noseka1
Last active August 7, 2020 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noseka1/89a66cc5d313773e12ffd69b593d8393 to your computer and use it in GitHub Desktop.
Save noseka1/89a66cc5d313773e12ffd69b593d8393 to your computer and use it in GitHub Desktop.
Allow cluster-wide mounting of NFS volumes
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: mount-nfs
rules:
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
verbs:
- use
resourceNames:
- restricted-nfs
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: mount-nfs
subjects:
- kind: Group
name: system:serviceaccounts
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: mount-nfs
apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:
annotations:
kubernetes.io/description: this is a restricted SCC with addition of nfs volumes
name: restricted-nfs
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: false
allowedCapabilities: null
defaultAddCapabilities: null
fsGroup:
type: MustRunAs
groups: []
readOnlyRootFilesystem: false
requiredDropCapabilities:
- KILL
- MKNOD
- SETUID
- SETGID
runAsUser:
type: MustRunAsRange
seLinuxContext:
type: MustRunAs
supplementalGroups:
type: RunAsAny
users: []
volumes:
- configMap
- downwardAPI
- emptyDir
- persistentVolumeClaim
- projected
- secret
- nfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment