Here are my notes for setting up the SIG’s nfs-provisioner. You should follow these directions to setup the nfs-provisioner kubernetes-sigs/nfs-subdir-external-provisioner.
- Clone the nfs-subdir-external-provisioner
git clone https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner.git
- If you haven’t already, you may need to create the nfs-provisioner namespace.
a. Create the ns.yaml
apiVersion: v1
kind: Namespace
metadata:
labels:
kubernetes.io/metadata.name: nfs-provisioner
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/enforce-version: v1.24
name: nfs-provisioner
b. create the namespace
oc apply -f ns.yaml
c. annotate the namespace
oc label namespace/nfs-provisioner security.openshift.io/scc.podSecurityLabelSync=false --overwrite=true
oc label namespace/nfs-provisioner pod-security.kubernetes.io/enforce=privileged --overwrite=true
oc label namespace/nfs-provisioner pod-security.kubernetes.io/audit=privileged --overwrite=true
oc label namespace/nfs-provisioner pod-security.kubernetes.io/warn=privileged --overwrite=true
- Change to the deploy/ directory
cd nfs-subdir-external-provisioner/deploy
-
Update the namespace
default
tonfs-provisioner
for deployment.yaml -
On the Bastion server, look at
ocp4-helpernode/helpernode_vars.yaml
for thehelper.ipaddr
value.
helper:
networkifacename: env3
name: "bastion-0"
ipaddr: "193.168.200.15"
- Update the deployment with the NFS_SERVER using the helper.ipaddr and the NFS_PATH /export. It should look like the following:
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: k8s-sigs.io/nfs-subdir-external-provisioner
- name: NFS_SERVER
value: 193.168.200.15
- name: NFS_PATH
value: /export
volumes:
- name: nfs-client-root
nfs:
server: 193.168.200.15
path: /export
v4.0.2 supports ppc64le.
Be sure to remove the namespace: default
- Create the deployment
oc apply -f deployment.yaml
deployment.apps/nfs-client-provisioner created
- Get the pods
oc get pods
NAME READY STATUS RESTARTS AGE
nfs-client-provisioner-b8764c6bb-mjnq9 1/1 Running 0 36s
- Setup Authorization
NAMESPACE=`oc project -q`
sed -i'' "s/namespace:.*/namespace: $NAMESPACE/g" ./rbac.yaml
oc create -f rbac.yaml
oc adm policy add-scc-to-user hostmount-anyuid system:serviceaccount:$NAMESPACE:nfs-client-provisioner
- Create the storage class file
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-client
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment's env PROVISIONER_NAME'
parameters:
pathPattern: "${.PVC.namespace}/${.PVC.annotations.nfs.io/storage-path}" # waits for nfs.io/storage-path annotation, if not specified will accept as empty string.
onDelete: delete
- Apply the StorageClass
oc apply -f sc.yml
- Then you can deploy the PV and PVC files/6_EvictPodsWithPVC_dp.yml