how to install nfs provisioner
how to install and use the nfs provisioner
3 minute read
how to install nfs provisioner
if you have a airgap environment, you need to need a kosi pull:
kosi pull --hub kubeops kubeops/nfs-subdir-external-provisioner:4.0.18 -o nfs-subdir-external-provisioner.tgz -r 10.2.10.110:30002/kubeops -t localhost:30002/kubeops
after that, you can create your values:
replicaCount: 1
strategyType: Recreate
namespace: nfs-external-provisioner
imagePullSecretName: nfs-ips
imagePullSecrets:
- name: nfs-ips # has to be the same as imagePullSecretName
nfs:
server: "10.2.10.10" # ip address of nfs server
path: /srv/nfs/share/ # path which the nfs server uses, not the path on the nfs client
mountOptions:
volumeName: nfs-subdir-external-provisioner-root
# Reclaim policy for the main nfs volume
reclaimPolicy: Retain
# For creating the StorageClass automatically:
storageClass:
create: true
# Set a provisioner name. If unset, a name will be generated.
# provisionerName:
# Set StorageClass as the default StorageClass
# Ignored if storageClass.create is false
defaultClass: true
# Set a StorageClass name
# Ignored if storageClass.create is false
name: nfs-client
# Allow volume to be expanded dynamically
allowVolumeExpansion: true
# Method used to reclaim an obsoleted volume
reclaimPolicy: Retain
# When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
archiveOnDelete: true
# If it exists and has 'delete' value, delete the directory. If it exists and has 'retain' value, save the directory.
# Overrides archiveOnDelete.
# Ignored if value not set.
onDelete:
# Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace.
# Ignored if value not set.
pathPattern:
# Set access mode - ReadWriteOnce, ReadOnlyMany or ReadWriteMany
accessModes: ReadWriteMany
# Set volume bindinng mode - Immediate or WaitForFirstConsumer
volumeBindingMode: Immediate
# Storage class annotations
annotations: {}
leaderElection:
# When set to false leader election will be disabled
enabled: true
## For RBAC support:
rbac:
# Specifies whether RBAC resources should be created
create: true
# If true, create & use Pod Security Policy resources
# https://kubernetes.io/docs/concepts/policy/pod-security-policy/
podSecurityPolicy:
enabled: false
# Deployment pod annotations
podAnnotations: {}
## Set pod priorityClassName
# priorityClassName: ""
podSecurityContext: {}
securityContext: {}
serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name:
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
# Additional labels for any resource created
labels: {}
podDisruptionBudget:
enabled: false
maxUnavailable: 1
after that, you can install it:
kosi install -p nfs-subdir-external-provisioner.tgz -f values.yaml --dname nfs-subdir-external-provisioner
after that, the storageclass should be there
kubectl get storageclass
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
...
nfs-client (default) cluster.local/nfs-external-provisioner-nfs-subdir-external-provisioner Retain Immediate true 37m
...
in our example the storageclass is named nfs-client, but can be changed with the storageClass.name parameter.
so if you want that deployments use the nfs storage, the storageclass must be changed to the storageclass of the nfs provisioner.
for example in the bitnami wordpress helm chart, you set the value:
persistence:
storageClass: "nfs-client"
```