nfs: fix nfs issue on openshift
Signed-off-by: Ahmad Nurus S <prksu.sh@gmail.com>
This commit is contained in:
1 parent
b7b46b15e1
commit
1659687d37
6 files changed
+106
-1
No files matched your search
+51
-1
@@ -80,6 +80,57 @@ rook-nfs-provisioner-7b5ff479f6-688dm 1/1 Running 0 102s
|
||||
rook-nfs-webhook-74749cbd46-6jw2w 1/1 Running 0 102s
|
||||
```
|
||||
|
||||
## Create Openshift Security Context Constraints
|
||||
|
||||
On Openshift cluster, before creating NFS Server we need to create the security context constraints needed by nfs-server pods which running on openshift. The following yaml is found in `scc.yaml` under `/cluster/examples/kubernetes/nfs`.
|
||||
|
||||
> *NOTE: Older versions of OpenShift may require ```apiVersion: v1```*
|
||||
|
||||
```yaml
|
||||
kind: SecurityContextConstraints
|
||||
apiVersion: security.openshift.io/v1
|
||||
metadata:
|
||||
name: rook-nfs
|
||||
allowHostDirVolumePlugin: true
|
||||
allowHostIPC: false
|
||||
allowHostNetwork: false
|
||||
allowHostPID: false
|
||||
allowHostPorts: false
|
||||
allowPrivilegedContainer: false
|
||||
allowedCapabilities:
|
||||
- SYS_ADMIN
|
||||
- DAC_READ_SEARCH
|
||||
defaultAddCapabilities: null
|
||||
fsGroup:
|
||||
type: MustRunAs
|
||||
priority: null
|
||||
readOnlyRootFilesystem: false
|
||||
requiredDropCapabilities:
|
||||
- KILL
|
||||
- MKNOD
|
||||
- SYS_CHROOT
|
||||
runAsUser:
|
||||
type: RunAsAny
|
||||
seLinuxContext:
|
||||
type: MustRunAs
|
||||
supplementalGroups:
|
||||
type: RunAsAny
|
||||
volumes:
|
||||
- configMap
|
||||
- downwardAPI
|
||||
- emptyDir
|
||||
- persistentVolumeClaim
|
||||
- secret
|
||||
users:
|
||||
- system:serviceaccount:rook-nfs:rook-nfs-server
|
||||
```
|
||||
|
||||
You can create scc with following command:
|
||||
|
||||
```console
|
||||
oc create -f scc.yaml
|
||||
```
|
||||
|
||||
## Create and Initialize NFS Server
|
||||
|
||||
Now that the operator is running, we can create an instance of a NFS server by creating an instance of the `nfsservers.nfs.rook.io` resource.
|
||||
@@ -124,7 +175,6 @@ metadata:
|
||||
name: rook-nfs
|
||||
namespace: rook-nfs
|
||||
spec:
|
||||
serviceAccountName: rook-nfs
|
||||
replicas: 1
|
||||
exports:
|
||||
- name: share1
|
||||
|
||||
@@ -3,6 +3,12 @@ kind: Namespace
|
||||
metadata:
|
||||
name: rook-nfs
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-nfs-server
|
||||
namespace: rook-nfs
|
||||
---
|
||||
# A rook ceph cluster must be running
|
||||
# Create a rook ceph cluster using examples in rook/cluster/examples/kubernetes/ceph
|
||||
# Refer to https://rook.io/docs/rook/master/ceph-quickstart.html for a quick rook cluster setup
|
||||
|
||||
@@ -3,6 +3,12 @@ kind: Namespace
|
||||
metadata:
|
||||
name: rook-nfs
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-nfs-server
|
||||
namespace: rook-nfs
|
||||
---
|
||||
# A default storageclass must be present
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
kind: SecurityContextConstraints
|
||||
apiVersion: security.openshift.io/v1
|
||||
metadata:
|
||||
name: rook-nfs
|
||||
allowHostDirVolumePlugin: true
|
||||
allowHostIPC: false
|
||||
allowHostNetwork: false
|
||||
allowHostPID: false
|
||||
allowHostPorts: false
|
||||
allowPrivilegedContainer: false
|
||||
allowedCapabilities:
|
||||
- SYS_ADMIN
|
||||
- DAC_READ_SEARCH
|
||||
defaultAddCapabilities: null
|
||||
fsGroup:
|
||||
type: MustRunAs
|
||||
priority: null
|
||||
readOnlyRootFilesystem: false
|
||||
requiredDropCapabilities:
|
||||
- KILL
|
||||
- MKNOD
|
||||
- SYS_CHROOT
|
||||
runAsUser:
|
||||
type: RunAsAny
|
||||
seLinuxContext:
|
||||
type: MustRunAs
|
||||
supplementalGroups:
|
||||
type: RunAsAny
|
||||
volumes:
|
||||
- configMap
|
||||
- downwardAPI
|
||||
- emptyDir
|
||||
- persistentVolumeClaim
|
||||
- secret
|
||||
users:
|
||||
- system:serviceaccount:rook-nfs:rook-nfs-server
|
||||
@@ -84,6 +84,7 @@ func newStatefulSetForNFSServer(cr *nfsv1alpha1.NFSServer) *appsv1.StatefulSet {
|
||||
Labels: newLabels(cr),
|
||||
},
|
||||
Spec: corev1.PodSpec{
|
||||
ServiceAccountName: "rook-nfs-server",
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
ImagePullPolicy: "IfNotPresent",
|
||||
|
||||
@@ -510,6 +510,12 @@ spec:
|
||||
func (i *NFSManifests) GetNFSServer(namespace string, count int, storageClassName string) string {
|
||||
return `
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-nfs-server
|
||||
namespace: ` + namespace + `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: test-claim
|
||||
|
||||
Reference in new issue
Block a user