Skip to content

Latest commit

 

History

History
79 lines (67 loc) · 2.76 KB

File metadata and controls

79 lines (67 loc) · 2.76 KB

NFS external storage role

Role to NFS external storage provisioner. A storage class named managed-nfs-storage is created and set as default if no other default Storage Class is defined.

Parameters

Name Required Default Description
nes_nfs_server Yes undefined NFS server's FQDN or IP Address
nes_nfs_path Yes undefined NFS export path
nes_path_pattern No undefined Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace
nes_namespace No openshift-nfs-storage Deployment namespace
nes_provisioner_image No registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 Provisioner image

Requirements

  • A NFS server reachable from the OCP cluster. For details about the proper setup using RHEL see Installing NFS.
  • An exported filesystem with the permission according to the pods needs.

Example of usage

- name: "deploy-operators : Install OCS Operator"
  ansible.builtin.include_role:
    name: redhatci.ocp.nfs_external_storage
  vars:
    nes_nfs_server: "192.168.16.11"
    nes_nfs_path: "/exports/nfs-provisioner"
    nes_path_pattern: "pvc123_${.PVC.name}"

Sample manifest to create a persistent volume claim

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: test-claim
  annotations:
    volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Mi

Sample manifest to create a pod binding to the PVC

kind: Pod
apiVersion: v1
metadata:
  name: test-pod
spec:
  containers:
  - name: test-pod
    image: gcr.io/google_containers/busybox:1.36
    command:
      - "/bin/sh"
    args:
      - "-c"
      - "touch /mnt/SUCCESS && exit 0 || exit 1"
    volumeMounts:
      - name: nfs-pvc
        mountPath: "/mnt"
  restartPolicy: "Never"
  volumes:
    - name: nfs-pvc
      persistentVolumeClaim:
        claimName: test-claim

References

License

Apache License, Version 2.0